@lobehub/lobehub 2.0.0-next.31 → 2.0.0-next.33
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/.github/workflows/test.yml +1 -0
- package/CHANGELOG.md +58 -0
- package/apps/desktop/package.json +1 -1
- package/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts +23 -2
- package/changelog/v1.json +21 -0
- package/docker-compose/local/.env.example +3 -0
- package/docs/self-hosting/server-database/docker-compose.mdx +29 -0
- package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +29 -0
- package/package.json +1 -1
- package/packages/const/src/hotkeys.ts +3 -3
- package/packages/const/src/models.ts +2 -2
- package/packages/const/src/utils/merge.ts +3 -3
- package/packages/conversation-flow/package.json +13 -0
- package/packages/conversation-flow/src/__tests__/fixtures/index.ts +48 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/assistant-chain-with-followup.json +56 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/assistant-with-tools.json +144 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/active-index-1.json +131 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/assistant-branch.json +96 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/assistant-user-branch.json +123 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/conversation.json +128 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/index.ts +14 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/nested.json +179 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/compare/index.ts +8 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/compare/simple.json +85 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/compare/with-tools.json +169 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/complex-scenario.json +107 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/index.ts +14 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/linear-conversation.json +59 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistant-chain-with-followup.json +135 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistant-with-tools.json +340 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/active-index-1.json +242 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/assistant-branch.json +208 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/assistant-user-branch.json +254 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/conversation.json +260 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/index.ts +14 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/nested.json +389 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/compare/index.ts +8 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/compare/simple.json +224 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/compare/with-tools.json +418 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/complex-scenario.json +239 -0
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/linear-conversation.json +138 -0
- package/packages/conversation-flow/src/__tests__/parse.test.ts +97 -0
- package/packages/conversation-flow/src/index.ts +17 -0
- package/packages/conversation-flow/src/indexing.ts +58 -0
- package/packages/conversation-flow/src/parse.ts +53 -0
- package/packages/conversation-flow/src/structuring.ts +38 -0
- package/packages/conversation-flow/src/transformation/BranchResolver.ts +66 -0
- package/packages/conversation-flow/src/transformation/ContextTreeBuilder.ts +292 -0
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +421 -0
- package/packages/conversation-flow/src/transformation/MessageCollector.ts +166 -0
- package/packages/conversation-flow/src/transformation/MessageTransformer.ts +177 -0
- package/packages/conversation-flow/src/transformation/__tests__/BranchResolver.test.ts +151 -0
- package/packages/conversation-flow/src/transformation/__tests__/ContextTreeBuilder.test.ts +385 -0
- package/packages/conversation-flow/src/transformation/__tests__/FlatListBuilder.test.ts +511 -0
- package/packages/conversation-flow/src/transformation/__tests__/MessageCollector.test.ts +220 -0
- package/packages/conversation-flow/src/transformation/__tests__/MessageTransformer.test.ts +287 -0
- package/packages/conversation-flow/src/transformation/index.ts +78 -0
- package/packages/conversation-flow/src/types/contextTree.ts +65 -0
- package/packages/conversation-flow/src/types/flatMessageList.ts +66 -0
- package/packages/conversation-flow/src/types/shared.ts +63 -0
- package/packages/conversation-flow/src/types.ts +36 -0
- package/packages/conversation-flow/vitest.config.mts +10 -0
- package/packages/types/src/message/common/metadata.ts +5 -1
- package/src/app/[variants]/(main)/chat/@session/features/SessionListContent/List/Item/index.tsx +3 -4
- package/src/envs/__tests__/app.test.ts +47 -13
- package/src/envs/app.ts +6 -0
- package/src/server/modules/S3/index.test.ts +379 -0
- package/src/server/routers/async/__tests__/caller.test.ts +333 -0
- package/src/server/routers/async/caller.ts +2 -1
- package/src/server/routers/lambda/__tests__/integration/message.integration.test.ts +57 -57
- package/src/server/routers/lambda/message.ts +2 -2
- package/src/server/services/message/__tests__/index.test.ts +4 -4
- package/src/server/services/message/index.ts +1 -1
- package/src/services/message/index.ts +2 -3
- package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChat.test.ts +8 -8
- package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChatV2.test.ts +8 -8
- package/src/store/chat/slices/aiChat/actions/__tests__/helpers.ts +1 -1
- package/src/store/chat/slices/aiChat/actions/generateAIChatV2.ts +1 -1
- package/src/store/chat/slices/message/action.test.ts +7 -7
- package/src/store/chat/slices/message/action.ts +2 -2
- package/src/store/chat/slices/plugin/action.test.ts +7 -7
- package/src/store/chat/slices/plugin/action.ts +1 -1
- package/packages/context-engine/ARCHITECTURE.md +0 -425
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contextTree": [
|
|
3
|
+
{
|
|
4
|
+
"id": "msg-101",
|
|
5
|
+
"type": "message"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"children": [
|
|
9
|
+
{
|
|
10
|
+
"id": "msg-102",
|
|
11
|
+
"type": "message",
|
|
12
|
+
"tools": [
|
|
13
|
+
"msg-103",
|
|
14
|
+
"msg-104"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "msg-105",
|
|
19
|
+
"type": "message",
|
|
20
|
+
"tools": [
|
|
21
|
+
"msg-106",
|
|
22
|
+
"msg-107"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "msg-108",
|
|
27
|
+
"type": "message"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"id": "msg-102",
|
|
31
|
+
"type": "assistantGroup"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"flatList": [
|
|
35
|
+
{
|
|
36
|
+
"id": "msg-101",
|
|
37
|
+
"role": "user",
|
|
38
|
+
"content": "What's the weather like in San Francisco and Beijing today?",
|
|
39
|
+
"parentId": null,
|
|
40
|
+
"createdAt": 1704067200000,
|
|
41
|
+
"updatedAt": 1704067200000,
|
|
42
|
+
"meta": {}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "msg-102",
|
|
46
|
+
"role": "assistantGroup",
|
|
47
|
+
"content": "",
|
|
48
|
+
"parentId": "msg-101",
|
|
49
|
+
"createdAt": 1704067202000,
|
|
50
|
+
"updatedAt": 1704067202000,
|
|
51
|
+
"meta": {},
|
|
52
|
+
"children": [
|
|
53
|
+
{
|
|
54
|
+
"content": "Let me check the current weather conditions in both cities for you.",
|
|
55
|
+
"id": "msg-102",
|
|
56
|
+
"performance": {
|
|
57
|
+
"duration": 928,
|
|
58
|
+
"latency": 1173,
|
|
59
|
+
"tps": 48.5,
|
|
60
|
+
"ttft": 245
|
|
61
|
+
},
|
|
62
|
+
"tools": [
|
|
63
|
+
{
|
|
64
|
+
"id": "tool-sf",
|
|
65
|
+
"identifier": "weather",
|
|
66
|
+
"apiName": "getWeather",
|
|
67
|
+
"arguments": "{\"city\":\"San Francisco\"}",
|
|
68
|
+
"type": "default",
|
|
69
|
+
"result": {
|
|
70
|
+
"content": "{\"location\": \"San Francisco, CA\", \"temperature\": 18, \"conditions\": \"Partly Cloudy\", \"humidity\": 72, \"wind_speed\": 15}",
|
|
71
|
+
"id": "msg-103",
|
|
72
|
+
"state": {
|
|
73
|
+
"cached": false,
|
|
74
|
+
"executionTime": 234
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"result_msg_id": "msg-103"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "tool-bj",
|
|
81
|
+
"identifier": "weather",
|
|
82
|
+
"apiName": "getWeather",
|
|
83
|
+
"arguments": "{\"city\":\"Beijing\"}",
|
|
84
|
+
"type": "default",
|
|
85
|
+
"result": {
|
|
86
|
+
"content": "{\"location\": \"Beijing, China\", \"temperature\": 12, \"conditions\": \"Clear\", \"humidity\": 45, \"wind_speed\": 8}",
|
|
87
|
+
"id": "msg-104",
|
|
88
|
+
"state": {
|
|
89
|
+
"cached": false,
|
|
90
|
+
"executionTime": 189
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"result_msg_id": "msg-104"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"usage": {
|
|
97
|
+
"cost": 0.000219,
|
|
98
|
+
"totalInputTokens": 28,
|
|
99
|
+
"totalOutputTokens": 45,
|
|
100
|
+
"totalTokens": 73
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"content": "Let me also check the forecast for tomorrow to give you a better comparison.",
|
|
105
|
+
"id": "msg-105",
|
|
106
|
+
"performance": {
|
|
107
|
+
"duration": 875,
|
|
108
|
+
"latency": 1053,
|
|
109
|
+
"tps": 48,
|
|
110
|
+
"ttft": 178
|
|
111
|
+
},
|
|
112
|
+
"tools": [
|
|
113
|
+
{
|
|
114
|
+
"id": "tool-sf-forecast",
|
|
115
|
+
"identifier": "weather",
|
|
116
|
+
"apiName": "getForecast",
|
|
117
|
+
"arguments": "{\"city\":\"San Francisco\",\"days\":1}",
|
|
118
|
+
"type": "default",
|
|
119
|
+
"result": {
|
|
120
|
+
"content": "{\"location\": \"San Francisco, CA\", \"date\": \"2024-01-02\", \"high\": 20, \"low\": 14, \"conditions\": \"Sunny\"}",
|
|
121
|
+
"id": "msg-106",
|
|
122
|
+
"state": {
|
|
123
|
+
"cached": false,
|
|
124
|
+
"executionTime": 198
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"result_msg_id": "msg-106"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"id": "tool-bj-forecast",
|
|
131
|
+
"identifier": "weather",
|
|
132
|
+
"apiName": "getForecast",
|
|
133
|
+
"arguments": "{\"city\":\"Beijing\",\"days\":1}",
|
|
134
|
+
"type": "default",
|
|
135
|
+
"result": {
|
|
136
|
+
"content": "{\"location\": \"Beijing, China\", \"date\": \"2024-01-02\", \"high\": 15, \"low\": 8, \"conditions\": \"Partly Cloudy\"}",
|
|
137
|
+
"id": "msg-107",
|
|
138
|
+
"state": {
|
|
139
|
+
"cached": false,
|
|
140
|
+
"executionTime": 176
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"result_msg_id": "msg-107"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"usage": {
|
|
147
|
+
"cost": 0.000594,
|
|
148
|
+
"totalInputTokens": 156,
|
|
149
|
+
"totalOutputTokens": 42,
|
|
150
|
+
"totalTokens": 198
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"content": "Based on both current weather and tomorrow's forecast:\n\n**Today:**\n- San Francisco: 18°C, partly cloudy\n- Beijing: 12°C, clear\n\n**Tomorrow:**\n- San Francisco: High 20°C / Low 14°C, sunny\n- Beijing: High 15°C / Low 8°C, partly cloudy\n\nSan Francisco will have pleasant sunny weather tomorrow with a slight temperature increase. Beijing will see some clouds moving in but will still be cooler overall.",
|
|
155
|
+
"id": "msg-108",
|
|
156
|
+
"performance": {
|
|
157
|
+
"duration": 2074,
|
|
158
|
+
"latency": 2239,
|
|
159
|
+
"tps": 54,
|
|
160
|
+
"ttft": 165
|
|
161
|
+
},
|
|
162
|
+
"usage": {
|
|
163
|
+
"cost": 0.001071,
|
|
164
|
+
"totalInputTokens": 245,
|
|
165
|
+
"totalOutputTokens": 112,
|
|
166
|
+
"totalTokens": 357
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"performance": {
|
|
171
|
+
"ttft": 245,
|
|
172
|
+
"duration": 3877,
|
|
173
|
+
"latency": 4465,
|
|
174
|
+
"tps": 50.166666666666664
|
|
175
|
+
},
|
|
176
|
+
"usage": {
|
|
177
|
+
"totalInputTokens": 429,
|
|
178
|
+
"totalOutputTokens": 199,
|
|
179
|
+
"totalTokens": 628,
|
|
180
|
+
"cost": 0.0018839999999999998
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"messageMap": {
|
|
185
|
+
"msg-101": {
|
|
186
|
+
"id": "msg-101",
|
|
187
|
+
"role": "user",
|
|
188
|
+
"content": "What's the weather like in San Francisco and Beijing today?",
|
|
189
|
+
"parentId": null,
|
|
190
|
+
"createdAt": 1704067200000,
|
|
191
|
+
"updatedAt": 1704067200000,
|
|
192
|
+
"meta": {}
|
|
193
|
+
},
|
|
194
|
+
"msg-102": {
|
|
195
|
+
"id": "msg-102",
|
|
196
|
+
"role": "assistant",
|
|
197
|
+
"content": "Let me check the current weather conditions in both cities for you.",
|
|
198
|
+
"parentId": "msg-101",
|
|
199
|
+
"tools": [
|
|
200
|
+
{
|
|
201
|
+
"id": "tool-sf",
|
|
202
|
+
"identifier": "weather",
|
|
203
|
+
"apiName": "getWeather",
|
|
204
|
+
"arguments": "{\"city\":\"San Francisco\"}",
|
|
205
|
+
"type": "default"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"id": "tool-bj",
|
|
209
|
+
"identifier": "weather",
|
|
210
|
+
"apiName": "getWeather",
|
|
211
|
+
"arguments": "{\"city\":\"Beijing\"}",
|
|
212
|
+
"type": "default"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"createdAt": 1704067202000,
|
|
216
|
+
"updatedAt": 1704067202000,
|
|
217
|
+
"meta": {},
|
|
218
|
+
"metadata": {
|
|
219
|
+
"totalInputTokens": 28,
|
|
220
|
+
"totalOutputTokens": 45,
|
|
221
|
+
"totalTokens": 73,
|
|
222
|
+
"cost": 0.000219,
|
|
223
|
+
"tps": 48.5,
|
|
224
|
+
"ttft": 245,
|
|
225
|
+
"duration": 928,
|
|
226
|
+
"latency": 1173
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"msg-103": {
|
|
230
|
+
"id": "msg-103",
|
|
231
|
+
"role": "tool",
|
|
232
|
+
"tool_call_id": "tool-sf",
|
|
233
|
+
"content": "{\"location\": \"San Francisco, CA\", \"temperature\": 18, \"conditions\": \"Partly Cloudy\", \"humidity\": 72, \"wind_speed\": 15}",
|
|
234
|
+
"pluginState": {
|
|
235
|
+
"cached": false,
|
|
236
|
+
"executionTime": 234
|
|
237
|
+
},
|
|
238
|
+
"parentId": "msg-102",
|
|
239
|
+
"createdAt": 1704067203000,
|
|
240
|
+
"updatedAt": 1704067203000,
|
|
241
|
+
"meta": {}
|
|
242
|
+
},
|
|
243
|
+
"msg-104": {
|
|
244
|
+
"id": "msg-104",
|
|
245
|
+
"role": "tool",
|
|
246
|
+
"tool_call_id": "tool-bj",
|
|
247
|
+
"content": "{\"location\": \"Beijing, China\", \"temperature\": 12, \"conditions\": \"Clear\", \"humidity\": 45, \"wind_speed\": 8}",
|
|
248
|
+
"pluginState": {
|
|
249
|
+
"cached": false,
|
|
250
|
+
"executionTime": 189
|
|
251
|
+
},
|
|
252
|
+
"parentId": "msg-102",
|
|
253
|
+
"createdAt": 1704067203100,
|
|
254
|
+
"updatedAt": 1704067203100,
|
|
255
|
+
"meta": {}
|
|
256
|
+
},
|
|
257
|
+
"msg-105": {
|
|
258
|
+
"id": "msg-105",
|
|
259
|
+
"role": "assistant",
|
|
260
|
+
"content": "Let me also check the forecast for tomorrow to give you a better comparison.",
|
|
261
|
+
"parentId": "msg-103",
|
|
262
|
+
"tools": [
|
|
263
|
+
{
|
|
264
|
+
"id": "tool-sf-forecast",
|
|
265
|
+
"identifier": "weather",
|
|
266
|
+
"apiName": "getForecast",
|
|
267
|
+
"arguments": "{\"city\":\"San Francisco\",\"days\":1}",
|
|
268
|
+
"type": "default"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"id": "tool-bj-forecast",
|
|
272
|
+
"identifier": "weather",
|
|
273
|
+
"apiName": "getForecast",
|
|
274
|
+
"arguments": "{\"city\":\"Beijing\",\"days\":1}",
|
|
275
|
+
"type": "default"
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
"createdAt": 1704067205000,
|
|
279
|
+
"updatedAt": 1704067205000,
|
|
280
|
+
"meta": {},
|
|
281
|
+
"metadata": {
|
|
282
|
+
"totalInputTokens": 156,
|
|
283
|
+
"totalOutputTokens": 42,
|
|
284
|
+
"totalTokens": 198,
|
|
285
|
+
"cost": 0.000594,
|
|
286
|
+
"tps": 48,
|
|
287
|
+
"ttft": 178,
|
|
288
|
+
"duration": 875,
|
|
289
|
+
"latency": 1053
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
"msg-106": {
|
|
293
|
+
"id": "msg-106",
|
|
294
|
+
"role": "tool",
|
|
295
|
+
"tool_call_id": "tool-sf-forecast",
|
|
296
|
+
"content": "{\"location\": \"San Francisco, CA\", \"date\": \"2024-01-02\", \"high\": 20, \"low\": 14, \"conditions\": \"Sunny\"}",
|
|
297
|
+
"pluginState": {
|
|
298
|
+
"cached": false,
|
|
299
|
+
"executionTime": 198
|
|
300
|
+
},
|
|
301
|
+
"parentId": "msg-105",
|
|
302
|
+
"createdAt": 1704067206000,
|
|
303
|
+
"updatedAt": 1704067206000,
|
|
304
|
+
"meta": {}
|
|
305
|
+
},
|
|
306
|
+
"msg-107": {
|
|
307
|
+
"id": "msg-107",
|
|
308
|
+
"role": "tool",
|
|
309
|
+
"tool_call_id": "tool-bj-forecast",
|
|
310
|
+
"content": "{\"location\": \"Beijing, China\", \"date\": \"2024-01-02\", \"high\": 15, \"low\": 8, \"conditions\": \"Partly Cloudy\"}",
|
|
311
|
+
"pluginState": {
|
|
312
|
+
"cached": false,
|
|
313
|
+
"executionTime": 176
|
|
314
|
+
},
|
|
315
|
+
"parentId": "msg-105",
|
|
316
|
+
"createdAt": 1704067206100,
|
|
317
|
+
"updatedAt": 1704067206100,
|
|
318
|
+
"meta": {}
|
|
319
|
+
},
|
|
320
|
+
"msg-108": {
|
|
321
|
+
"id": "msg-108",
|
|
322
|
+
"role": "assistant",
|
|
323
|
+
"content": "Based on both current weather and tomorrow's forecast:\n\n**Today:**\n- San Francisco: 18°C, partly cloudy\n- Beijing: 12°C, clear\n\n**Tomorrow:**\n- San Francisco: High 20°C / Low 14°C, sunny\n- Beijing: High 15°C / Low 8°C, partly cloudy\n\nSan Francisco will have pleasant sunny weather tomorrow with a slight temperature increase. Beijing will see some clouds moving in but will still be cooler overall.",
|
|
324
|
+
"parentId": "msg-106",
|
|
325
|
+
"createdAt": 1704067208000,
|
|
326
|
+
"updatedAt": 1704067208000,
|
|
327
|
+
"meta": {},
|
|
328
|
+
"metadata": {
|
|
329
|
+
"totalInputTokens": 245,
|
|
330
|
+
"totalOutputTokens": 112,
|
|
331
|
+
"totalTokens": 357,
|
|
332
|
+
"cost": 0.001071,
|
|
333
|
+
"tps": 54,
|
|
334
|
+
"ttft": 165,
|
|
335
|
+
"duration": 2074,
|
|
336
|
+
"latency": 2239
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contextTree": [
|
|
3
|
+
{
|
|
4
|
+
"id": "msg-201",
|
|
5
|
+
"type": "message"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"activeBranchIndex": 1,
|
|
9
|
+
"branches": [
|
|
10
|
+
[
|
|
11
|
+
{
|
|
12
|
+
"id": "msg-202",
|
|
13
|
+
"type": "message"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "msg-205",
|
|
17
|
+
"type": "message"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "msg-206",
|
|
21
|
+
"type": "message"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "msg-209",
|
|
25
|
+
"type": "message"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "msg-210",
|
|
29
|
+
"type": "message"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
"id": "msg-203",
|
|
35
|
+
"type": "message"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "msg-207",
|
|
39
|
+
"type": "message"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "msg-208",
|
|
43
|
+
"type": "message"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
{
|
|
48
|
+
"id": "msg-204",
|
|
49
|
+
"type": "message"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
],
|
|
53
|
+
"id": "branch-msg-201-0",
|
|
54
|
+
"parentMessageId": "msg-201",
|
|
55
|
+
"type": "branch"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"flatList": [
|
|
59
|
+
{
|
|
60
|
+
"id": "msg-201",
|
|
61
|
+
"role": "user",
|
|
62
|
+
"content": "Write a haiku about programming",
|
|
63
|
+
"parentId": null,
|
|
64
|
+
"createdAt": 1704067200000,
|
|
65
|
+
"updatedAt": 1704067200000,
|
|
66
|
+
"meta": {},
|
|
67
|
+
"metadata": {
|
|
68
|
+
"activeBranchIndex": 1
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "msg-203",
|
|
73
|
+
"role": "assistant",
|
|
74
|
+
"content": "Functions compile,\nVariables dance in memory,\nAlgorithm sings.",
|
|
75
|
+
"parentId": "msg-201",
|
|
76
|
+
"createdAt": 1704067203100,
|
|
77
|
+
"updatedAt": 1704067203100,
|
|
78
|
+
"meta": {},
|
|
79
|
+
"metadata": {
|
|
80
|
+
"totalInputTokens": 12,
|
|
81
|
+
"totalOutputTokens": 24,
|
|
82
|
+
"totalTokens": 36,
|
|
83
|
+
"cost": 0.000108
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "msg-207",
|
|
88
|
+
"role": "user",
|
|
89
|
+
"content": "Actually, I prefer the second one with the dancing variables.",
|
|
90
|
+
"parentId": "msg-203",
|
|
91
|
+
"createdAt": 1704067225000,
|
|
92
|
+
"updatedAt": 1704067225000,
|
|
93
|
+
"meta": {}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "msg-208",
|
|
97
|
+
"role": "assistant",
|
|
98
|
+
"content": "I appreciate your feedback! The imagery of variables dancing in memory really captures the dynamic nature of programming. Would you like me to explore more haikus with that kind of vivid metaphor?",
|
|
99
|
+
"parentId": "msg-207",
|
|
100
|
+
"createdAt": 1704067227000,
|
|
101
|
+
"updatedAt": 1704067227000,
|
|
102
|
+
"meta": {},
|
|
103
|
+
"metadata": {
|
|
104
|
+
"totalInputTokens": 48,
|
|
105
|
+
"totalOutputTokens": 52,
|
|
106
|
+
"totalTokens": 100,
|
|
107
|
+
"cost": 0.0003
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"messageMap": {
|
|
112
|
+
"msg-201": {
|
|
113
|
+
"id": "msg-201",
|
|
114
|
+
"role": "user",
|
|
115
|
+
"content": "Write a haiku about programming",
|
|
116
|
+
"parentId": null,
|
|
117
|
+
"createdAt": 1704067200000,
|
|
118
|
+
"updatedAt": 1704067200000,
|
|
119
|
+
"meta": {},
|
|
120
|
+
"metadata": {
|
|
121
|
+
"activeBranchIndex": 1
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"msg-202": {
|
|
125
|
+
"id": "msg-202",
|
|
126
|
+
"role": "assistant",
|
|
127
|
+
"content": "Code flows like water,\nBugs hide in silent shadows,\nDebug brings the light.",
|
|
128
|
+
"parentId": "msg-201",
|
|
129
|
+
"createdAt": 1704067203000,
|
|
130
|
+
"updatedAt": 1704067203000,
|
|
131
|
+
"meta": {},
|
|
132
|
+
"metadata": {
|
|
133
|
+
"totalInputTokens": 12,
|
|
134
|
+
"totalOutputTokens": 28,
|
|
135
|
+
"totalTokens": 40,
|
|
136
|
+
"cost": 0.00012
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"msg-203": {
|
|
140
|
+
"id": "msg-203",
|
|
141
|
+
"role": "assistant",
|
|
142
|
+
"content": "Functions compile,\nVariables dance in memory,\nAlgorithm sings.",
|
|
143
|
+
"parentId": "msg-201",
|
|
144
|
+
"createdAt": 1704067203100,
|
|
145
|
+
"updatedAt": 1704067203100,
|
|
146
|
+
"meta": {},
|
|
147
|
+
"metadata": {
|
|
148
|
+
"totalInputTokens": 12,
|
|
149
|
+
"totalOutputTokens": 24,
|
|
150
|
+
"totalTokens": 36,
|
|
151
|
+
"cost": 0.000108
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"msg-204": {
|
|
155
|
+
"id": "msg-204",
|
|
156
|
+
"role": "assistant",
|
|
157
|
+
"content": "Lines of logic flow,\nErrors break the peaceful code,\nTests restore the calm.",
|
|
158
|
+
"parentId": "msg-201",
|
|
159
|
+
"createdAt": 1704067203200,
|
|
160
|
+
"updatedAt": 1704067203200,
|
|
161
|
+
"meta": {},
|
|
162
|
+
"metadata": {
|
|
163
|
+
"totalInputTokens": 12,
|
|
164
|
+
"totalOutputTokens": 26,
|
|
165
|
+
"totalTokens": 38,
|
|
166
|
+
"cost": 0.000114
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"msg-205": {
|
|
170
|
+
"id": "msg-205",
|
|
171
|
+
"role": "user",
|
|
172
|
+
"content": "I like the first one best!",
|
|
173
|
+
"parentId": "msg-202",
|
|
174
|
+
"createdAt": 1704067220000,
|
|
175
|
+
"updatedAt": 1704067220000,
|
|
176
|
+
"meta": {}
|
|
177
|
+
},
|
|
178
|
+
"msg-206": {
|
|
179
|
+
"id": "msg-206",
|
|
180
|
+
"role": "assistant",
|
|
181
|
+
"content": "Thank you! I'm glad you enjoyed it. The metaphor of light revealing hidden bugs is one of my favorites. Would you like me to write more haikus on different programming topics?",
|
|
182
|
+
"parentId": "msg-205",
|
|
183
|
+
"createdAt": 1704067222000,
|
|
184
|
+
"updatedAt": 1704067222000,
|
|
185
|
+
"meta": {},
|
|
186
|
+
"metadata": {
|
|
187
|
+
"totalInputTokens": 52,
|
|
188
|
+
"totalOutputTokens": 48,
|
|
189
|
+
"totalTokens": 100,
|
|
190
|
+
"cost": 0.0003
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"msg-207": {
|
|
194
|
+
"id": "msg-207",
|
|
195
|
+
"role": "user",
|
|
196
|
+
"content": "Actually, I prefer the second one with the dancing variables.",
|
|
197
|
+
"parentId": "msg-203",
|
|
198
|
+
"createdAt": 1704067225000,
|
|
199
|
+
"updatedAt": 1704067225000,
|
|
200
|
+
"meta": {}
|
|
201
|
+
},
|
|
202
|
+
"msg-208": {
|
|
203
|
+
"id": "msg-208",
|
|
204
|
+
"role": "assistant",
|
|
205
|
+
"content": "I appreciate your feedback! The imagery of variables dancing in memory really captures the dynamic nature of programming. Would you like me to explore more haikus with that kind of vivid metaphor?",
|
|
206
|
+
"parentId": "msg-207",
|
|
207
|
+
"createdAt": 1704067227000,
|
|
208
|
+
"updatedAt": 1704067227000,
|
|
209
|
+
"meta": {},
|
|
210
|
+
"metadata": {
|
|
211
|
+
"totalInputTokens": 48,
|
|
212
|
+
"totalOutputTokens": 52,
|
|
213
|
+
"totalTokens": 100,
|
|
214
|
+
"cost": 0.0003
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"msg-209": {
|
|
218
|
+
"id": "msg-209",
|
|
219
|
+
"role": "user",
|
|
220
|
+
"content": "Yes, please write one more about debugging!",
|
|
221
|
+
"parentId": "msg-206",
|
|
222
|
+
"createdAt": 1704067230000,
|
|
223
|
+
"updatedAt": 1704067230000,
|
|
224
|
+
"meta": {}
|
|
225
|
+
},
|
|
226
|
+
"msg-210": {
|
|
227
|
+
"id": "msg-210",
|
|
228
|
+
"role": "assistant",
|
|
229
|
+
"content": "Console logs cascade,\nBreakpoints pause the racing code,\nTruth emerges clear.",
|
|
230
|
+
"parentId": "msg-209",
|
|
231
|
+
"createdAt": 1704067232000,
|
|
232
|
+
"updatedAt": 1704067232000,
|
|
233
|
+
"meta": {},
|
|
234
|
+
"metadata": {
|
|
235
|
+
"totalInputTokens": 78,
|
|
236
|
+
"totalOutputTokens": 24,
|
|
237
|
+
"totalTokens": 102,
|
|
238
|
+
"cost": 0.000306
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|