Files
Atlas/web/src/composables/usePresets.ts
T
renjue 4bc1b8d2e3
CI / docker (push) Has been cancelled
实现 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 22:34:44 +08:00

37 lines
802 B
TypeScript

import { ref } from 'vue'
import api from '@/api/client'
export interface Preset {
id: number
name: string
service_type: string
params_json: string
}
export function usePresets(serviceType: string) {
const items = ref<Preset[]>([])
async function load() {
const res = await api.get<{ items: Preset[] }>('/user/presets', {
params: { service_type: serviceType },
})
items.value = res.data.items
}
async function save(name: string, params: Record<string, unknown>) {
await api.post('/user/presets', {
name,
service_type: serviceType,
params_json: JSON.stringify(params),
})
await load()
}
async function remove(id: number) {
await api.delete(`/user/presets/${id}`)
await load()
}
return { items, load, save, remove }
}