@lobehub/chat 0.149.0 → 0.149.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 (55) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/locales/ar/chat.json +4 -1
  3. package/locales/ar/modelProvider.json +1 -3
  4. package/locales/bg-BG/chat.json +4 -1
  5. package/locales/bg-BG/modelProvider.json +1 -3
  6. package/locales/de-DE/chat.json +4 -1
  7. package/locales/de-DE/modelProvider.json +1 -3
  8. package/locales/en-US/chat.json +7 -4
  9. package/locales/en-US/modelProvider.json +1 -3
  10. package/locales/es-ES/chat.json +4 -1
  11. package/locales/es-ES/modelProvider.json +1 -3
  12. package/locales/fr-FR/chat.json +7 -4
  13. package/locales/fr-FR/modelProvider.json +1 -3
  14. package/locales/it-IT/chat.json +4 -1
  15. package/locales/it-IT/modelProvider.json +16 -17
  16. package/locales/ja-JP/chat.json +4 -1
  17. package/locales/ja-JP/modelProvider.json +14 -16
  18. package/locales/ko-KR/chat.json +4 -1
  19. package/locales/ko-KR/modelProvider.json +1 -3
  20. package/locales/nl-NL/chat.json +4 -1
  21. package/locales/nl-NL/modelProvider.json +1 -3
  22. package/locales/pl-PL/chat.json +4 -1
  23. package/locales/pl-PL/modelProvider.json +1 -3
  24. package/locales/pt-BR/chat.json +4 -1
  25. package/locales/pt-BR/modelProvider.json +1 -3
  26. package/locales/ru-RU/chat.json +4 -1
  27. package/locales/ru-RU/modelProvider.json +1 -3
  28. package/locales/tr-TR/chat.json +4 -1
  29. package/locales/tr-TR/modelProvider.json +1 -3
  30. package/locales/vi-VN/chat.json +4 -1
  31. package/locales/vi-VN/modelProvider.json +1 -3
  32. package/locales/zh-CN/chat.json +4 -1
  33. package/locales/zh-CN/modelProvider.json +1 -3
  34. package/locales/zh-TW/chat.json +4 -1
  35. package/locales/zh-TW/modelProvider.json +1 -3
  36. package/package.json +1 -1
  37. package/src/app/chat/(desktop)/features/ChatInput/Footer/SendMore.tsx +117 -0
  38. package/src/app/chat/(desktop)/features/ChatInput/Footer/index.tsx +9 -56
  39. package/src/app/chat/(desktop)/features/ChatInput/TextArea.tsx +1 -1
  40. package/src/app/chat/(desktop)/features/HotKeys.tsx +3 -3
  41. package/src/app/chat/features/TopicListContent/Topic/TopicContent.tsx +15 -6
  42. package/src/components/HotKeys/index.tsx +14 -18
  43. package/src/const/hotkeys.ts +1 -1
  44. package/src/features/ChatInput/ActionBar/Clear.tsx +3 -3
  45. package/src/features/ChatInput/Topic/index.tsx +3 -3
  46. package/src/features/Conversation/Actions/Assistant.tsx +1 -1
  47. package/src/features/Conversation/Error/OllamaBizError/SetupGuide.tsx +159 -70
  48. package/src/locales/default/chat.ts +4 -1
  49. package/src/locales/default/modelProvider.ts +1 -3
  50. package/src/store/chat/slices/message/action.ts +15 -0
  51. package/src/store/chat/slices/topic/action.test.ts +8 -4
  52. package/src/store/chat/slices/topic/action.ts +70 -28
  53. package/src/store/chat/slices/topic/initialState.ts +2 -1
  54. package/src/store/chat/slices/topic/reducer.test.ts +3 -5
  55. package/src/store/chat/slices/topic/reducer.ts +9 -9
@@ -5,14 +5,13 @@ import { ChatTopic } from '@/types/topic';
5
5
 
6
6
  interface AddChatTopicAction {
7
7
  type: 'addTopic';
8
- value: CreateTopicParams;
8
+ value: CreateTopicParams & { id?: string };
9
9
  }
10
10
 
11
11
  interface UpdateChatTopicAction {
12
12
  id: string;
13
- key: keyof ChatTopic;
14
13
  type: 'updateTopic';
15
- value: any;
14
+ value: Partial<ChatTopic>;
16
15
  }
17
16
 
18
17
  interface DeleteChatTopicAction {
@@ -29,24 +28,25 @@ export const topicReducer = (state: ChatTopic[] = [], payload: ChatTopicDispatch
29
28
  draftState.unshift({
30
29
  ...payload.value,
31
30
  createdAt: Date.now(),
32
- id: Date.now().toString(),
31
+ favorite: false,
32
+ id: payload.value.id ?? Date.now().toString(),
33
33
  sessionId: payload.value.sessionId ? payload.value.sessionId : undefined,
34
34
  updatedAt: Date.now(),
35
35
  });
36
+
37
+ return draftState.sort((a, b) => Number(b.favorite) - Number(a.favorite));
36
38
  });
37
39
  }
38
40
 
39
41
  case 'updateTopic': {
40
42
  return produce(state, (draftState) => {
41
- const { key, value, id } = payload;
43
+ const { value, id } = payload;
42
44
  const topicIndex = draftState.findIndex((topic) => topic.id === id);
43
45
 
44
46
  if (topicIndex !== -1) {
45
- const updatedTopic = { ...draftState[topicIndex] };
47
+ // TODO: updatedAt 类型后续需要修改为 Date
46
48
  // @ts-ignore
47
- updatedTopic[key] = value;
48
- draftState[topicIndex] = updatedTopic;
49
- updatedTopic.updatedAt = Date.now();
49
+ draftState[topicIndex] = { ...draftState[topicIndex], ...value, updatedAt: new Date() };
50
50
  }
51
51
  });
52
52
  }