Commit 4251ce1f authored by nick zheng's avatar nick zheng

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

parent 17ae57e2
......@@ -71,6 +71,16 @@ let generatePreambleController: AbortController | null = null
let generateFeaturedQuestionsController: AbortController | null = null
let generateAgentSystemController: AbortController | null = null
watch(
() => personalAppConfigStore.$state,
() => {
if (!baseInfo.value.agentId) {
handleCreatePersonalAgent()
}
},
{ deep: true },
)
watch(
() => personalAppConfigStore.$state,
() => {
......@@ -99,7 +109,7 @@ onUnmounted(() => {
const handleSavePersonalAppConfig = useThrottleFn(
async () => {
await handleSaveAgentApplication()
baseInfo.value.agentId && (await handleSaveAgentApplication())
},
() => (isFullScreenLoading.value ? 6000 : 2000),
true,
......@@ -111,16 +121,15 @@ async function handleSaveAgentApplication() {
return
}
if (!baseInfo.value.agentId) {
await handleCreatePersonalAgent()
return
}
await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state)
}
// 新建应用
async function handleCreatePersonalAgent() {
if (!baseInfo.value.agentTitle) {
return
}
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