@lobehub/chat 1.4.0 → 1.4.2

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/docs/self-hosting/advanced/model-list.mdx +1 -1
  3. package/docs/self-hosting/advanced/model-list.zh-CN.mdx +1 -1
  4. package/locales/ar/chat.json +2 -0
  5. package/locales/ar/common.json +9 -0
  6. package/locales/bg-BG/chat.json +2 -0
  7. package/locales/bg-BG/common.json +9 -0
  8. package/locales/de-DE/chat.json +2 -0
  9. package/locales/de-DE/common.json +9 -0
  10. package/locales/en-US/chat.json +2 -0
  11. package/locales/en-US/common.json +11 -2
  12. package/locales/es-ES/chat.json +2 -0
  13. package/locales/es-ES/common.json +9 -0
  14. package/locales/fr-FR/chat.json +2 -0
  15. package/locales/fr-FR/common.json +9 -0
  16. package/locales/it-IT/chat.json +2 -0
  17. package/locales/it-IT/common.json +9 -0
  18. package/locales/ja-JP/chat.json +2 -0
  19. package/locales/ja-JP/common.json +9 -0
  20. package/locales/ko-KR/chat.json +2 -0
  21. package/locales/ko-KR/common.json +9 -0
  22. package/locales/nl-NL/chat.json +2 -0
  23. package/locales/nl-NL/common.json +9 -0
  24. package/locales/pl-PL/chat.json +2 -0
  25. package/locales/pl-PL/common.json +9 -0
  26. package/locales/pt-BR/chat.json +2 -0
  27. package/locales/pt-BR/common.json +9 -0
  28. package/locales/ru-RU/chat.json +2 -0
  29. package/locales/ru-RU/common.json +9 -0
  30. package/locales/tr-TR/chat.json +2 -0
  31. package/locales/tr-TR/common.json +9 -0
  32. package/locales/vi-VN/chat.json +2 -0
  33. package/locales/vi-VN/common.json +9 -0
  34. package/locales/vi-VN/setting.json +6 -10
  35. package/locales/zh-CN/chat.json +2 -0
  36. package/locales/zh-CN/common.json +9 -0
  37. package/locales/zh-TW/chat.json +2 -0
  38. package/locales/zh-TW/common.json +9 -0
  39. package/next-sitemap.config.mjs +2 -2
  40. package/package.json +2 -1
  41. package/src/app/(main)/_layout/Desktop.tsx +19 -12
  42. package/src/app/(main)/_layout/Mobile.tsx +5 -0
  43. package/src/app/(main)/chat/(workspace)/@topic/features/TopicListContent/TopicContent.tsx +4 -1
  44. package/src/config/featureFlags/schema.ts +6 -0
  45. package/src/const/guide.ts +8 -4
  46. package/src/const/url.ts +2 -1
  47. package/src/features/AlertBanner/CloudBanner.tsx +91 -0
  48. package/src/features/ChatInput/ActionBar/Clear.tsx +15 -6
  49. package/src/features/ChatInput/Topic/index.tsx +44 -9
  50. package/src/features/User/UserPanel/useMenu.tsx +21 -2
  51. package/src/libs/agent-runtime/google/index.test.ts +3 -33
  52. package/src/libs/agent-runtime/google/index.ts +1 -16
  53. package/src/locales/default/chat.ts +2 -0
  54. package/src/locales/default/common.ts +10 -0
  55. package/src/store/serverConfig/selectors.test.ts +1 -0
  56. package/src/types/user/index.ts +3 -1
  57. package/src/utils/parseModels.test.ts +3 -3
