@lobehub/chat 1.79.10 → 1.80.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 +85 -0
- package/changelog/v1.json +27 -0
- package/docs/development/basic/feature-development.mdx +370 -619
- package/docs/development/basic/feature-development.zh-CN.mdx +368 -611
- package/docs/development/database-schema.dbml +2 -0
- package/locales/ar/setting.json +16 -0
- package/locales/bg-BG/setting.json +16 -0
- package/locales/de-DE/setting.json +16 -0
- package/locales/en-US/setting.json +16 -0
- package/locales/es-ES/setting.json +16 -0
- package/locales/fa-IR/setting.json +16 -0
- package/locales/fr-FR/setting.json +16 -0
- package/locales/it-IT/setting.json +16 -0
- package/locales/ja-JP/setting.json +16 -0
- package/locales/ko-KR/setting.json +16 -0
- package/locales/nl-NL/setting.json +16 -0
- package/locales/pl-PL/setting.json +16 -0
- package/locales/pt-BR/setting.json +16 -0
- package/locales/ru-RU/setting.json +16 -0
- package/locales/tr-TR/setting.json +16 -0
- package/locales/vi-VN/setting.json +16 -0
- package/locales/zh-CN/setting.json +16 -0
- package/locales/zh-TW/setting.json +16 -0
- package/package.json +1 -1
- package/scripts/generate-oidc-jwk.mjs +2 -1
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/OpeningQuestions.tsx +78 -0
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/WelcomeMessage.tsx +24 -4
- package/src/app/[variants]/(main)/chat/(workspace)/features/AgentSettings/CategoryContent/useCategory.tsx +6 -1
- package/src/app/[variants]/(main)/chat/(workspace)/features/AgentSettings/index.tsx +2 -0
- package/src/const/settings/agent.ts +1 -0
- package/src/database/_deprecated/schemas/session.ts +2 -0
- package/src/database/client/migrations.json +9 -0
- package/src/database/migrations/0021_add_agent_opening_settings.sql +2 -0
- package/src/database/migrations/meta/0021_snapshot.json +4988 -0
- package/src/database/migrations/meta/_journal.json +7 -0
- package/src/database/repositories/dataImporter/deprecated/__tests__/fixtures/messages.json +2 -0
- package/src/database/repositories/dataImporter/deprecated/__tests__/index.test.ts +19 -0
- package/src/database/schemas/agent.ts +3 -0
- package/src/features/AgentSetting/AgentOpening/OpeningMessage.tsx +80 -0
- package/src/features/AgentSetting/AgentOpening/OpeningQuestions.tsx +144 -0
- package/src/features/AgentSetting/AgentOpening/index.tsx +52 -0
- package/src/features/AgentSetting/store/selectors.ts +3 -0
- package/src/features/ChatInput/ActionBar/Upload/ClientMode.tsx +7 -6
- package/src/hooks/useModelSupportFiles.ts +15 -0
- package/src/libs/agent-runtime/stepfun/index.ts +7 -1
- package/src/libs/agent-runtime/zhipu/index.ts +17 -10
- package/src/locales/default/setting.ts +16 -0
- package/src/migrations/FromV5ToV6/types/v6.ts +2 -0
- package/src/server/routers/lambda/session.ts +8 -1
- package/src/services/import/client.test.ts +18 -0
- package/src/services/session/server.test.ts +2 -0
- package/src/store/agent/slices/chat/selectors/__snapshots__/agent.test.ts.snap +1 -0
- package/src/store/agent/slices/chat/selectors/agent.ts +7 -0
- package/src/store/aiInfra/slices/aiModel/selectors.ts +7 -0
- package/src/store/global/initialState.ts +1 -0
- package/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap +2 -0
- package/src/types/agent/index.ts +12 -0
@@ -102,6 +102,7 @@ describe('ImporterService', () => {
|
|
102
102
|
params: {},
|
103
103
|
systemRole: 'abc',
|
104
104
|
tts: {} as any,
|
105
|
+
openingQuestions: [],
|
105
106
|
},
|
106
107
|
meta: {
|
107
108
|
title: 'Session 1',
|
@@ -118,6 +119,7 @@ describe('ImporterService', () => {
|
|
118
119
|
params: {},
|
119
120
|
systemRole: 'abc',
|
120
121
|
tts: {} as any,
|
122
|
+
openingQuestions: [],
|
121
123
|
},
|
122
124
|
meta: {
|
123
125
|
title: 'Session 2',
|
@@ -169,6 +171,7 @@ describe('ImporterService', () => {
|
|
169
171
|
params: {},
|
170
172
|
systemRole: 'abc',
|
171
173
|
tts: {} as any,
|
174
|
+
openingQuestions: [],
|
172
175
|
},
|
173
176
|
meta: {
|
174
177
|
title: 'Session 1',
|
@@ -185,6 +188,7 @@ describe('ImporterService', () => {
|
|
185
188
|
params: {},
|
186
189
|
systemRole: 'abc',
|
187
190
|
tts: {} as any,
|
191
|
+
openingQuestions: [],
|
188
192
|
},
|
189
193
|
meta: {
|
190
194
|
title: 'Session 2',
|
@@ -225,6 +229,7 @@ describe('ImporterService', () => {
|
|
225
229
|
params: {},
|
226
230
|
systemRole: 'abc',
|
227
231
|
tts: {} as any,
|
232
|
+
openingQuestions: [],
|
228
233
|
},
|
229
234
|
meta: {
|
230
235
|
title: 'Session 1',
|
@@ -242,6 +247,7 @@ describe('ImporterService', () => {
|
|
242
247
|
params: {},
|
243
248
|
systemRole: 'abc',
|
244
249
|
tts: {} as any,
|
250
|
+
openingQuestions: [],
|
245
251
|
},
|
246
252
|
meta: {
|
247
253
|
title: 'Session 2',
|
@@ -259,6 +265,7 @@ describe('ImporterService', () => {
|
|
259
265
|
params: {},
|
260
266
|
systemRole: 'abc',
|
261
267
|
tts: {} as any,
|
268
|
+
openingQuestions: [],
|
262
269
|
},
|
263
270
|
meta: {
|
264
271
|
title: 'Session 3',
|
@@ -310,6 +317,7 @@ describe('ImporterService', () => {
|
|
310
317
|
params: {},
|
311
318
|
systemRole: 'Test Agent 1',
|
312
319
|
tts: {} as any,
|
320
|
+
openingQuestions: [],
|
313
321
|
},
|
314
322
|
meta: {
|
315
323
|
title: 'Session 1',
|
@@ -326,6 +334,7 @@ describe('ImporterService', () => {
|
|
326
334
|
params: {},
|
327
335
|
systemRole: 'Test Agent 2',
|
328
336
|
tts: {} as any,
|
337
|
+
openingQuestions: [],
|
329
338
|
},
|
330
339
|
meta: {
|
331
340
|
title: 'Session 2',
|
@@ -390,6 +399,7 @@ describe('ImporterService', () => {
|
|
390
399
|
params: {},
|
391
400
|
systemRole: 'Test Agent 1',
|
392
401
|
tts: {} as any,
|
402
|
+
openingQuestions: [],
|
393
403
|
},
|
394
404
|
meta: {
|
395
405
|
title: 'Session 1',
|
@@ -413,6 +423,7 @@ describe('ImporterService', () => {
|
|
413
423
|
params: {},
|
414
424
|
systemRole: 'Test Agent 1',
|
415
425
|
tts: {} as any,
|
426
|
+
openingQuestions: [],
|
416
427
|
},
|
417
428
|
meta: {
|
418
429
|
title: 'Session 1',
|
@@ -462,6 +473,7 @@ describe('ImporterService', () => {
|
|
462
473
|
params: {},
|
463
474
|
systemRole: 'abc',
|
464
475
|
tts: {} as any,
|
476
|
+
openingQuestions: [],
|
465
477
|
},
|
466
478
|
meta: {
|
467
479
|
title: 'Session 1',
|
@@ -478,6 +490,7 @@ describe('ImporterService', () => {
|
|
478
490
|
params: {},
|
479
491
|
systemRole: 'abc',
|
480
492
|
tts: {} as any,
|
493
|
+
openingQuestions: [],
|
481
494
|
},
|
482
495
|
meta: {
|
483
496
|
title: 'Session 2',
|
@@ -544,6 +557,7 @@ describe('ImporterService', () => {
|
|
544
557
|
params: {},
|
545
558
|
systemRole: 'abc',
|
546
559
|
tts: {} as any,
|
560
|
+
openingQuestions: [],
|
547
561
|
},
|
548
562
|
meta: {
|
549
563
|
title: 'Session 1',
|
@@ -619,6 +633,7 @@ describe('ImporterService', () => {
|
|
619
633
|
params: {},
|
620
634
|
systemRole: 'abc',
|
621
635
|
tts: {} as any,
|
636
|
+
openingQuestions: [],
|
622
637
|
},
|
623
638
|
meta: {
|
624
639
|
title: 'Session 1',
|
@@ -711,6 +726,7 @@ describe('ImporterService', () => {
|
|
711
726
|
params: {},
|
712
727
|
systemRole: 'abc',
|
713
728
|
tts: {} as any,
|
729
|
+
openingQuestions: [],
|
714
730
|
},
|
715
731
|
meta: {
|
716
732
|
title: 'Session 1',
|
@@ -923,6 +939,8 @@ describe('ImporterService', () => {
|
|
923
939
|
enableAutoCreateTopic: true,
|
924
940
|
historyCount: 1,
|
925
941
|
},
|
942
|
+
openingQuestions: ['Question 1', 'Question 2'],
|
943
|
+
openingMessage: 'Hello, I am [LobeChat](https://github.com/lobehub/lobe-chat).',
|
926
944
|
},
|
927
945
|
group: 'XlUbvOvL',
|
928
946
|
meta: {
|
@@ -78,6 +78,8 @@ describe('ServerService', () => {
|
|
78
78
|
openai: 'voice-id',
|
79
79
|
},
|
80
80
|
},
|
81
|
+
openingQuestions: ['Question 1', 'Question 2'],
|
82
|
+
openingMessage: 'Hello, I am [LobeChat](https://github.com/lobehub/lobe-chat).',
|
81
83
|
},
|
82
84
|
group: 'testGroup',
|
83
85
|
meta: { description: 'test' },
|
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
DEFAULT_PROVIDER,
|
8
8
|
DEFAUTT_AGENT_TTS_CONFIG,
|
9
9
|
} from '@/const/settings';
|
10
|
+
import { DEFAULT_OPENING_QUESTIONS } from '@/features/AgentSetting/store/selectors';
|
10
11
|
import { AgentStoreState } from '@/store/agent/initialState';
|
11
12
|
import { LobeAgentConfig, LobeAgentTTSConfig } from '@/types/agent';
|
12
13
|
import { KnowledgeItem, KnowledgeType } from '@/types/knowledgeBase';
|
@@ -138,6 +139,10 @@ const currentKnowledgeIds = (s: AgentStoreState) => {
|
|
138
139
|
|
139
140
|
const isAgentConfigLoading = (s: AgentStoreState) => !s.agentConfigInitMap[s.activeId];
|
140
141
|
|
142
|
+
const openingQuestions = (s: AgentStoreState) =>
|
143
|
+
currentAgentConfig(s).openingQuestions || DEFAULT_OPENING_QUESTIONS;
|
144
|
+
const openingMessage = (s: AgentStoreState) => currentAgentConfig(s).openingMessage || '';
|
145
|
+
|
141
146
|
export const agentSelectors = {
|
142
147
|
currentAgentConfig,
|
143
148
|
currentAgentFiles,
|
@@ -158,4 +163,6 @@ export const agentSelectors = {
|
|
158
163
|
inboxAgentModel,
|
159
164
|
isAgentConfigLoading,
|
160
165
|
isInboxSession,
|
166
|
+
openingMessage,
|
167
|
+
openingQuestions,
|
161
168
|
};
|
@@ -49,6 +49,12 @@ const isModelSupportToolUse = (id: string, provider: string) => (s: AIProviderSt
|
|
49
49
|
return model?.abilities?.functionCall;
|
50
50
|
};
|
51
51
|
|
52
|
+
const isModelSupportFiles = (id: string, provider: string) => (s: AIProviderStoreState) => {
|
53
|
+
const model = getEnabledModelById(id, provider)(s);
|
54
|
+
|
55
|
+
return model?.abilities?.files;
|
56
|
+
};
|
57
|
+
|
52
58
|
const isModelSupportVision = (id: string, provider: string) => (s: AIProviderStoreState) => {
|
53
59
|
const model = getEnabledModelById(id, provider)(s);
|
54
60
|
|
@@ -126,6 +132,7 @@ export const aiModelSelectors = {
|
|
126
132
|
isModelHasContextWindowToken,
|
127
133
|
isModelHasExtendParams,
|
128
134
|
isModelLoading,
|
135
|
+
isModelSupportFiles,
|
129
136
|
isModelSupportReasoning,
|
130
137
|
isModelSupportToolUse,
|
131
138
|
isModelSupportVision,
|
@@ -117,6 +117,7 @@ exports[`settingsSelectors > defaultAgent > should merge DEFAULT_AGENT and s.set
|
|
117
117
|
"searchMode": "off",
|
118
118
|
},
|
119
119
|
"model": "gpt-3.5-turbo",
|
120
|
+
"openingQuestions": [],
|
120
121
|
"params": {
|
121
122
|
"frequency_penalty": 0,
|
122
123
|
"presence_penalty": 0,
|
@@ -160,6 +161,7 @@ exports[`settingsSelectors > defaultAgentConfig > should merge DEFAULT_AGENT_CON
|
|
160
161
|
"searchMode": "off",
|
161
162
|
},
|
162
163
|
"model": "gpt-4",
|
164
|
+
"openingQuestions": [],
|
163
165
|
"params": {
|
164
166
|
"frequency_penalty": 0,
|
165
167
|
"presence_penalty": 0,
|
package/src/types/agent/index.ts
CHANGED
@@ -31,6 +31,16 @@ export interface LobeAgentConfig {
|
|
31
31
|
* @default gpt-4o-mini
|
32
32
|
*/
|
33
33
|
model: string;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* 开场白
|
37
|
+
*/
|
38
|
+
openingMessage?: string;
|
39
|
+
/**
|
40
|
+
* 开场问题
|
41
|
+
*/
|
42
|
+
openingQuestions?: string[];
|
43
|
+
|
34
44
|
/**
|
35
45
|
* 语言模型参数
|
36
46
|
*/
|
@@ -39,10 +49,12 @@ export interface LobeAgentConfig {
|
|
39
49
|
* 启用的插件
|
40
50
|
*/
|
41
51
|
plugins?: string[];
|
52
|
+
|
42
53
|
/**
|
43
54
|
* 模型供应商
|
44
55
|
*/
|
45
56
|
provider?: string;
|
57
|
+
|
46
58
|
/**
|
47
59
|
* 系统角色
|
48
60
|
*/
|