mirror of
https://github.com/infinilabs/coco-app.git
synced 2025-12-16 11:37:47 +01:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user