Files
Atlas/web/src/composables/useUserMeta.ts
T
renjue 4009214cbc
CI / docker (push) Successful in 7m4s
实现 Atlas AI 平台一期能力并完成品牌化改造。
引入用户端对话/生图与管理端 Provider 配置,统一 invoke 编排、Gateway、请求日志与模型管理;前端按设计规范拆分布局,Go module 更名为 github.com/rose_cat707/Atlas;生图长任务 SSE 推送;管理端登录防爆破;协议与服务类型联动;Replicate 模型同步修复;用户端创作台 UI 重构;管理端创作历史替代请求日志。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 21:08:57 +08:00

43 lines
1017 B
TypeScript

import { ref } from 'vue'
import api from '@/api/client'
export interface ModelInfo {
id: string
name: string
}
export interface ServiceTypeMeta {
capabilities: { stream?: boolean; sync?: boolean; async?: boolean }
providers: { id: number; name: string; is_default: boolean }[]
models: ModelInfo[]
default_model: string
}
const meta = ref<Record<string, ServiceTypeMeta> | null>(null)
const loading = ref(false)
export function useUserMeta() {
async function ensureSession() {
await api.post('/user/session')
}
async function load() {
if (meta.value) return meta.value
loading.value = true
try {
await ensureSession()
const res = await api.get<{ service_types: Record<string, ServiceTypeMeta> }>('/user/meta')
meta.value = res.data.service_types
return meta.value
} finally {
loading.value = false
}
}
function getService(type: string) {
return meta.value?.[type]
}
return { meta, loading, load, ensureSession, getService }
}