@lobehub/lobehub 2.0.0-next.13 → 2.0.0-next.14

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 (210) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/changelog/v1.json +9 -0
  3. package/package.json +1 -1
  4. package/packages/const/src/version.ts +3 -3
  5. package/packages/database/src/repositories/dataImporter/deprecated/__tests__/index.test.ts +2 -1
  6. package/packages/database/src/repositories/dataImporter/deprecated/index.ts +7 -1
  7. package/src/app/[variants]/(main)/(mobile)/me/(home)/__tests__/useCategory.test.tsx +9 -0
  8. package/src/app/[variants]/(main)/(mobile)/me/(home)/layout.tsx +0 -2
  9. package/src/app/[variants]/(main)/chat/@session/features/SessionListContent/List/Item/Actions.tsx +3 -28
  10. package/src/app/[variants]/(main)/chat/_layout/Desktop/index.tsx +0 -2
  11. package/src/app/[variants]/(main)/chat/_layout/Mobile.tsx +1 -5
  12. package/src/app/[variants]/(main)/chat/settings/features/HeaderContent.tsx +2 -62
  13. package/src/app/[variants]/(main)/image/page.tsx +0 -2
  14. package/src/app/[variants]/(main)/profile/_layout/Desktop/index.tsx +23 -24
  15. package/src/app/[variants]/(main)/profile/_layout/Mobile/index.tsx +5 -9
  16. package/src/app/[variants]/(main)/settings/_layout/Desktop/index.tsx +0 -2
  17. package/src/app/[variants]/(main)/settings/_layout/Mobile/index.tsx +0 -2
  18. package/src/app/[variants]/(main)/settings/provider/(list)/ProviderGrid/Card.tsx +1 -1
  19. package/src/app/[variants]/loading/index.tsx +1 -10
  20. package/src/components/Link.tsx +12 -0
  21. package/src/envs/app.ts +5 -8
  22. package/src/features/DataImporter/index.tsx +15 -60
  23. package/src/features/DevPanel/PostgresViewer/usePgTable.ts +3 -2
  24. package/src/hooks/useInterceptingRoutes.test.ts +21 -3
  25. package/src/libs/trpc/client/index.ts +0 -1
  26. package/src/libs/trpc/client/lambda.ts +8 -5
  27. package/src/server/routers/desktop/mcp.ts +1 -3
  28. package/src/server/routers/lambda/config/index.test.ts +2 -2
  29. package/src/server/routers/tools/mcp.ts +2 -3
  30. package/src/server/routers/tools/search.test.ts +1 -7
  31. package/src/server/routers/tools/search.ts +1 -4
  32. package/src/services/__tests__/tool.test.ts +0 -3
  33. package/src/services/aiModel/index.test.ts +0 -3
  34. package/src/services/aiModel/index.ts +1 -7
  35. package/src/services/aiProvider/index.test.ts +0 -3
  36. package/src/services/aiProvider/index.ts +1 -7
  37. package/src/services/chatGroup/index.ts +1 -10
  38. package/src/services/config.ts +1 -65
  39. package/src/services/export/index.ts +1 -4
  40. package/src/services/file/index.ts +1 -11
  41. package/src/services/import/index.ts +1 -7
  42. package/src/services/message/index.ts +1 -11
  43. package/src/services/plugin/index.ts +1 -11
  44. package/src/services/session/index.ts +1 -11
  45. package/src/services/tableViewer/client.ts +12 -15
  46. package/src/services/thread/index.ts +1 -7
  47. package/src/services/topic/index.ts +1 -11
  48. package/src/services/user/index.ts +1 -13
  49. package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChat.test.ts +0 -241
  50. package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChatV2.test.ts +26 -1
  51. package/src/store/chat/slices/aiChat/actions/__tests__/helpers.ts +3 -1
  52. package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +1 -138
  53. package/src/store/user/slices/common/action.test.ts +1 -4
  54. package/src/app/(backend)/trpc/edge/[trpc]/route.ts +0 -26
  55. package/src/app/[variants]/(main)/(mobile)/me/data/features/Category.tsx +0 -48
  56. package/src/app/[variants]/(main)/(mobile)/me/data/features/Header.tsx +0 -33
  57. package/src/app/[variants]/(main)/(mobile)/me/data/layout.tsx +0 -13
  58. package/src/app/[variants]/(main)/(mobile)/me/data/loading.tsx +0 -5
  59. package/src/app/[variants]/(main)/(mobile)/me/data/page.tsx +0 -29
  60. package/src/app/[variants]/(main)/chat/features/Migration/DBReader.ts +0 -290
  61. package/src/app/[variants]/(main)/chat/features/Migration/ExportConfigButton.tsx +0 -35
  62. package/src/app/[variants]/(main)/chat/features/Migration/Failed.tsx +0 -120
  63. package/src/app/[variants]/(main)/chat/features/Migration/Modal.tsx +0 -81
  64. package/src/app/[variants]/(main)/chat/features/Migration/Start.tsx +0 -108
  65. package/src/app/[variants]/(main)/chat/features/Migration/UpgradeButton.tsx +0 -71
  66. package/src/app/[variants]/(main)/chat/features/Migration/const.ts +0 -15
  67. package/src/app/[variants]/(main)/chat/features/Migration/index.tsx +0 -50
  68. package/src/app/[variants]/loading/Client/Content.tsx +0 -48
  69. package/src/app/[variants]/loading/Client/Error.tsx +0 -27
  70. package/src/app/[variants]/loading/Client/Redirect.tsx +0 -47
  71. package/src/app/[variants]/loading/Client/index.tsx +0 -22
  72. package/src/components/InnerLink.tsx +0 -20
  73. package/src/database/_deprecated/core/__tests__/db-upgrade.test.ts +0 -42
  74. package/src/database/_deprecated/core/__tests__/db.test.ts +0 -79
  75. package/src/database/_deprecated/core/__tests__/model.test.ts +0 -55
  76. package/src/database/_deprecated/core/db.ts +0 -246
  77. package/src/database/_deprecated/core/index.ts +0 -2
  78. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/input.json +0 -55
  79. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/output.json +0 -60
  80. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/index.test.ts +0 -14
  81. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/index.ts +0 -22
  82. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/type.ts +0 -105
  83. package/src/database/_deprecated/core/model.ts +0 -218
  84. package/src/database/_deprecated/core/schemas.ts +0 -88
  85. package/src/database/_deprecated/core/types/db.ts +0 -15
  86. package/src/database/_deprecated/models/__DEBUG.ts +0 -124
  87. package/src/database/_deprecated/models/__tests__/file.test.ts +0 -83
  88. package/src/database/_deprecated/models/__tests__/message.test.ts +0 -426
  89. package/src/database/_deprecated/models/__tests__/plugin.test.ts +0 -81
  90. package/src/database/_deprecated/models/__tests__/session.test.ts +0 -253
  91. package/src/database/_deprecated/models/__tests__/sessionGroup.test.ts +0 -220
  92. package/src/database/_deprecated/models/__tests__/topic.test.ts +0 -523
  93. package/src/database/_deprecated/models/__tests__/user.test.ts +0 -82
  94. package/src/database/_deprecated/models/file.ts +0 -51
  95. package/src/database/_deprecated/models/message.ts +0 -277
  96. package/src/database/_deprecated/models/plugin.ts +0 -62
  97. package/src/database/_deprecated/models/session.ts +0 -271
  98. package/src/database/_deprecated/models/sessionGroup.ts +0 -93
  99. package/src/database/_deprecated/models/topic.ts +0 -250
  100. package/src/database/_deprecated/models/user.ts +0 -69
  101. package/src/database/_deprecated/schemas/files.ts +0 -39
  102. package/src/database/_deprecated/schemas/message.ts +0 -50
  103. package/src/database/_deprecated/schemas/plugin.ts +0 -12
  104. package/src/database/_deprecated/schemas/session.ts +0 -54
  105. package/src/database/_deprecated/schemas/sessionGroup.ts +0 -8
  106. package/src/database/_deprecated/schemas/topic.ts +0 -12
  107. package/src/database/_deprecated/schemas/user.ts +0 -40
  108. package/src/features/DataImporter/_deprecated.ts +0 -43
  109. package/src/features/InitClientDB/EnableModal.tsx +0 -118
  110. package/src/features/InitClientDB/ErrorResult.tsx +0 -143
  111. package/src/features/InitClientDB/InitIndicator.tsx +0 -124
  112. package/src/features/InitClientDB/PGliteIcon.tsx +0 -28
  113. package/src/features/InitClientDB/features/DatabaseRepair/Backup.tsx +0 -75
  114. package/src/features/InitClientDB/features/DatabaseRepair/Diagnosis.tsx +0 -98
  115. package/src/features/InitClientDB/features/DatabaseRepair/Repair.tsx +0 -218
  116. package/src/features/InitClientDB/features/DatabaseRepair/index.tsx +0 -91
  117. package/src/features/InitClientDB/index.tsx +0 -37
  118. package/src/libs/trpc/client/edge.ts +0 -26
  119. package/src/libs/trpc/edge/context.ts +0 -71
  120. package/src/libs/trpc/edge/index.ts +0 -45
  121. package/src/libs/trpc/edge/init.ts +0 -26
  122. package/src/libs/trpc/edge/middleware/jwtPayload.test.ts +0 -75
  123. package/src/libs/trpc/edge/middleware/jwtPayload.ts +0 -14
  124. package/src/migrations/FromV0ToV1.ts +0 -10
  125. package/src/migrations/FromV1ToV2/fixtures/input-v1-session.json +0 -191
  126. package/src/migrations/FromV1ToV2/fixtures/output-v2.json +0 -202
  127. package/src/migrations/FromV1ToV2/index.ts +0 -82
  128. package/src/migrations/FromV1ToV2/migrations.test.ts +0 -224
  129. package/src/migrations/FromV1ToV2/types/v1.ts +0 -78
  130. package/src/migrations/FromV1ToV2/types/v2.ts +0 -52
  131. package/src/migrations/FromV2ToV3/fixtures/input-v2-session.json +0 -72
  132. package/src/migrations/FromV2ToV3/fixtures/output-v3-from-v1.json +0 -203
  133. package/src/migrations/FromV2ToV3/fixtures/output-v3.json +0 -74
  134. package/src/migrations/FromV2ToV3/index.ts +0 -30
  135. package/src/migrations/FromV2ToV3/migrations.test.ts +0 -42
  136. package/src/migrations/FromV2ToV3/types/v3.ts +0 -27
  137. package/src/migrations/FromV3ToV4/fixtures/azure-input-v3.json +0 -79
  138. package/src/migrations/FromV3ToV4/fixtures/azure-output-v4.json +0 -75
  139. package/src/migrations/FromV3ToV4/fixtures/ollama-input-v3.json +0 -85
  140. package/src/migrations/FromV3ToV4/fixtures/ollama-output-v4.json +0 -86
  141. package/src/migrations/FromV3ToV4/fixtures/openai-input-v3.json +0 -77
  142. package/src/migrations/FromV3ToV4/fixtures/openai-output-v4.json +0 -77
  143. package/src/migrations/FromV3ToV4/fixtures/openrouter-input-v3.json +0 -82
  144. package/src/migrations/FromV3ToV4/fixtures/openrouter-output-v4.json +0 -85
  145. package/src/migrations/FromV3ToV4/fixtures/output-v4-from-v1.json +0 -203
  146. package/src/migrations/FromV3ToV4/index.ts +0 -102
  147. package/src/migrations/FromV3ToV4/migrations.test.ts +0 -195
  148. package/src/migrations/FromV3ToV4/types/v3.ts +0 -52
  149. package/src/migrations/FromV3ToV4/types/v4.ts +0 -37
  150. package/src/migrations/FromV4ToV5/fixtures/from-v1-to-v5-output.json +0 -245
  151. package/src/migrations/FromV4ToV5/fixtures/function-input-v4.json +0 -96
  152. package/src/migrations/FromV4ToV5/fixtures/function-output-v5.json +0 -120
  153. package/src/migrations/FromV4ToV5/index.ts +0 -58
  154. package/src/migrations/FromV4ToV5/migrations.test.ts +0 -49
  155. package/src/migrations/FromV4ToV5/types/v4.ts +0 -21
  156. package/src/migrations/FromV4ToV5/types/v5.ts +0 -27
  157. package/src/migrations/FromV5ToV6/fixtures/from-v1-to-v6-output.json +0 -247
  158. package/src/migrations/FromV5ToV6/fixtures/session-input-v5.json +0 -81
  159. package/src/migrations/FromV5ToV6/fixtures/session-output-v6.json +0 -85
  160. package/src/migrations/FromV5ToV6/index.ts +0 -61
  161. package/src/migrations/FromV5ToV6/migrations.test.ts +0 -50
  162. package/src/migrations/FromV5ToV6/types/v5.ts +0 -48
  163. package/src/migrations/FromV5ToV6/types/v6.ts +0 -63
  164. package/src/migrations/FromV6ToV7/fixtures/output-v7-from-v1.json +0 -203
  165. package/src/migrations/FromV6ToV7/fixtures/provider-input-v6.json +0 -103
  166. package/src/migrations/FromV6ToV7/fixtures/provider-output-v7.json +0 -118
  167. package/src/migrations/FromV6ToV7/index.ts +0 -101
  168. package/src/migrations/FromV6ToV7/migrations.test.ts +0 -64
  169. package/src/migrations/FromV6ToV7/types/v6.ts +0 -61
  170. package/src/migrations/FromV6ToV7/types/v7.ts +0 -69
  171. package/src/migrations/VersionController.test.ts +0 -88
  172. package/src/migrations/VersionController.ts +0 -67
  173. package/src/migrations/index.ts +0 -61
  174. package/src/server/routers/edge/appStatus.ts +0 -3
  175. package/src/server/routers/edge/index.ts +0 -14
  176. package/src/server/routers/edge/upload.ts +0 -16
  177. package/src/services/aiModel/client.ts +0 -70
  178. package/src/services/aiProvider/client.ts +0 -58
  179. package/src/services/baseClientService/index.ts +0 -9
  180. package/src/services/chatGroup/client.ts +0 -63
  181. package/src/services/export/_deprecated.ts +0 -155
  182. package/src/services/export/client.ts +0 -15
  183. package/src/services/file/_deprecated.test.ts +0 -119
  184. package/src/services/file/_deprecated.ts +0 -80
  185. package/src/services/file/client.test.ts +0 -199
  186. package/src/services/file/client.ts +0 -85
  187. package/src/services/import/_deprecated.ts +0 -115
  188. package/src/services/import/client.test.ts +0 -1015
  189. package/src/services/import/client.ts +0 -64
  190. package/src/services/message/_deprecated.test.ts +0 -398
  191. package/src/services/message/_deprecated.ts +0 -168
  192. package/src/services/message/client.test.ts +0 -410
  193. package/src/services/message/client.ts +0 -192
  194. package/src/services/plugin/_deprecated.test.ts +0 -162
  195. package/src/services/plugin/_deprecated.ts +0 -42
  196. package/src/services/plugin/client.test.ts +0 -177
  197. package/src/services/plugin/client.ts +0 -46
  198. package/src/services/session/_deprecated.test.ts +0 -440
  199. package/src/services/session/_deprecated.ts +0 -190
  200. package/src/services/session/client.test.ts +0 -413
  201. package/src/services/session/client.ts +0 -193
  202. package/src/services/thread/client.ts +0 -51
  203. package/src/services/topic/_deprecated.test.ts +0 -245
  204. package/src/services/topic/_deprecated.ts +0 -75
  205. package/src/services/topic/client.ts +0 -89
  206. package/src/services/topic/pglite.test.ts +0 -212
  207. package/src/services/user/_deprecated.test.ts +0 -101
  208. package/src/services/user/_deprecated.ts +0 -70
  209. package/src/services/user/client.test.ts +0 -111
  210. package/src/services/user/client.ts +0 -104
