|
@@ -6,6 +6,8 @@ import { useUserStore } from './user';
|
|
|
interface FormattedMessage {
|
|
interface FormattedMessage {
|
|
|
role: 'user' | 'assistant';
|
|
role: 'user' | 'assistant';
|
|
|
content: string;
|
|
content: string;
|
|
|
|
|
+ thinking?: string | null;
|
|
|
|
|
+ searching?: string | null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
interface Message {
|
|
interface Message {
|
|
@@ -48,7 +50,12 @@ export const useChatStore = defineStore('chat', () => {
|
|
|
role: msg.role,
|
|
role: msg.role,
|
|
|
content: msg.content,
|
|
content: msg.content,
|
|
|
displayContent: msg.content,
|
|
displayContent: msg.content,
|
|
|
- ...blankMeta(),
|
|
|
|
|
|
|
+ thinkingContent: msg.thinking || '',
|
|
|
|
|
+ thinkingDisplayContent: msg.thinking || '',
|
|
|
|
|
+ isThinkingCollapsed: true,
|
|
|
|
|
+ searchingItems: msg.searching ? [msg.searching] : [],
|
|
|
|
|
+ phase: 'done' as const,
|
|
|
|
|
+ isStreaming: false,
|
|
|
}));
|
|
}));
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('Error loading chat history: ', error);
|
|
console.error('Error loading chat history: ', error);
|
|
@@ -56,7 +63,7 @@ export const useChatStore = defineStore('chat', () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const sendMessage = async (message: string, stream: boolean) => {
|
|
const sendMessage = async (message: string, stream: boolean) => {
|
|
|
- if (!message.trim() || !userStore.userId) return;
|
|
|
|
|
|
|
+ if (!message.trim() || !userStore.userId || isLoading.value) return;
|
|
|
|
|
|
|
|
messages.value.push({ role: 'user', content: message, displayContent: message, ...blankMeta() });
|
|
messages.value.push({ role: 'user', content: message, displayContent: message, ...blankMeta() });
|
|
|
isLoading.value = true;
|
|
isLoading.value = true;
|