JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix:修改对话框内容切换页签消失
openJiuwen-bot163dfe05ca39
diff --git a/jiuwenclaw/web/src/components/ChatPanel/InputArea.tsx b/jiuwenclaw/web/src/components/ChatPanel/InputArea.tsxindex 4ce70df199..adfcab4260 100644--- a/jiuwenclaw/web/src/components/ChatPanel/InputArea.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/InputArea.tsx@@ -21,7 +21,6 @@ export function InputArea({isProcessing,onNewSession,}: InputAreaProps) {- const [value, setValue] = useState('');const [pendingVoiceText, setPendingVoiceText] = useState('');const textareaRef = useRef<HTMLTextAreaElement>(null);const autoSendTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);@@ -29,7 +28,7 @@ export function InputArea({const activePointerIdRef = useRef<number | null>(null);const isVoicePressingRef = useRef(false);const { t } = useTranslation();- const { isPaused, taskQueue, addToTaskQueue, removeFromTaskQueue } = useChatStore();+ const { isPaused, taskQueue, addToTaskQueue, removeFromTaskQueue, inputValue, setInputValue } = useChatStore();const { mode } = useSessionStore();const isInterruptible = isProcessing || isPaused;const isAgentMode = mode === 'agent';@@ -73,9 +72,9 @@ export function InputArea({useEffect(() => {if (!isListening && pendingVoiceText) {- const finalText = (value + pendingVoiceText).trim();+ const finalText = (inputValue + pendingVoiceText).trim();if (finalText) {- setValue(finalText);+ setInputValue(finalText);setPendingVoiceText('');setTimeout(() => {@@ -84,14 +83,14 @@ export function InputArea({} else {onSubmit(finalText);}- setValue('');+ setInputValue('');if (textareaRef.current) {textareaRef.current.style.height = 'auto';}}, 150);}}- }, [isListening, pendingVoiceText, value, isInterruptible, onSubmit, onInterrupt]);+ }, [isListening, pendingVoiceText, inputValue, isInterruptible, onSubmit, onInterrupt, setInputValue]);useEffect(() => {return () => {@@ -102,7 +101,7 @@ export function InputArea({}, []);const handleSubmit = useCallback(() => {- const trimmed = (value + pendingVoiceText).trim();+ const trimmed = (inputValue + pendingVoiceText).trim();if (!trimmed) return;if (isListening) {@@ -120,13 +119,13 @@ export function InputArea({} else {onSubmit(trimmed);}- setValue('');+ setInputValue('');setPendingVoiceText('');if (textareaRef.current) {textareaRef.current.style.height = 'auto';}- }, [value, pendingVoiceText, isInterruptible, isListening, onSubmit, onInterrupt, stopListening, isAgentMode, addToTaskQueue]);+ }, [inputValue, pendingVoiceText, isInterruptible, isListening, onSubmit, onInterrupt, stopListening, isAgentMode, addToTaskQueue, setInputValue]);const handleKeyDown = useCallback((e: KeyboardEvent<HTMLTextAreaElement>) => {@@ -199,19 +198,19 @@ export function InputArea({const handleNewSession = useCallback(() => {if (isListening || isInterruptible) return;- setValue('');+ setInputValue('');setPendingVoiceText('');if (textareaRef.current) {textareaRef.current.style.height = 'auto';}onNewSession();- }, [isListening, isInterruptible, onNewSession]);+ }, [isListening, isInterruptible, onNewSession, setInputValue]);const displayValue = isListening- ? value + pendingVoiceText + interimTranscript- : value + pendingVoiceText;+ ? inputValue + pendingVoiceText + interimTranscript+ : inputValue + pendingVoiceText;- const canSend = value.trim().length > 0 || isListening;+ const canSend = inputValue.trim().length > 0 || isListening;const modeIndex = Math.max(0, modes.findIndex((m) => m.value === mode));return (@@ -260,7 +259,7 @@ export function InputArea({<textarearef={textareaRef}value={displayValue}- onChange={(e) => setValue(e.target.value)}+ onChange={(e) => setInputValue(e.target.value)}onKeyDown={handleKeyDown}onCompositionStart={() => { isComposingRef.current = true; }}onCompositionEnd={() => { isComposingRef.current = false; }}diff --git a/jiuwenclaw/web/src/stores/chatStore.ts b/jiuwenclaw/web/src/stores/chatStore.tsindex c5d6b4bdbc..8486103a08 100644--- a/jiuwenclaw/web/src/stores/chatStore.ts+++ b/jiuwenclaw/web/src/stores/chatStore.ts@@ -68,6 +68,8 @@ interface ChatState {taskQueue: TaskItem[];// 用户问题相关pendingQuestion: AskUserQuestionPayload | null; // 待回答的问题+ // 输入框内容+ inputValue: string;// ActionsaddMessage: (message: Message) => void;@@ -93,6 +95,8 @@ interface ChatState {removeFromTaskQueue: (id: string) => void;// 用户问题相关setPendingQuestion: (question: AskUserQuestionPayload | null) => void;+ // 输入框相关+ setInputValue: (value: string) => void;}export const useChatStore = create<ChatState>((set, get) => ({@@ -115,6 +119,7 @@ export const useChatStore = create<ChatState>((set, get) => ({},taskQueue: [],pendingQuestion: null,+ inputValue: '',addMessage: (message) => {set((state) => ({@@ -509,4 +514,8 @@ export const useChatStore = create<ChatState>((set, get) => ({setPendingQuestion: (question) => {set({ pendingQuestion: question });},++ setInputValue: (value) => {+ set({ inputValue: value });+ },}));