From 42651a944f7405b36d873832ba1b05c21ab9cf03 Mon Sep 17 00:00:00 2001 From: ulleo Date: Thu, 24 Jul 2025 11:00:26 +0800 Subject: [PATCH 1/2] fix: quick start chat --- frontend/src/views/chat/index.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index 874d0bcf..5f6571d2 100644 --- a/frontend/src/views/chat/index.vue +++ b/frontend/src/views/chat/index.vue @@ -412,7 +412,7 @@ const createNewChat = async () => { chatCreatorRef.value?.showDs() } -function getChatList() { +function getChatList(callback?: () => void) { loading.value = true chatApi .list() @@ -421,6 +421,9 @@ function getChatList() { }) .finally(() => { loading.value = false + if (callback && typeof callback === 'function') { + callback() + } }) } @@ -754,10 +757,6 @@ function stop(func?: (...p: any[]) => void, ...param: any[]) { } } -onMounted(() => { - getChatList() -}) - defineExpose({ getHistoryList, toAssistantHistory, @@ -767,7 +766,7 @@ defineExpose({ const hiddenChatCreatorRef = ref() -onMounted(() => { +function jumpCreatChat() { if (props.startChatDsId) { const _id = props.startChatDsId nextTick(() => { @@ -776,6 +775,10 @@ onMounted(() => { const newUrl = window.location.hash.replace(/\?.*$/, '') history.replaceState({}, '', newUrl) } +} + +onMounted(() => { + getChatList(jumpCreatChat) }) From 81e418f1aa222a4121daad6e2ca995256a94be77 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 24 Jul 2025 11:03:13 +0800 Subject: [PATCH 2/2] perf: User cache --- backend/common/core/sqlbot_cache.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/common/core/sqlbot_cache.py b/backend/common/core/sqlbot_cache.py index e13bc607..e3fe8482 100644 --- a/backend/common/core/sqlbot_cache.py +++ b/backend/common/core/sqlbot_cache.py @@ -124,6 +124,8 @@ def cache( result = await func(*args, **kwargs) actual_expire = expire + random.randint(-jitter, jitter) + if await backend.get(cache_key): + await backend.clear(cache_key) await backend.set(cache_key, result, actual_expire) SQLBotLogUtil.debug(f"Cache set: {cache_key} (expire: {actual_expire}s)")