Commit 7943ed40 authored by nick zheng's avatar nick zheng

Merge branch 'beta' into 'master'

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

See merge request !104
parents 3e5e4c1a 17ae57e2
...@@ -71,16 +71,6 @@ let generatePreambleController: AbortController | null = null ...@@ -71,16 +71,6 @@ let generatePreambleController: AbortController | null = null
let generateFeaturedQuestionsController: AbortController | null = null let generateFeaturedQuestionsController: AbortController | null = null
let generateAgentSystemController: AbortController | null = null let generateAgentSystemController: AbortController | null = null
watch(
() => personalAppConfigStore.$state,
() => {
if (!baseInfo.value.agentId) {
handleUpdatePersonalAppId()
}
},
{ deep: true, once: true },
)
watch( watch(
() => personalAppConfigStore.$state, () => personalAppConfigStore.$state,
() => { () => {
...@@ -109,27 +99,28 @@ onUnmounted(() => { ...@@ -109,27 +99,28 @@ onUnmounted(() => {
const handleSavePersonalAppConfig = useThrottleFn( const handleSavePersonalAppConfig = useThrottleFn(
async () => { async () => {
baseInfo.value.agentId && (await handleSaveAgentApplication()) await handleSaveAgentApplication()
}, },
() => (isFullScreenLoading.value ? 6000 : 2000), () => (isFullScreenLoading.value ? 6000 : 2000),
true, true,
) )
// 保存应用配置 // 更新保存应用配置
async function handleSaveAgentApplication() { async function handleSaveAgentApplication() {
if (!baseInfo.value.agentTitle) { if (!baseInfo.value.agentTitle) {
return return
} }
await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state) if (!baseInfo.value.agentId) {
} await handleCreatePersonalAgent()
// 更新保存应用ID
async function handleUpdatePersonalAppId() {
if (!baseInfo.value.agentTitle) {
return return
} }
await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state)
}
// 新建应用
async function handleCreatePersonalAgent() {
const res = await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state) const res = await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state)
if (res.code === 0) { 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