feat: 增强模型选择和错误处理机制
优化模型ID传递逻辑,支持请求级别的模型覆盖;完善流式响应的错误处理
This commit is contained in:
@@ -40,10 +40,10 @@ const { t } = useI18n();
|
||||
const { navigateToKnowledgeBaseList } = useKnowledgeBaseCreationNavigation();
|
||||
|
||||
const sendMsg = (value: string, modelId: string, mentionedItems: any[]) => {
|
||||
createNewSession(value, mentionedItems);
|
||||
createNewSession(value, modelId, mentionedItems);
|
||||
}
|
||||
|
||||
async function createNewSession(value: string, mentionedItems: any[] = []) {
|
||||
async function createNewSession(value: string, modelId: string, mentionedItems: any[] = []) {
|
||||
const selectedKbs = settingsStore.settings.selectedKnowledgeBases || [];
|
||||
const selectedFiles = settingsStore.settings.selectedFiles || [];
|
||||
|
||||
@@ -63,7 +63,7 @@ async function createNewSession(value: string, mentionedItems: any[] = []) {
|
||||
try {
|
||||
const res = await createSessions(sessionData);
|
||||
if (res.data && res.data.id) {
|
||||
await navigateToSession(res.data.id, value, mentionedItems);
|
||||
await navigateToSession(res.data.id, value, modelId, mentionedItems);
|
||||
} else {
|
||||
console.error('[createChat] Failed to create session');
|
||||
MessagePlugin.error(t('createChat.messages.createFailed'));
|
||||
@@ -74,7 +74,7 @@ async function createNewSession(value: string, mentionedItems: any[] = []) {
|
||||
}
|
||||
}
|
||||
|
||||
const navigateToSession = async (sessionId: string, value: string, mentionedItems: any[]) => {
|
||||
const navigateToSession = async (sessionId: string, value: string, modelId: string, mentionedItems: any[]) => {
|
||||
const now = new Date().toISOString();
|
||||
let obj = {
|
||||
title: t('createChat.newSessionTitle'),
|
||||
@@ -87,7 +87,7 @@ const navigateToSession = async (sessionId: string, value: string, mentionedItem
|
||||
};
|
||||
usemenuStore.updataMenuChildren(obj);
|
||||
usemenuStore.changeIsFirstSession(true);
|
||||
usemenuStore.changeFirstQuery(value, mentionedItems);
|
||||
usemenuStore.changeFirstQuery(value, mentionedItems, modelId);
|
||||
router.push(`/platform/chat/${sessionId}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user