@lobehub/chat 1.62.11 → 1.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/changelog/v1.json +24 -0
- package/locales/ar/chat.json +26 -0
- package/locales/ar/models.json +21 -0
- package/locales/bg-BG/chat.json +26 -0
- package/locales/bg-BG/models.json +21 -0
- package/locales/de-DE/chat.json +26 -0
- package/locales/de-DE/models.json +21 -0
- package/locales/en-US/chat.json +26 -0
- package/locales/en-US/models.json +21 -0
- package/locales/es-ES/chat.json +26 -0
- package/locales/es-ES/models.json +21 -0
- package/locales/fa-IR/chat.json +26 -0
- package/locales/fa-IR/models.json +21 -0
- package/locales/fr-FR/chat.json +26 -0
- package/locales/fr-FR/models.json +21 -0
- package/locales/it-IT/chat.json +26 -0
- package/locales/it-IT/models.json +21 -0
- package/locales/ja-JP/chat.json +26 -0
- package/locales/ja-JP/models.json +21 -0
- package/locales/ko-KR/chat.json +26 -0
- package/locales/ko-KR/models.json +21 -0
- package/locales/nl-NL/chat.json +26 -0
- package/locales/nl-NL/models.json +21 -0
- package/locales/pl-PL/chat.json +26 -0
- package/locales/pl-PL/models.json +21 -0
- package/locales/pt-BR/chat.json +26 -0
- package/locales/pt-BR/models.json +21 -0
- package/locales/ru-RU/chat.json +26 -0
- package/locales/ru-RU/models.json +21 -0
- package/locales/tr-TR/chat.json +26 -0
- package/locales/tr-TR/models.json +21 -0
- package/locales/vi-VN/chat.json +26 -0
- package/locales/vi-VN/models.json +21 -0
- package/locales/zh-CN/chat.json +27 -1
- package/locales/zh-CN/models.json +25 -4
- package/locales/zh-TW/chat.json +26 -0
- package/locales/zh-TW/models.json +21 -0
- package/package.json +2 -2
- package/src/app/(backend)/webapi/chat/groq/route.test.ts +29 -0
- package/src/app/(backend)/webapi/chat/groq/route.ts +21 -0
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/index.tsx +1 -0
- package/src/config/aiModels/google.ts +8 -0
- package/src/config/aiModels/groq.ts +111 -95
- package/src/config/aiModels/hunyuan.ts +36 -4
- package/src/config/aiModels/internlm.ts +4 -5
- package/src/config/aiModels/jina.ts +3 -0
- package/src/config/aiModels/mistral.ts +35 -21
- package/src/config/aiModels/novita.ts +293 -32
- package/src/config/aiModels/perplexity.ts +14 -2
- package/src/config/aiModels/qwen.ts +91 -37
- package/src/config/aiModels/sensenova.ts +70 -17
- package/src/config/aiModels/siliconcloud.ts +5 -3
- package/src/config/aiModels/stepfun.ts +19 -0
- package/src/config/aiModels/taichu.ts +4 -2
- package/src/config/aiModels/upstage.ts +24 -11
- package/src/config/modelProviders/openrouter.ts +1 -0
- package/src/config/modelProviders/qwen.ts +2 -1
- package/src/const/settings/agent.ts +1 -0
- package/src/database/repositories/aiInfra/index.test.ts +2 -5
- package/src/database/repositories/aiInfra/index.ts +6 -2
- package/src/database/schemas/message.ts +2 -1
- package/src/database/server/models/aiModel.ts +1 -1
- package/src/database/server/models/aiProvider.ts +6 -1
- package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +38 -0
- package/src/features/ChatInput/ActionBar/Model/ExtendControls.tsx +40 -0
- package/src/features/ChatInput/ActionBar/Model/index.tsx +132 -0
- package/src/features/ChatInput/ActionBar/Params/index.tsx +2 -2
- package/src/features/ChatInput/ActionBar/Search/ExaIcon.tsx +15 -0
- package/src/features/ChatInput/ActionBar/Search/ModelBuiltinSearch.tsx +68 -0
- package/src/features/ChatInput/ActionBar/Search/SwitchPanel.tsx +167 -0
- package/src/features/ChatInput/ActionBar/Search/index.tsx +74 -0
- package/src/features/ChatInput/ActionBar/config.ts +4 -2
- package/src/features/Conversation/Error/index.tsx +1 -6
- package/src/features/Conversation/Messages/Assistant/SearchGrounding.tsx +153 -0
- package/src/features/Conversation/Messages/Assistant/Tool/Inspector/Debug.tsx +9 -6
- package/src/features/Conversation/Messages/Assistant/Tool/Inspector/PluginResultJSON.tsx +14 -9
- package/src/features/Conversation/Messages/Assistant/Tool/Inspector/Settings.tsx +1 -0
- package/src/features/Conversation/Messages/Assistant/Tool/Inspector/index.tsx +2 -1
- package/src/features/Conversation/Messages/Assistant/Tool/Render/CustomRender.tsx +4 -2
- package/src/features/Conversation/Messages/Assistant/Tool/Render/ErrorResponse.tsx +36 -0
- package/src/features/Conversation/{Error → Messages/Assistant/Tool/Render}/PluginSettings.tsx +1 -1
- package/src/features/Conversation/Messages/Assistant/Tool/Render/index.tsx +7 -1
- package/src/features/Conversation/Messages/Assistant/index.tsx +7 -1
- package/src/features/ModelSelect/index.tsx +1 -1
- package/src/features/ModelSwitchPanel/index.tsx +2 -3
- package/src/hooks/useEnabledChatModels.ts +1 -1
- package/src/libs/agent-runtime/google/index.test.ts +142 -36
- package/src/libs/agent-runtime/google/index.ts +26 -51
- package/src/libs/agent-runtime/novita/__snapshots__/index.test.ts.snap +3 -3
- package/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap +3 -3
- package/src/libs/agent-runtime/openrouter/index.ts +20 -20
- package/src/libs/agent-runtime/perplexity/index.test.ts +2 -2
- package/src/libs/agent-runtime/qwen/index.ts +38 -55
- package/src/libs/agent-runtime/types/chat.ts +6 -2
- package/src/libs/agent-runtime/utils/streams/google-ai.ts +29 -4
- package/src/libs/agent-runtime/utils/streams/openai.ts +1 -1
- package/src/libs/agent-runtime/utils/streams/protocol.ts +1 -1
- package/src/locales/default/chat.ts +28 -0
- package/src/services/chat.ts +10 -0
- package/src/services/session/_deprecated.ts +2 -1
- package/src/store/agent/slices/chat/__snapshots__/selectors.test.ts.snap +1 -0
- package/src/store/agent/slices/chat/selectors.ts +6 -0
- package/src/store/aiInfra/slices/aiModel/selectors.ts +36 -0
- package/src/store/aiInfra/slices/aiProvider/initialState.ts +2 -2
- package/src/store/aiInfra/slices/aiProvider/selectors.ts +14 -0
- package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +15 -5
- package/src/store/chat/slices/message/action.ts +1 -1
- package/src/store/user/slices/modelList/selectors/modelProvider.ts +1 -1
- package/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap +1 -0
- package/src/types/agent/index.ts +4 -0
- package/src/types/aiModel.ts +35 -8
- package/src/types/aiProvider.ts +7 -10
- package/src/types/message/base.ts +2 -5
- package/src/types/message/chat.ts +5 -3
- package/src/types/openai/chat.ts +5 -0
- package/src/types/search.ts +29 -0
- package/src/utils/fetch/fetchSSE.ts +11 -11
- package/src/features/ChatInput/ActionBar/ModelSwitch.tsx +0 -20
@@ -6,11 +6,11 @@ import { ChatErrorType } from '@/types/fetch';
|
|
6
6
|
import { SmoothingParams } from '@/types/llm';
|
7
7
|
import {
|
8
8
|
ChatMessageError,
|
9
|
-
CitationItem,
|
10
9
|
MessageToolCall,
|
11
10
|
MessageToolCallChunk,
|
12
11
|
MessageToolCallSchema,
|
13
12
|
} from '@/types/message';
|
13
|
+
import { GroundingSearch } from '@/types/search';
|
14
14
|
|
15
15
|
import { fetchEventSource } from './fetchEventSource';
|
16
16
|
import { getMessageError } from './parseError';
|
@@ -21,7 +21,7 @@ type SSEFinishType = 'done' | 'error' | 'abort';
|
|
21
21
|
export type OnFinishHandler = (
|
22
22
|
text: string,
|
23
23
|
context: {
|
24
|
-
|
24
|
+
grounding?: GroundingSearch;
|
25
25
|
observationId?: string | null;
|
26
26
|
reasoning?: string;
|
27
27
|
toolCalls?: MessageToolCall[];
|
@@ -40,9 +40,9 @@ export interface MessageReasoningChunk {
|
|
40
40
|
type: 'reasoning';
|
41
41
|
}
|
42
42
|
|
43
|
-
export interface
|
44
|
-
|
45
|
-
type: '
|
43
|
+
export interface MessageGroundingChunk {
|
44
|
+
grounding: GroundingSearch;
|
45
|
+
type: 'grounding';
|
46
46
|
}
|
47
47
|
|
48
48
|
interface MessageToolCallsChunk {
|
@@ -57,7 +57,7 @@ export interface FetchSSEOptions {
|
|
57
57
|
onErrorHandle?: (error: ChatMessageError) => void;
|
58
58
|
onFinish?: OnFinishHandler;
|
59
59
|
onMessageHandle?: (
|
60
|
-
chunk: MessageTextChunk | MessageToolCallsChunk | MessageReasoningChunk |
|
60
|
+
chunk: MessageTextChunk | MessageToolCallsChunk | MessageReasoningChunk | MessageGroundingChunk,
|
61
61
|
) => void;
|
62
62
|
smoothing?: SmoothingParams | boolean;
|
63
63
|
}
|
@@ -286,7 +286,7 @@ export const fetchSSE = async (url: string, options: RequestInit & FetchSSEOptio
|
|
286
286
|
startSpeed: smoothingSpeed,
|
287
287
|
});
|
288
288
|
|
289
|
-
let
|
289
|
+
let grounding: GroundingSearch | undefined = undefined;
|
290
290
|
await fetchEventSource(url, {
|
291
291
|
body: options.body,
|
292
292
|
fetch: options?.fetcher,
|
@@ -359,9 +359,9 @@ export const fetchSSE = async (url: string, options: RequestInit & FetchSSEOptio
|
|
359
359
|
break;
|
360
360
|
}
|
361
361
|
|
362
|
-
case '
|
363
|
-
|
364
|
-
options.onMessageHandle?.({
|
362
|
+
case 'grounding': {
|
363
|
+
grounding = data;
|
364
|
+
options.onMessageHandle?.({ grounding: data, type: 'grounding' });
|
365
365
|
break;
|
366
366
|
}
|
367
367
|
|
@@ -434,7 +434,7 @@ export const fetchSSE = async (url: string, options: RequestInit & FetchSSEOptio
|
|
434
434
|
}
|
435
435
|
|
436
436
|
await options?.onFinish?.(output, {
|
437
|
-
|
437
|
+
grounding,
|
438
438
|
observationId,
|
439
439
|
reasoning: !!thinking ? thinking : undefined,
|
440
440
|
toolCalls,
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { ActionIcon } from '@lobehub/ui';
|
2
|
-
import { Brain } from 'lucide-react';
|
3
|
-
import { memo } from 'react';
|
4
|
-
import { useTranslation } from 'react-i18next';
|
5
|
-
|
6
|
-
import ModelSwitchPanel from '@/features/ModelSwitchPanel';
|
7
|
-
|
8
|
-
const ModelSwitch = memo(() => {
|
9
|
-
const { t } = useTranslation('chat');
|
10
|
-
|
11
|
-
return (
|
12
|
-
<ModelSwitchPanel>
|
13
|
-
<ActionIcon icon={Brain} placement={'bottom'} title={t('ModelSwitch.title')} />
|
14
|
-
</ModelSwitchPanel>
|
15
|
-
);
|
16
|
-
});
|
17
|
-
|
18
|
-
ModelSwitch.displayName = 'ModelSwitch';
|
19
|
-
|
20
|
-
export default ModelSwitch;
|