@@ -50,7 +50,7 @@ export class LobeGoogleAI implements LobeRuntimeAI {
50
50
 
51
51
  async chat(payload: ChatStreamPayload, options?: ChatCompetitionOptions) {
52
52
  try {
53
- const model = this.convertModel(payload.model, payload.messages);
53
+ const model = payload.model;
54
54
 
55
55
  const contents = this.buildGoogleMessages(payload.messages, model);
56
56
 
@@ -197,21 +197,6 @@ export class LobeGoogleAI implements LobeRuntimeAI {
197
197
  return contents;
198
198
  };
199
199
 
200
- private convertModel = (model: string, messages: OpenAIChatMessage[]) => {
201
- let finalModel: string = model;
202
-
203
- if (model.includes('pro-vision')) {
204
- // if message are all text message, use vision will return an error:
205
- // "[400 Bad Request] Add an image to use models/gemini-pro-vision, or switch your model to a text model."
206
- const noNeedVision = messages.every((m) => typeof m.content === 'string');
207
-
208
- // so we need to downgrade to gemini-pro
209
- if (noNeedVision) finalModel = 'gemini-pro';
210
- }
211
-
212
- return finalModel;
213
- };
214
-
215
200
  private parseErrorMessage(message: string): {
216
201
  error: any;
217
202
  errorType: ILobeAgentRuntimeErrorType;
@@ -100,6 +100,8 @@ export default {
100
100
  duplicate: '创建副本',
101
101
  export: '导出话题',
102
102
  },
103
+ checkOpenNewTopic: '是否开启新话题?',
104
+ checkSaveCurrentMessages: '是否保存当前会话为话题?',
103
105
  confirmRemoveAll: '即将删除全部话题,删除后将不可恢复,请谨慎操作。',
104
106
  confirmRemoveTopic: '即将删除该话题,删除后将不可恢复,请谨慎操作。',
105
107
  confirmRemoveUnstarred: '即将删除未收藏话题,删除后将不可恢复,请谨慎操作。',
@@ -1,6 +1,15 @@
1
1
  export default {
2
2
  about: '关于',
3
3
  advanceSettings: '高级设置',
4
+ alert: {
5
+ cloud: {
6
+ action: '立即体验',
7
+ desc: '我们为所有注册用户提供了免费的 {{credit}} 额度计算积分,无需复杂配置开箱即用, 支持全局云同步与进阶联网查询,更多高级特性等你探索。',
8
+ descOnMobile:
9
+ '我们为所有注册用户提供了免费的 {{credit}} 额度计算积分,无需复杂配置开箱即用。',
10
+ title: '{{name}} 开始公测',
11
+ },
12
+ },
4
13
  appInitializing: '应用启动中,请耐心等待...',
5
14
  autoGenerate: '自动补全',
6
15
  autoGenerateTooltip: '基于提示词自动补全助手描述',
@@ -198,6 +207,7 @@ export default {
198
207
  userPanel: {
199
208
  anonymousNickName: '匿名用户',
200
209
  billing: '账单管理',
210
+ cloud: '体验 {{name}}',
201
211
  data: '数据存储',
202
212
  defaultNickname: '社区版用户',
203
213
  discord: '社区支持',
@@ -22,6 +22,7 @@ describe('featureFlagsSelectors', () => {
22
22
  showCreateSession: true,
23
23
  showDalle: true,
24
24
  showLLM: false,
25
+ showCloudPromotion: false,
25
26
  showOpenAIApiKey: true,
26
27
  showOpenAIProxyUrl: true,
27
28
  enableCheckUpdates: true,
@@ -18,7 +18,9 @@ export interface UserGuide {
18
18
  */
19
19
  moveSettingsToAvatar?: boolean;
20
20
 
21
- // Topic 引导
21
+ /**
22
+ * Topic Guide
23
+ */
22
24
  topic?: boolean;
23
25
  }
24
26
 
@@ -49,14 +49,14 @@ describe('parseModelString', () => {
49
49
 
50
50
  it('multi models', () => {
51
51
  const result = parseModelString(
52
- 'gemini-pro-vision=Gemini Pro Vision<16000:vision>,gpt-4-all=ChatGPT Plus<128000:fc:vision:file>',
52
+ 'gemini-1.5-flash-latest=Gemini 1.5 Flash<16000:vision>,gpt-4-all=ChatGPT Plus<128000:fc:vision:file>',
53
53
  );
54
54
 
55
55
  expect(result.add).toEqual([
56
56
  {
57
- displayName: 'Gemini Pro Vision',
57
+ displayName: 'Gemini 1.5 Flash',
58
58
  vision: true,
59
- id: 'gemini-pro-vision',
59
+ id: 'gemini-1.5-flash-latest',
60
60
  tokens: 16000,
61
61
  },
62
62
  {