Commit 17ae57e2 authored by nick zheng's avatar nick zheng

fix(应用配置): 保存更新应用

parent 42029a86
......@@ -71,16 +71,6 @@ let generatePreambleController: AbortController | null = null
let generateFeaturedQuestionsController: AbortController | null = null
let generateAgentSystemController: AbortController | null = null
watch(
() => personalAppConfigStore.$state,
() => {
if (!baseInfo.value.agentId) {
handleUpdatePersonalAppId()
}
},
{ deep: true, once: true },
)
watch(
() => personalAppConfigStore.$state,
() => {
......@@ -109,27 +99,28 @@ onUnmounted(() => {
const handleSavePersonalAppConfig = useThrottleFn(
async () => {
baseInfo.value.agentId && (await handleSaveAgentApplication())
await handleSaveAgentApplication()
},
() => (isFullScreenLoading.value ? 6000 : 2000),
true,
)
// 保存应用配置
// 更新保存应用配置
async function handleSaveAgentApplication() {
if (!baseInfo.value.agentTitle) {
return
}
await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state)
}
// 更新保存应用ID
async function handleUpdatePersonalAppId() {
if (!baseInfo.value.agentTitle) {
if (!baseInfo.value.agentId) {
await handleCreatePersonalAgent()
return
}
await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state)
}
// 新建应用
async function handleCreatePersonalAgent() {
const res = await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state)
if (res.code === 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment