fix: correct incorrect assistant display when quick ai access (#779)

* fix: correct incorrect assistant display when quick ai access

* docs: update changelog
This commit is contained in:
ayangweb
2025-07-19 13:54:39 +08:00
committed by GitHub
parent f4f7732927
commit 657df482bf
2 changed files with 11 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ Information about release notes of Coco Server is provided here.
- fix: unregister ext hotkey when it gets deleted #770
- fix: indexing apps does not respect search scope config #773
- fix: restore missing category titles on subpages #772
- fix: correct incorrect assistant display when quick ai access #779
### ✈️ Improvements

View File

@@ -1,4 +1,4 @@
import { useCallback, useRef, useMemo, useState } from "react";
import { useCallback, useRef, useMemo, useState, useEffect } from "react";
import { cloneDeep, isEmpty } from "lodash-es";
import { useSearchStore } from "@/stores/searchStore";
@@ -43,12 +43,17 @@ export function useAssistantManager({
const askAIRef = useRef<Assistant | null>(null);
const askAI = useMemo(() => {
const newAssistant = selectedAssistant ?? quickAiAccessAssistant;
return newAssistant;
return selectedAssistant ?? quickAiAccessAssistant;
}, [quickAiAccessAssistant, selectedAssistant]);
const [assistantDetail, setAssistantDetail] = useState<any>({});
useEffect(() => {
if (goAskAi) return;
askAIRef.current = null;
}, [goAskAi]);
const assistant_get = useCallback(async () => {
if (!askAI?.id) return;
if (disabledExtensions.includes("QuickAIAccess")) return;
@@ -75,7 +80,8 @@ export function useAssistantManager({
if (disabledExtensions.includes("QuickAIAccess")) return;
askAIRef.current = cloneDeep(askAI);
askAIRef.current ??= cloneDeep(askAI);
if (!askAIRef.current) return;
let value = inputValue.trim();