@@ -1,52 +0,0 @@
1
- interface V3GeneralConfig {
2
- apiKey?: string;
3
- enabled: boolean;
4
- endpoint?: string;
5
- }
6
-
7
- export interface V3OpenAIConfig {
8
- OPENAI_API_KEY: string;
9
- azureApiVersion?: string;
10
- customModelName?: string;
11
- enabled: boolean;
12
- endpoint?: string;
13
- useAzure?: boolean;
14
- }
15
-
16
- export interface V3LegacyConfig {
17
- apiKey?: string;
18
- customModelName?: string;
19
- enabled?: boolean;
20
- enabledModels: string[];
21
- endpoint?: string;
22
- }
23
-
24
- export interface V3LLMConfig {
25
- bedrock: any;
26
- google: V3GeneralConfig;
27
- ollama: V3LegacyConfig;
28
- openAI: V3OpenAIConfig;
29
- openrouter: V3LegacyConfig;
30
- togetherai: V3LegacyConfig;
31
- }
32
-
33
- /**
34
- * 配置设置
35
- */
36
- export interface V3Settings {
37
- defaultAgent: any;
38
- fontSize: number;
39
- language: string;
40
- languageModel?: Partial<V3LLMConfig>;
41
- neutralColor?: string;
42
- password: string;
43
- primaryColor?: string;
44
- sync: any;
45
- themeMode: string;
46
- tool: any;
47
- tts: any;
48
- }
49
-
50
- export interface V3ConfigState {
51
- settings?: V3Settings;
52
- }
@@ -1,37 +0,0 @@
1
- import { ChatModelCard } from '@/types/llm';
2
-
3
- import { V3LLMConfig, V3Settings } from './v3';
4
-
5
- export interface V4ProviderConfig {
6
- apiKey?: string;
7
- customModelCards?: ChatModelCard[];
8
- enabled?: boolean;
9
- /**
10
- * enabled models id
11
- */
12
- enabledModels?: string[] | null;
13
- endpoint?: string;
14
- }
15
- export interface V4AzureOpenAIConfig extends V4ProviderConfig {
16
- apiVersion?: string;
17
- }
18
-
19
- export interface V4lLLMConfig
20
- extends Omit<Partial<V3LLMConfig>, 'ollama' | 'openAI' | 'openrouter' | 'togetherai'> {
21
- azure?: V4AzureOpenAIConfig;
22
- ollama?: V4ProviderConfig;
23
- openai: V4ProviderConfig;
24
- openrouter?: V4ProviderConfig;
25
- togetherai?: V4ProviderConfig;
26
- }
27
-
28
- /**
29
- * 配置设置
30
- */
31
- export interface V4Settings extends Omit<V3Settings, 'languageModel'> {
32
- languageModel?: V4lLLMConfig;
33
- }
34
-
35
- export interface V4ConfigState {
36
- settings?: V4Settings;
37
- }
@@ -1,245 +0,0 @@
1
- {
2
- "exportType": "sessions",
3
- "state": {
4
- "sessions": [
5
- {
6
- "config": {
7
- "displayMode": "chat",
8
- "historyCount": 1,
9
- "model": "gpt-3.5-turbo",
10
- "params": {
11
- "frequency_penalty": 0,
12
- "presence_penalty": 0,
13
- "temperature": 0.6,
14
- "top_p": 1,
15
- "max_tokens": 2200
16
- },
17
- "plugins": [],
18
- "systemRole": "你是一名 Postgresql 的数据库专家。用户是一名数据库小白,你需要使用简单直白的方式告诉用户如何使用 ostgresql 和它相应的 orm 工具 primsa",
19
- "enableCompressThreshold": false,
20
- "enableMaxTokens": false,
21
- "inputTemplate": ""
22
- },
23
- "id": "06cc3e20-e870-4099-a619-c07a849d742d",
24
- "meta": {
25
- "avatar": "🐘",
26
- "backgroundColor": "rgba(0,0,0,0)",
27
- "title": "Postgresql 指南",
28
- "description": "PostgreSQL 数据库和 Prisma ORM 工具的简单使用指南",
29
- "tags": ["数据库", "PostgreSQL", "教程", "ORM", "Prisma"]
30
- },
31
- "type": "agent",
32
- "createdAt": 1698463356269,
33
- "group": "default",
34
- "updatedAt": 1698463356269,
35
- "pinned": true
36
- }
37
- ],
38
- "messages": [
39
- {
40
- "content": "是的,你可以使用 Prisma 来自定义生成 `id` 的逻辑,例如使用 `nanoid` 库来生成唯一标识符。\n\n首先,你需要在项目中安装 `nanoid` 库:\n\n```\nnpm install nanoid\n```\n\n然后,你可以在 Prisma 的模型定义中使用 `@default` 指令,并提供一个自定义的默认值函数来生成 `id`。\n\n```prisma\nmodel Message {\n id String @id @default(dbgenerated(\"nanoid(10)\"))\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n```\n\n在上述模型定义中,我们使用 `dbgenerated` 指令来定义一个自定义的默认值函数。函数 `nanoid(10)` 会生成一个长度为 10 的唯一标识符。\n\n请注意,使用自定义的 `id` 生成逻辑可能会对数据库性能产生一些影响,因为每次创建新记录时都需要执行自定义函数。因此,请确保你的自定义逻辑是高效的,并在实际使用中进行测试和评估性能。",
41
- "id": "n2Tsl3Dm",
42
- "meta": {},
43
- "parentId": "JSZaJOGj",
44
- "role": "assistant",
45
- "topicId": "CZg3IEdy",
46
- "createdAt": 1698463981313,
47
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
48
- "updatedAt": 1698464004494,
49
- "fromModel": "gpt-3.5-turbo"
50
- },
51
- {
52
- "content": "如何指定 自定义函数的引入位置?",
53
- "id": "xPft8Msa",
54
- "meta": {},
55
- "role": "user",
56
- "topicId": "CZg3IEdy",
57
- "createdAt": 1698464173224,
58
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
59
- "updatedAt": 1698464173226
60
- },
61
- {
62
- "content": "在 Prisma 中,你可以通过在 `schema.prisma` 文件的顶部使用 `generator` 块来指定自定义函数的引入位置。\n\n例如,假设你想使用 `nanoid` 库来生成自定义的 `id`,你可以按照以下方式配置:\n\n```prisma\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./node_modules/@prisma/client\"\n}\n\ngenerator dbgenerated {\n provider = \"prisma-dbgenerator\"\n output = \"./node_modules/@prisma/client\"\n binaryTargets = [\"native\"]\n previewFeatures = [\"nativeTypes\"]\n config = {\n \"generator\": {\n \"dbgenerated\": {\n \"output\": \"./src/db/generated\",\n \"provider\": \"./src/db/generated/provider.js\"\n }\n }\n }\n}\n```\n\n在上述配置中,我们定义了两个生成器。`client` 生成器用于生成 Prisma 客户端代码,而 `dbgenerated` 生成器用于生成数据库相关的代码。\n\n注意到 `dbgenerated` 生成器的 `config` 部分中有一个 `provider` 字段,它指定了自定义函数的引入位置。在这个示例中,我们将自定义函数放在 `./src/db/generated/provider.js` 文件中。\n\n你可以根据你的项目结构和需要来调整路径和文件名,确保指定的 `provider` 路径正确引入了自定义函数。",
63
- "id": "jZc2KKRs",
64
- "meta": {},
65
- "parentId": "xPft8Msa",
66
- "role": "assistant",
67
- "topicId": "CZg3IEdy",
68
- "createdAt": 1698464173228,
69
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
70
- "updatedAt": 1698464181896,
71
- "fromModel": "gpt-3.5-turbo"
72
- },
73
- {
74
- "content": "如何启动一个 postgres Docker 镜像?",
75
- "id": "LjG9XSuq",
76
- "meta": {},
77
- "role": "user",
78
- "topicId": "MNWhBEh5",
79
- "createdAt": 1698754460196,
80
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
81
- "updatedAt": 1698754463118
82
- },
83
- {
84
- "content": "要启动一个 PostgreSQL Docker 镜像,你可以按照以下步骤操作:\n\n1. 首先,确保你已经安装了 Docker,可以在终端中运行 `docker --version` 来检查。\n\n2. 在终端中运行以下命令以下载并启动一个 PostgreSQL 镜像:\n\n ```shell\n docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres\n ```\n\n 这将从 Docker Hub 下载 PostgreSQL 镜像",
85
- "id": "CL7E1Mc5",
86
- "meta": {},
87
- "parentId": "LjG9XSuq",
88
- "role": "assistant",
89
- "topicId": "MNWhBEh5",
90
- "createdAt": 1698754479751,
91
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
92
- "updatedAt": 1698754507690,
93
- "fromModel": "gpt-3.5-turbo"
94
- },
95
- {
96
- "content": "如何指定本地存储的目录到 /www/database/postgres",
97
- "id": "UIvHZr7m",
98
- "meta": {},
99
- "role": "user",
100
- "topicId": "MNWhBEh5",
101
- "createdAt": 1698754591763,
102
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
103
- "updatedAt": 1698754591764
104
- },
105
- {
106
- "content": "要将本地存储的目录映射到容器内的 `/var/lib/postgresql/data` 目录,你可以使用 Docker 的 `-v` 参数。\n\n以下是示例命令:\n\n```shell\ndocker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -v /www/database/postgres:/var/lib/postgresql/data -d postgres\n```\n\n在这个命令中,我们使用了 `-v` 参数来指定本地目录 `/www/database/postgres` 映射到容器内的 `/var/lib/postgresql/data` 目录。这样,所有的 PostgreSQL 数据将会保存在本地指定的目录中。",
107
- "id": "XLJOK44r",
108
- "meta": {},
109
- "parentId": "UIvHZr7m",
110
- "role": "assistant",
111
- "topicId": "MNWhBEh5",
112
- "createdAt": 1698754591765,
113
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
114
- "updatedAt": 1698754609275,
115
- "fromModel": "gpt-3.5-turbo"
116
- },
117
- {
118
- "content": "docker run --name postgres -e POSTGRES_PASSWORD=DSLapHYdzNrai5j6 -p 33300:5432 -v /www/database/postgres:/var/lib/postgresql/data -d postgres",
119
- "id": "W3J6jQjm",
120
- "meta": {},
121
- "role": "user",
122
- "topicId": "MNWhBEh5",
123
- "createdAt": 1698754700529,
124
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
125
- "updatedAt": 1698754700530
126
- },
127
- {
128
- "content": "如何启动 pgadmin",
129
- "id": "L7mq0ehV",
130
- "meta": {},
131
- "role": "user",
132
- "topicId": "MNWhBEh5",
133
- "createdAt": 1698755749886,
134
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
135
- "updatedAt": 1698755749888
136
- },
137
- {
138
- "content": "要启动 pgAdmin,你可以按照以下步骤操作:\n\n1. 首先,确保你已经安装了 Docker,并且已经成功启动了 PostgreSQL Docker 容器。\n\n2. 在终端中运行以下命令以启动 pgAdmin Docker 容器:\n\n ```shell\n docker run --name my-pgadmin -p 5050:80 -e PGADMIN_DEFAULT_EMAIL=myemail@example.com -e PGADMIN_DEFAULT_PASSWORD=mypassword -d dpage/pgadmin4\n ```\n\n 在这个命令中,我们使用了 `-p` 参数来将容器的端口 80 映射到本地的端口 5050。你可以根据需要修改这个端口映射。\n\n 我们还使用了 `-e` 参数来设置 pgAdmin 的默认登录邮箱和密码。你可以根据需要修改这些值。\n\n3. 在浏览器中访问 `http://localhost:5050`,你将看到 pgAdmin 的登录界面。\n\n4. 使用在上一步中设置的邮箱和密码进行登录。\n\n5. 在 pgAdmin 中,你可以添加一个新的服务器连接,以连接到运行在 Docker 容器中的 PostgreSQL 数据库。要添加一个新的服务器连接,你需要提供以下信息:\n\n - 主机名/地址:使用 Docker 容器的 IP 地址或者 `localhost`。\n - 端口:使用 Docker 容器中 PostgreSQL 的映射端口,例如 33300。\n - 用户名和密码:使用在启动 PostgreSQL 容器时设置的用户名和密码。\n\n 完成上述信息的填写后,点击保存并连接到 PostgreSQL 服务器。\n\n现在,你已经成功启动了 pgAdmin 并连接到了你的 PostgreSQL 数据库。你可以使用 pgAdmin 来管理和操作你的数据库。",
139
- "id": "d5XTX9EQ",
140
- "meta": {},
141
- "parentId": "L7mq0ehV",
142
- "role": "assistant",
143
- "topicId": "MNWhBEh5",
144
- "createdAt": 1698755749889,
145
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
146
- "updatedAt": 1698755786183,
147
- "fromModel": "gpt-3.5-turbo"
148
- },
149
- {
150
- "content": "",
151
- "id": "tool_calls_KPPDiRyW",
152
- "meta": {},
153
- "parentId": "42k72jMi",
154
- "role": "assistant",
155
- "createdAt": 1690650544842,
156
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
157
- "updatedAt": 1690650572389,
158
- "fromModel": "gpt-3.5-turbo-16k",
159
- "tools": [
160
- {
161
- "apiName": "websiteCrawler",
162
- "arguments": "{\n \"url\": \"https://mp.weixin.qq.com/s?__biz=MjM5MTA1MjAxMQ==&mid=2651264337&idx=1&sn=d7d9126578c74c912e1f0d42cb5629da&chksm=bd48ccd58a3f45c3f2cbc7d7b732c820b9e7cd6b547c06acc8170b233710b5fb5ed62f5fd94d&mpshare=1&scene=1&srcid=07294Mpw7C6JCLgtagL1cBDR&sharer_sharetime=1690622712877&sharer_shareid=0358058a42fc25387d28337fc3d22c3c#rd\"\n}",
163
- "id": "tool_call_KPPDiRyW",
164
- "identifier": "websiteCrawler",
165
- "type": "default"
166
- }
167
- ]
168
- },
169
- {
170
- "content": "abcabc",
171
- "id": "KPPDiRyW",
172
- "meta": {},
173
- "parentId": "tool_calls_KPPDiRyW",
174
- "role": "tool",
175
- "createdAt": 1690650544852,
176
- "plugin": {
177
- "apiName": "websiteCrawler",
178
- "arguments": "{\n \"url\": \"https://mp.weixin.qq.com/s?__biz=MjM5MTA1MjAxMQ==&mid=2651264337&idx=1&sn=d7d9126578c74c912e1f0d42cb5629da&chksm=bd48ccd58a3f45c3f2cbc7d7b732c820b9e7cd6b547c06acc8170b233710b5fb5ed62f5fd94d&mpshare=1&scene=1&srcid=07294Mpw7C6JCLgtagL1cBDR&sharer_sharetime=1690622712877&sharer_shareid=0358058a42fc25387d28337fc3d22c3c#rd\"\n}",
179
- "identifier": "websiteCrawler",
180
- "type": "default"
181
- },
182
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
183
- "updatedAt": 1690650572399,
184
- "fromModel": "gpt-3.5-turbo-16k",
185
- "tool_call_id": "tool_call_KPPDiRyW"
186
- },
187
- {
188
- "content": "",
189
- "id": "tool_calls_9cRjevRQ",
190
- "meta": {},
191
- "parentId": "3nDXtEKv",
192
- "role": "assistant",
193
- "createdAt": 1700065743395,
194
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
195
- "updatedAt": 1700065751851,
196
- "fromModel": "gpt-3.5-turbo-16k",
197
- "tools": [
198
- {
199
- "apiName": "getWebsiteContent",
200
- "arguments": "{\n \"url\": \"https://nodejs.org/api/packages.html#dual-package-hazard\"\n}",
201
- "id": "tool_call_9cRjevRQ",
202
- "identifier": "website-crawler",
203
- "type": "default"
204
- }
205
- ]
206
- },
207
- {
208
- "content": "bbbbb",
209
- "id": "9cRjevRQ",
210
- "meta": {},
211
- "parentId": "tool_calls_9cRjevRQ",
212
- "role": "tool",
213
- "plugin": {
214
- "apiName": "getWebsiteContent",
215
- "arguments": "{\n \"url\": \"https://nodejs.org/api/packages.html#dual-package-hazard\"\n}",
216
- "identifier": "website-crawler",
217
- "type": "default"
218
- },
219
- "createdAt": 1700065743405,
220
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
221
- "updatedAt": 1700065751861,
222
- "fromModel": "gpt-3.5-turbo-16k",
223
- "tool_call_id": "tool_call_9cRjevRQ"
224
- }
225
- ],
226
- "topics": [
227
- {
228
- "id": "CZg3IEdy",
229
- "title": "Prisma中的cuid函数作用是什么",
230
- "createdAt": 1698463911747,
231
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
232
- "updatedAt": 1698463915716
233
- },
234
- {
235
- "id": "MNWhBEh5",
236
- "title": "启动 PostgreSQL Docker 镜像方法",
237
- "createdAt": 1698754463117,
238
- "sessionId": "06cc3e20-e870-4099-a619-c07a849d742d",
239
- "updatedAt": 1698754464867
240
- }
241
- ],
242
- "sessionGroups": []
243
- },
244
- "version": 5
245
- }
@@ -1,96 +0,0 @@
1
- {
2
- "exportType": "sessions",
3
- "state": {
4
- "messages": [
5
- {
6
- "role": "function",
7
- "content": "[{\"city\":\"杭州市\",\"adcode\":\"330100\",\"province\":\"浙江\",\"reporttime\":\"2024-05-11 10:32:32\",\"casts\":[{\"date\":\"2024-05-11\",\"week\":\"6\",\"dayweather\":\"中雨\",\"nightweather\":\"中雨\",\"daytemp\":\"25\",\"nighttemp\":\"18\",\"daywind\":\"南\",\"nightwind\":\"南\",\"daypower\":\"4\",\"nightpower\":\"4\",\"daytemp_float\":\"25.0\",\"nighttemp_float\":\"18.0\"},{\"date\":\"2024-05-12\",\"week\":\"7\",\"dayweather\":\"多云\",\"nightweather\":\"晴\",\"daytemp\":\"25\",\"nighttemp\":\"16\",\"daywind\":\"北\",\"nightwind\":\"北\",\"daypower\":\"1-3\",\"nightpower\":\"1-3\",\"daytemp_float\":\"25.0\",\"nighttemp_float\":\"16.0\"},{\"date\":\"2024-05-13\",\"week\":\"1\",\"dayweather\":\"晴\",\"nightweather\":\"晴\",\"daytemp\":\"28\",\"nighttemp\":\"16\",\"daywind\":\"东北\",\"nightwind\":\"东北\",\"daypower\":\"1-3\",\"nightpower\":\"1-3\",\"daytemp_float\":\"28.0\",\"nighttemp_float\":\"16.0\"},{\"date\":\"2024-05-14\",\"week\":\"2\",\"dayweather\":\"多云\",\"nightweather\":\"阴\",\"daytemp\":\"28\",\"nighttemp\":\"15\",\"daywind\":\"东\",\"nightwind\":\"东\",\"daypower\":\"1-3\",\"nightpower\":\"1-3\",\"daytemp_float\":\"28.0\",\"nighttemp_float\":\"15.0\"}]}]",
8
- "fromModel": "gpt-3.5-turbo",
9
- "fromProvider": "openai",
10
- "parentId": "WwRdrdCz",
11
- "sessionId": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
12
- "topicId": "yjkdZafZ",
13
- "createdAt": 1715395810026,
14
- "id": "UQ5VAGkk",
15
- "updatedAt": 1715395822026,
16
- "traceId": "4a8381a2-5582-46ce-87d8-c0f010de5c68",
17
- "observationId": "904f7ab0-4066-4f9b-84fa-b1677974f976",
18
- "plugin": {
19
- "apiName": "fetchCurrentWeather",
20
- "arguments": "{\n \"city\": \"杭州\"\n}",
21
- "identifier": "realtime-weather",
22
- "type": "default"
23
- }
24
- },
25
- {
26
- "role": "user",
27
- "content": "杭州天气如何?\n\n",
28
- "files": [],
29
- "sessionId": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
30
- "topicId": "yjkdZafZ",
31
- "createdAt": 1715394828164,
32
- "id": "WwRdrdCz",
33
- "updatedAt": 1715394828164
34
- },
35
- {
36
- "role": "assistant",
37
- "content": "杭州的天气情况如下:\n\n- 今天(5月11日)白天和晚上都有中雨,白天温度为25摄氏度,晚上温度为18摄氏度,南风,风力为4级。\n- 明天(5月12日)白天多云,晚上晴,白天温度为25摄氏度,晚上温度为16摄氏度,北风,风力为1-3级。\n- 后天(5月13日)白天和晚上都是晴天,白天温度为28摄氏度,晚上温度为16摄氏度,东北风,风力为1-3级。\n- 大后天(5月14日)白天多云,晚上阴天,白天温度为28摄氏度,晚上温度为15摄氏度,东风,风力为1-3级。\n\n请注意根据实际情况做好防雨和保暖措施。",
38
- "fromModel": "gpt-3.5-turbo",
39
- "fromProvider": "openai",
40
- "parentId": "UQ5VAGkk",
41
- "sessionId": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
42
- "topicId": "yjkdZafZ",
43
- "createdAt": 1715395822125,
44
- "id": "hbqsYoMn",
45
- "updatedAt": 1715395830606,
46
- "traceId": "4a8381a2-5582-46ce-87d8-c0f010de5c68",
47
- "observationId": "cad6a5bd-6a7a-4ff9-b37a-3deaa23b094a"
48
- }
49
- ],
50
- "sessions": [
51
- {
52
- "config": {
53
- "autoCreateTopicThreshold": 2,
54
- "displayMode": "chat",
55
- "enableAutoCreateTopic": true,
56
- "historyCount": 1,
57
- "model": "gpt-3.5-turbo",
58
- "params": {
59
- "frequency_penalty": 0,
60
- "presence_penalty": 0,
61
- "temperature": 0.6,
62
- "top_p": 1
63
- },
64
- "plugins": ["realtime-weather", "steam"],
65
- "provider": "openai",
66
- "systemRole": "",
67
- "tts": {
68
- "showAllLocaleVoice": false,
69
- "sttLocale": "auto",
70
- "ttsService": "openai",
71
- "voice": { "openai": "alloy" }
72
- }
73
- },
74
- "group": "default",
75
- "meta": {},
76
- "pinned": false,
77
- "type": "agent",
78
- "createdAt": 1715394818440,
79
- "id": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
80
- "updatedAt": 1715394822366,
81
- "model": "gpt-3.5-turbo"
82
- }
83
- ],
84
- "topics": [
85
- {
86
- "title": "杭州天气查询",
87
- "sessionId": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
88
- "createdAt": 1715394835099,
89
- "id": "yjkdZafZ",
90
- "updatedAt": 1715394838061,
91
- "favorite": false
92
- }
93
- ]
94
- },
95
- "version": 4
96
- }
@@ -1,120 +0,0 @@
1
- {
2
- "exportType": "sessions",
3
- "state": {
4
- "messages": [
5
- {
6
- "role": "assistant",
7
- "content": "",
8
- "fromModel": "gpt-3.5-turbo",
9
- "fromProvider": "openai",
10
- "parentId": "WwRdrdCz",
11
- "sessionId": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
12
- "topicId": "yjkdZafZ",
13
- "createdAt": 1715395810016,
14
- "id": "tool_calls_UQ5VAGkk",
15
- "updatedAt": 1715395822016,
16
- "traceId": "4a8381a2-5582-46ce-87d8-c0f010de5c68",
17
- "observationId": "904f7ab0-4066-4f9b-84fa-b1677974f976",
18
- "tools": [
19
- {
20
- "id": "tool_call_UQ5VAGkk",
21
- "apiName": "fetchCurrentWeather",
22
- "arguments": "{\n \"city\": \"杭州\"\n}",
23
- "identifier": "realtime-weather",
24
- "type": "default"
25
- }
26
- ]
27
- },
28
- {
29
- "role": "tool",
30
- "content": "[{\"city\":\"杭州市\",\"adcode\":\"330100\",\"province\":\"浙江\",\"reporttime\":\"2024-05-11 10:32:32\",\"casts\":[{\"date\":\"2024-05-11\",\"week\":\"6\",\"dayweather\":\"中雨\",\"nightweather\":\"中雨\",\"daytemp\":\"25\",\"nighttemp\":\"18\",\"daywind\":\"南\",\"nightwind\":\"南\",\"daypower\":\"4\",\"nightpower\":\"4\",\"daytemp_float\":\"25.0\",\"nighttemp_float\":\"18.0\"},{\"date\":\"2024-05-12\",\"week\":\"7\",\"dayweather\":\"多云\",\"nightweather\":\"晴\",\"daytemp\":\"25\",\"nighttemp\":\"16\",\"daywind\":\"北\",\"nightwind\":\"北\",\"daypower\":\"1-3\",\"nightpower\":\"1-3\",\"daytemp_float\":\"25.0\",\"nighttemp_float\":\"16.0\"},{\"date\":\"2024-05-13\",\"week\":\"1\",\"dayweather\":\"晴\",\"nightweather\":\"晴\",\"daytemp\":\"28\",\"nighttemp\":\"16\",\"daywind\":\"东北\",\"nightwind\":\"东北\",\"daypower\":\"1-3\",\"nightpower\":\"1-3\",\"daytemp_float\":\"28.0\",\"nighttemp_float\":\"16.0\"},{\"date\":\"2024-05-14\",\"week\":\"2\",\"dayweather\":\"多云\",\"nightweather\":\"阴\",\"daytemp\":\"28\",\"nighttemp\":\"15\",\"daywind\":\"东\",\"nightwind\":\"东\",\"daypower\":\"1-3\",\"nightpower\":\"1-3\",\"daytemp_float\":\"28.0\",\"nighttemp_float\":\"15.0\"}]}]",
31
- "fromModel": "gpt-3.5-turbo",
32
- "fromProvider": "openai",
33
- "parentId": "tool_calls_UQ5VAGkk",
34
- "sessionId": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
35
- "topicId": "yjkdZafZ",
36
- "createdAt": 1715395810026,
37
- "id": "UQ5VAGkk",
38
- "updatedAt": 1715395822026,
39
- "traceId": "4a8381a2-5582-46ce-87d8-c0f010de5c68",
40
- "observationId": "904f7ab0-4066-4f9b-84fa-b1677974f976",
41
- "tool_call_id": "tool_call_UQ5VAGkk",
42
- "plugin": {
43
- "apiName": "fetchCurrentWeather",
44
- "arguments": "{\n \"city\": \"杭州\"\n}",
45
- "identifier": "realtime-weather",
46
- "type": "default"
47
- }
48
- },
49
- {
50
- "role": "user",
51
- "content": "杭州天气如何?\n\n",
52
- "files": [],
53
- "sessionId": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
54
- "topicId": "yjkdZafZ",
55
- "createdAt": 1715394828164,
56
- "id": "WwRdrdCz",
57
- "updatedAt": 1715394828164
58
- },
59
- {
60
- "role": "assistant",
61
- "content": "杭州的天气情况如下:\n\n- 今天(5月11日)白天和晚上都有中雨,白天温度为25摄氏度,晚上温度为18摄氏度,南风,风力为4级。\n- 明天(5月12日)白天多云,晚上晴,白天温度为25摄氏度,晚上温度为16摄氏度,北风,风力为1-3级。\n- 后天(5月13日)白天和晚上都是晴天,白天温度为28摄氏度,晚上温度为16摄氏度,东北风,风力为1-3级。\n- 大后天(5月14日)白天多云,晚上阴天,白天温度为28摄氏度,晚上温度为15摄氏度,东风,风力为1-3级。\n\n请注意根据实际情况做好防雨和保暖措施。",
62
- "fromModel": "gpt-3.5-turbo",
63
- "fromProvider": "openai",
64
- "parentId": "UQ5VAGkk",
65
- "sessionId": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
66
- "topicId": "yjkdZafZ",
67
- "createdAt": 1715395822125,
68
- "id": "hbqsYoMn",
69
- "updatedAt": 1715395830606,
70
- "traceId": "4a8381a2-5582-46ce-87d8-c0f010de5c68",
71
- "observationId": "cad6a5bd-6a7a-4ff9-b37a-3deaa23b094a"
72
- }
73
- ],
74
- "sessions": [
75
- {
76
- "config": {
77
- "autoCreateTopicThreshold": 2,
78
- "displayMode": "chat",
79
- "enableAutoCreateTopic": true,
80
- "historyCount": 1,
81
- "model": "gpt-3.5-turbo",
82
- "params": {
83
- "frequency_penalty": 0,
84
- "presence_penalty": 0,
85
- "temperature": 0.6,
86
- "top_p": 1
87
- },
88
- "plugins": ["realtime-weather", "steam"],
89
- "provider": "openai",
90
- "systemRole": "",
91
- "tts": {
92
- "showAllLocaleVoice": false,
93
- "sttLocale": "auto",
94
- "ttsService": "openai",
95
- "voice": { "openai": "alloy" }
96
- }
97
- },
98
- "group": "default",
99
- "meta": {},
100
- "pinned": false,
101
- "type": "agent",
102
- "createdAt": 1715394818440,
103
- "id": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
104
- "updatedAt": 1715394822366,
105
- "model": "gpt-3.5-turbo"
106
- }
107
- ],
108
- "topics": [
109
- {
110
- "title": "杭州天气查询",
111
- "sessionId": "8eb073bb-e133-4dbd-81a2-5305a8447b5f",
112
- "createdAt": 1715394835099,
113
- "id": "yjkdZafZ",
114
- "updatedAt": 1715394838061,
115
- "favorite": false
116
- }
117
- ]
118
- },
119
- "version": 5
120
- }
@@ -1,58 +0,0 @@
1
- import type { Migration, MigrationData } from '@/migrations/VersionController';
2
-
3
- import { V4ConfigState, V4Message } from './types/v4';
4
- import { V5ConfigState, V5Message } from './types/v5';
5
-
6
- export class MigrationV4ToV5 implements Migration {
7
- // from this version to start migration
8
- version = 4;
9
-
10
- migrate(data: MigrationData<V4ConfigState>): MigrationData<V5ConfigState> {
11
- const { messages } = data.state;
12
-
13
- return {
14
- ...data,
15
- state: {
16
- ...data.state,
17
- messages: MigrationV4ToV5.migrateMessage(messages),
18
- },
19
- };
20
- }
21
-
22
- static migrateMessage(messages: V4Message[]): V5Message[] {
23
- let v5Messages: V5Message[] = [];
24
-
25
- messages.forEach((item) => {
26
- if (item.role === 'function') {
27
- const toolCallId = `tool_call_${item.id}`;
28
- const assistantMessageId = `tool_calls_${item.id}`;
29
- const assistantMessage: V5Message = {
30
- ...item,
31
- content: '',
32
- // make sure the createdAt is before than tool message
33
- createdAt: item.createdAt - 10,
34
- id: assistantMessageId,
35
- plugin: undefined,
36
- role: 'assistant',
37
- tools: [{ ...item.plugin!, id: toolCallId }],
38
- updatedAt: item.updatedAt - 10,
39
- };
40
-
41
- const toolMessage: V5Message = {
42
- ...item,
43
- parentId: assistantMessageId,
44
- role: 'tool',
45
- tool_call_id: toolCallId,
46
- };
47
- v5Messages.push(assistantMessage, toolMessage);
48
- }
49
-
50
- // if not function message, just push it
51
- else {
52
- v5Messages.push(item as V5Message);
53
- }
54
- });
55
-
56
- return v5Messages;
57
- }
58
- }
@@ -1,49 +0,0 @@
1
- import { describe } from 'vitest';
2
-
3
- import { MigrationData, VersionController } from '@/migrations/VersionController';
4
-
5
- import { MigrationV1ToV2 } from '../FromV1ToV2';
6
- import inputV1Data from '../FromV1ToV2/fixtures/input-v1-session.json';
7
- import { MigrationV2ToV3 } from '../FromV2ToV3';
8
- import { MigrationV3ToV4 } from '../FromV3ToV4';
9
- import outputDataFromV1ToV5 from './fixtures/from-v1-to-v5-output.json';
10
- import functionInputV4 from './fixtures/function-input-v4.json';
11
- import functionOutputV5 from './fixtures/function-output-v5.json';
12
- import { MigrationV4ToV5 } from './index';
13
-
14
- describe('MigrationV4ToV5', () => {
15
- let migrations;
16
- let versionController: VersionController<any>;
17
-
18
- beforeEach(() => {
19
- migrations = [MigrationV4ToV5];
20
- versionController = new VersionController(migrations, 5);
21
- });
22
-
23
- describe('should migrate data correctly from previous versions', () => {
24
- it('role=function', () => {
25
- const data: MigrationData = functionInputV4;
26
-
27
- const migratedData = versionController.migrate(data);
28
-
29
- expect(migratedData.version).toEqual(functionOutputV5.version);
30
- expect(migratedData.state.messages).toEqual(functionOutputV5.state.messages);
31
- });
32
- });
33
-
34
- it('should work correct from v1 to v5', () => {
35
- const data: MigrationData = inputV1Data;
36
-
37
- versionController = new VersionController(
38
- [MigrationV4ToV5, MigrationV3ToV4, MigrationV2ToV3, MigrationV1ToV2],
39
- 5,
40
- );
41
-
42
- const migratedData = versionController.migrate(data);
43
-
44
- expect(migratedData.version).toEqual(outputDataFromV1ToV5.version);
45
- expect(migratedData.state.messages).toEqual(outputDataFromV1ToV5.state.messages);
46
- expect(migratedData.state.sessions).toEqual(outputDataFromV1ToV5.state.sessions);
47
- expect(migratedData.state.topics).toEqual(outputDataFromV1ToV5.state.topics);
48
- });
49
- });