@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.
Files changed (83) hide show
  1. package/.github/workflows/test.yml +1 -0
  2. package/CHANGELOG.md +58 -0
  3. package/apps/desktop/package.json +1 -1
  4. package/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts +23 -2
  5. package/changelog/v1.json +21 -0
  6. package/docker-compose/local/.env.example +3 -0
  7. package/docs/self-hosting/server-database/docker-compose.mdx +29 -0
  8. package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +29 -0
  9. package/package.json +1 -1
  10. package/packages/const/src/hotkeys.ts +3 -3
  11. package/packages/const/src/models.ts +2 -2
  12. package/packages/const/src/utils/merge.ts +3 -3
  13. package/packages/conversation-flow/package.json +13 -0
  14. package/packages/conversation-flow/src/__tests__/fixtures/index.ts +48 -0
  15. package/packages/conversation-flow/src/__tests__/fixtures/inputs/assistant-chain-with-followup.json +56 -0
  16. package/packages/conversation-flow/src/__tests__/fixtures/inputs/assistant-with-tools.json +144 -0
  17. package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/active-index-1.json +131 -0
  18. package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/assistant-branch.json +96 -0
  19. package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/assistant-user-branch.json +123 -0
  20. package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/conversation.json +128 -0
  21. package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/index.ts +14 -0
  22. package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/nested.json +179 -0
  23. package/packages/conversation-flow/src/__tests__/fixtures/inputs/compare/index.ts +8 -0
  24. package/packages/conversation-flow/src/__tests__/fixtures/inputs/compare/simple.json +85 -0
  25. package/packages/conversation-flow/src/__tests__/fixtures/inputs/compare/with-tools.json +169 -0
  26. package/packages/conversation-flow/src/__tests__/fixtures/inputs/complex-scenario.json +107 -0
  27. package/packages/conversation-flow/src/__tests__/fixtures/inputs/index.ts +14 -0
  28. package/packages/conversation-flow/src/__tests__/fixtures/inputs/linear-conversation.json +59 -0
  29. package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistant-chain-with-followup.json +135 -0
  30. package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistant-with-tools.json +340 -0
  31. package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/active-index-1.json +242 -0
  32. package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/assistant-branch.json +208 -0
  33. package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/assistant-user-branch.json +254 -0
  34. package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/conversation.json +260 -0
  35. package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/index.ts +14 -0
  36. package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/nested.json +389 -0
  37. package/packages/conversation-flow/src/__tests__/fixtures/outputs/compare/index.ts +8 -0
  38. package/packages/conversation-flow/src/__tests__/fixtures/outputs/compare/simple.json +224 -0
  39. package/packages/conversation-flow/src/__tests__/fixtures/outputs/compare/with-tools.json +418 -0
  40. package/packages/conversation-flow/src/__tests__/fixtures/outputs/complex-scenario.json +239 -0
  41. package/packages/conversation-flow/src/__tests__/fixtures/outputs/linear-conversation.json +138 -0
  42. package/packages/conversation-flow/src/__tests__/parse.test.ts +97 -0
  43. package/packages/conversation-flow/src/index.ts +17 -0
  44. package/packages/conversation-flow/src/indexing.ts +58 -0
  45. package/packages/conversation-flow/src/parse.ts +53 -0
  46. package/packages/conversation-flow/src/structuring.ts +38 -0
  47. package/packages/conversation-flow/src/transformation/BranchResolver.ts +66 -0
  48. package/packages/conversation-flow/src/transformation/ContextTreeBuilder.ts +292 -0
  49. package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +421 -0
  50. package/packages/conversation-flow/src/transformation/MessageCollector.ts +166 -0
  51. package/packages/conversation-flow/src/transformation/MessageTransformer.ts +177 -0
  52. package/packages/conversation-flow/src/transformation/__tests__/BranchResolver.test.ts +151 -0
  53. package/packages/conversation-flow/src/transformation/__tests__/ContextTreeBuilder.test.ts +385 -0
  54. package/packages/conversation-flow/src/transformation/__tests__/FlatListBuilder.test.ts +511 -0
  55. package/packages/conversation-flow/src/transformation/__tests__/MessageCollector.test.ts +220 -0
  56. package/packages/conversation-flow/src/transformation/__tests__/MessageTransformer.test.ts +287 -0
  57. package/packages/conversation-flow/src/transformation/index.ts +78 -0
  58. package/packages/conversation-flow/src/types/contextTree.ts +65 -0
  59. package/packages/conversation-flow/src/types/flatMessageList.ts +66 -0
  60. package/packages/conversation-flow/src/types/shared.ts +63 -0
  61. package/packages/conversation-flow/src/types.ts +36 -0
  62. package/packages/conversation-flow/vitest.config.mts +10 -0
  63. package/packages/types/src/message/common/metadata.ts +5 -1
  64. package/src/app/[variants]/(main)/chat/@session/features/SessionListContent/List/Item/index.tsx +3 -4
  65. package/src/envs/__tests__/app.test.ts +47 -13
  66. package/src/envs/app.ts +6 -0
  67. package/src/server/modules/S3/index.test.ts +379 -0
  68. package/src/server/routers/async/__tests__/caller.test.ts +333 -0
  69. package/src/server/routers/async/caller.ts +2 -1
  70. package/src/server/routers/lambda/__tests__/integration/message.integration.test.ts +57 -57
  71. package/src/server/routers/lambda/message.ts +2 -2
  72. package/src/server/services/message/__tests__/index.test.ts +4 -4
  73. package/src/server/services/message/index.ts +1 -1
  74. package/src/services/message/index.ts +2 -3
  75. package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChat.test.ts +8 -8
  76. package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChatV2.test.ts +8 -8
  77. package/src/store/chat/slices/aiChat/actions/__tests__/helpers.ts +1 -1
  78. package/src/store/chat/slices/aiChat/actions/generateAIChatV2.ts +1 -1
  79. package/src/store/chat/slices/message/action.test.ts +7 -7
  80. package/src/store/chat/slices/message/action.ts +2 -2
  81. package/src/store/chat/slices/plugin/action.test.ts +7 -7
  82. package/src/store/chat/slices/plugin/action.ts +1 -1
  83. package/packages/context-engine/ARCHITECTURE.md +0 -425
@@ -0,0 +1,260 @@
1
+ {
2
+ "contextTree": [
3
+ {
4
+ "id": "msg-201",
5
+ "type": "message"
6
+ },
7
+ {
8
+ "activeBranchIndex": 0,
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
+ },
68
+ {
69
+ "id": "msg-202",
70
+ "role": "assistant",
71
+ "content": "Code flows like water,\nBugs hide in silent shadows,\nDebug brings the light.",
72
+ "parentId": "msg-201",
73
+ "createdAt": 1704067203000,
74
+ "updatedAt": 1704067203000,
75
+ "meta": {},
76
+ "metadata": {
77
+ "totalInputTokens": 12,
78
+ "totalOutputTokens": 28,
79
+ "totalTokens": 40,
80
+ "cost": 0.00012
81
+ }
82
+ },
83
+ {
84
+ "id": "msg-205",
85
+ "role": "user",
86
+ "content": "I like the first one best!",
87
+ "parentId": "msg-202",
88
+ "createdAt": 1704067220000,
89
+ "updatedAt": 1704067220000,
90
+ "meta": {}
91
+ },
92
+ {
93
+ "id": "msg-206",
94
+ "role": "assistant",
95
+ "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?",
96
+ "parentId": "msg-205",
97
+ "createdAt": 1704067222000,
98
+ "updatedAt": 1704067222000,
99
+ "meta": {},
100
+ "metadata": {
101
+ "totalInputTokens": 52,
102
+ "totalOutputTokens": 48,
103
+ "totalTokens": 100,
104
+ "cost": 0.0003
105
+ }
106
+ },
107
+ {
108
+ "id": "msg-209",
109
+ "role": "user",
110
+ "content": "Yes, please write one more about debugging!",
111
+ "parentId": "msg-206",
112
+ "createdAt": 1704067230000,
113
+ "updatedAt": 1704067230000,
114
+ "meta": {}
115
+ },
116
+ {
117
+ "id": "msg-210",
118
+ "role": "assistant",
119
+ "content": "Console logs cascade,\nBreakpoints pause the racing code,\nTruth emerges clear.",
120
+ "parentId": "msg-209",
121
+ "createdAt": 1704067232000,
122
+ "updatedAt": 1704067232000,
123
+ "meta": {},
124
+ "metadata": {
125
+ "totalInputTokens": 78,
126
+ "totalOutputTokens": 24,
127
+ "totalTokens": 102,
128
+ "cost": 0.000306
129
+ }
130
+ }
131
+ ],
132
+ "messageMap": {
133
+ "msg-201": {
134
+ "id": "msg-201",
135
+ "role": "user",
136
+ "content": "Write a haiku about programming",
137
+ "parentId": null,
138
+ "createdAt": 1704067200000,
139
+ "updatedAt": 1704067200000,
140
+ "meta": {}
141
+ },
142
+ "msg-202": {
143
+ "id": "msg-202",
144
+ "role": "assistant",
145
+ "content": "Code flows like water,\nBugs hide in silent shadows,\nDebug brings the light.",
146
+ "parentId": "msg-201",
147
+ "createdAt": 1704067203000,
148
+ "updatedAt": 1704067203000,
149
+ "meta": {},
150
+ "metadata": {
151
+ "totalInputTokens": 12,
152
+ "totalOutputTokens": 28,
153
+ "totalTokens": 40,
154
+ "cost": 0.00012
155
+ }
156
+ },
157
+ "msg-203": {
158
+ "id": "msg-203",
159
+ "role": "assistant",
160
+ "content": "Functions compile,\nVariables dance in memory,\nAlgorithm sings.",
161
+ "parentId": "msg-201",
162
+ "createdAt": 1704067203100,
163
+ "updatedAt": 1704067203100,
164
+ "meta": {},
165
+ "metadata": {
166
+ "totalInputTokens": 12,
167
+ "totalOutputTokens": 24,
168
+ "totalTokens": 36,
169
+ "cost": 0.000108
170
+ }
171
+ },
172
+ "msg-204": {
173
+ "id": "msg-204",
174
+ "role": "assistant",
175
+ "content": "Lines of logic flow,\nErrors break the peaceful code,\nTests restore the calm.",
176
+ "parentId": "msg-201",
177
+ "createdAt": 1704067203200,
178
+ "updatedAt": 1704067203200,
179
+ "meta": {},
180
+ "metadata": {
181
+ "totalInputTokens": 12,
182
+ "totalOutputTokens": 26,
183
+ "totalTokens": 38,
184
+ "cost": 0.000114
185
+ }
186
+ },
187
+ "msg-205": {
188
+ "id": "msg-205",
189
+ "role": "user",
190
+ "content": "I like the first one best!",
191
+ "parentId": "msg-202",
192
+ "createdAt": 1704067220000,
193
+ "updatedAt": 1704067220000,
194
+ "meta": {}
195
+ },
196
+ "msg-206": {
197
+ "id": "msg-206",
198
+ "role": "assistant",
199
+ "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?",
200
+ "parentId": "msg-205",
201
+ "createdAt": 1704067222000,
202
+ "updatedAt": 1704067222000,
203
+ "meta": {},
204
+ "metadata": {
205
+ "totalInputTokens": 52,
206
+ "totalOutputTokens": 48,
207
+ "totalTokens": 100,
208
+ "cost": 0.0003
209
+ }
210
+ },
211
+ "msg-207": {
212
+ "id": "msg-207",
213
+ "role": "user",
214
+ "content": "Actually, I prefer the second one with the dancing variables.",
215
+ "parentId": "msg-203",
216
+ "createdAt": 1704067225000,
217
+ "updatedAt": 1704067225000,
218
+ "meta": {}
219
+ },
220
+ "msg-208": {
221
+ "id": "msg-208",
222
+ "role": "assistant",
223
+ "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?",
224
+ "parentId": "msg-207",
225
+ "createdAt": 1704067227000,
226
+ "updatedAt": 1704067227000,
227
+ "meta": {},
228
+ "metadata": {
229
+ "totalInputTokens": 48,
230
+ "totalOutputTokens": 52,
231
+ "totalTokens": 100,
232
+ "cost": 0.0003
233
+ }
234
+ },
235
+ "msg-209": {
236
+ "id": "msg-209",
237
+ "role": "user",
238
+ "content": "Yes, please write one more about debugging!",
239
+ "parentId": "msg-206",
240
+ "createdAt": 1704067230000,
241
+ "updatedAt": 1704067230000,
242
+ "meta": {}
243
+ },
244
+ "msg-210": {
245
+ "id": "msg-210",
246
+ "role": "assistant",
247
+ "content": "Console logs cascade,\nBreakpoints pause the racing code,\nTruth emerges clear.",
248
+ "parentId": "msg-209",
249
+ "createdAt": 1704067232000,
250
+ "updatedAt": 1704067232000,
251
+ "meta": {},
252
+ "metadata": {
253
+ "totalInputTokens": 78,
254
+ "totalOutputTokens": 24,
255
+ "totalTokens": 102,
256
+ "cost": 0.000306
257
+ }
258
+ }
259
+ }
260
+ }
@@ -0,0 +1,14 @@
1
+ import type { SerializedParseResult } from '../..';
2
+ import activeIndex1 from './active-index-1.json';
3
+ import assistantBranch from './assistant-branch.json';
4
+ import assistantUserBranch from './assistant-user-branch.json';
5
+ import conversation from './conversation.json';
6
+ import nested from './nested.json';
7
+
8
+ export const branch = {
9
+ activeIndex1: activeIndex1 as unknown as SerializedParseResult,
10
+ assistantBranch: assistantBranch as unknown as SerializedParseResult,
11
+ assistantUserBranch: assistantUserBranch as unknown as SerializedParseResult,
12
+ conversation: conversation as unknown as SerializedParseResult,
13
+ nested: nested as unknown as SerializedParseResult,
14
+ };
@@ -0,0 +1,389 @@
1
+ {
2
+ "contextTree": [
3
+ {
4
+ "id": "msg-301",
5
+ "type": "message"
6
+ },
7
+ {
8
+ "activeBranchIndex": 0,
9
+ "branches": [
10
+ [
11
+ {
12
+ "id": "msg-302",
13
+ "type": "message"
14
+ },
15
+ {
16
+ "id": "msg-305",
17
+ "type": "message"
18
+ },
19
+ {
20
+ "activeBranchIndex": 1,
21
+ "branches": [
22
+ [
23
+ {
24
+ "id": "msg-306",
25
+ "type": "message"
26
+ }
27
+ ],
28
+ [
29
+ {
30
+ "id": "msg-307",
31
+ "type": "message"
32
+ },
33
+ {
34
+ "id": "msg-310",
35
+ "type": "message"
36
+ },
37
+ {
38
+ "activeBranchIndex": 0,
39
+ "branches": [
40
+ [
41
+ {
42
+ "id": "msg-311",
43
+ "type": "message"
44
+ },
45
+ {
46
+ "id": "msg-314",
47
+ "type": "message"
48
+ },
49
+ {
50
+ "activeBranchIndex": 1,
51
+ "branches": [
52
+ [
53
+ {
54
+ "id": "msg-315",
55
+ "type": "message"
56
+ }
57
+ ],
58
+ [
59
+ {
60
+ "id": "msg-316",
61
+ "type": "message"
62
+ }
63
+ ]
64
+ ],
65
+ "id": "branch-msg-314-0",
66
+ "parentMessageId": "msg-314",
67
+ "type": "branch"
68
+ }
69
+ ],
70
+ [
71
+ {
72
+ "id": "msg-312",
73
+ "type": "message"
74
+ }
75
+ ]
76
+ ],
77
+ "id": "branch-msg-310-1",
78
+ "parentMessageId": "msg-310",
79
+ "type": "branch"
80
+ }
81
+ ]
82
+ ],
83
+ "id": "branch-msg-305-2",
84
+ "parentMessageId": "msg-305",
85
+ "type": "branch"
86
+ }
87
+ ],
88
+ [
89
+ {
90
+ "id": "msg-303",
91
+ "type": "message"
92
+ }
93
+ ],
94
+ [
95
+ {
96
+ "id": "msg-304",
97
+ "type": "message"
98
+ }
99
+ ]
100
+ ],
101
+ "id": "branch-msg-301-3",
102
+ "parentMessageId": "msg-301",
103
+ "type": "branch"
104
+ }
105
+ ],
106
+ "flatList": [
107
+ {
108
+ "id": "msg-301",
109
+ "role": "user",
110
+ "content": "What's your favorite programming paradigm?",
111
+ "parentId": null,
112
+ "createdAt": 1704067200000,
113
+ "updatedAt": 1704067200000,
114
+ "meta": {}
115
+ },
116
+ {
117
+ "id": "msg-302",
118
+ "role": "assistant",
119
+ "content": "I appreciate functional programming for its elegance.",
120
+ "parentId": "msg-301",
121
+ "createdAt": 1704067202000,
122
+ "updatedAt": 1704067202000,
123
+ "meta": {},
124
+ "metadata": {
125
+ "totalInputTokens": 10,
126
+ "totalOutputTokens": 15,
127
+ "totalTokens": 25,
128
+ "cost": 0.00008
129
+ }
130
+ },
131
+ {
132
+ "id": "msg-305",
133
+ "role": "user",
134
+ "content": "Can you explain more about functional programming?",
135
+ "parentId": "msg-302",
136
+ "createdAt": 1704067210000,
137
+ "updatedAt": 1704067210000,
138
+ "meta": {},
139
+ "metadata": {
140
+ "activeBranchIndex": 1
141
+ }
142
+ },
143
+ {
144
+ "id": "msg-307",
145
+ "role": "assistant",
146
+ "content": "In functional programming, functions are first-class citizens and side effects are minimized.",
147
+ "parentId": "msg-305",
148
+ "createdAt": 1704067212100,
149
+ "updatedAt": 1704067212100,
150
+ "meta": {},
151
+ "metadata": {
152
+ "totalInputTokens": 30,
153
+ "totalOutputTokens": 22,
154
+ "totalTokens": 52,
155
+ "cost": 0.00016
156
+ }
157
+ },
158
+ {
159
+ "id": "msg-310",
160
+ "role": "user",
161
+ "content": "What are some benefits of immutability?",
162
+ "parentId": "msg-307",
163
+ "createdAt": 1704067220000,
164
+ "updatedAt": 1704067220000,
165
+ "meta": {}
166
+ },
167
+ {
168
+ "id": "msg-311",
169
+ "role": "assistant",
170
+ "content": "Immutability prevents bugs from unexpected data changes.",
171
+ "parentId": "msg-310",
172
+ "createdAt": 1704067222000,
173
+ "updatedAt": 1704067222000,
174
+ "meta": {},
175
+ "metadata": {
176
+ "totalInputTokens": 55,
177
+ "totalOutputTokens": 16,
178
+ "totalTokens": 71,
179
+ "cost": 0.00021
180
+ }
181
+ },
182
+ {
183
+ "id": "msg-314",
184
+ "role": "user",
185
+ "content": "Can you give me an example?",
186
+ "parentId": "msg-311",
187
+ "createdAt": 1704067230000,
188
+ "updatedAt": 1704067230000,
189
+ "meta": {},
190
+ "metadata": {
191
+ "activeBranchIndex": 1
192
+ }
193
+ },
194
+ {
195
+ "id": "msg-316",
196
+ "role": "assistant",
197
+ "content": "Here's a better example: Instead of mutating an array with push(), functional programming uses methods like concat() or the spread operator to create new arrays.",
198
+ "parentId": "msg-314",
199
+ "createdAt": 1704067232100,
200
+ "updatedAt": 1704067232100,
201
+ "meta": {},
202
+ "metadata": {
203
+ "totalInputTokens": 75,
204
+ "totalOutputTokens": 42,
205
+ "totalTokens": 117,
206
+ "cost": 0.00035
207
+ }
208
+ }
209
+ ],
210
+ "messageMap": {
211
+ "msg-301": {
212
+ "id": "msg-301",
213
+ "role": "user",
214
+ "content": "What's your favorite programming paradigm?",
215
+ "parentId": null,
216
+ "createdAt": 1704067200000,
217
+ "updatedAt": 1704067200000,
218
+ "meta": {}
219
+ },
220
+ "msg-302": {
221
+ "id": "msg-302",
222
+ "role": "assistant",
223
+ "content": "I appreciate functional programming for its elegance.",
224
+ "parentId": "msg-301",
225
+ "createdAt": 1704067202000,
226
+ "updatedAt": 1704067202000,
227
+ "meta": {},
228
+ "metadata": {
229
+ "totalInputTokens": 10,
230
+ "totalOutputTokens": 15,
231
+ "totalTokens": 25,
232
+ "cost": 0.00008
233
+ }
234
+ },
235
+ "msg-303": {
236
+ "id": "msg-303",
237
+ "role": "assistant",
238
+ "content": "Object-oriented programming offers great structure.",
239
+ "parentId": "msg-301",
240
+ "createdAt": 1704067202100,
241
+ "updatedAt": 1704067202100,
242
+ "meta": {},
243
+ "metadata": {
244
+ "totalInputTokens": 10,
245
+ "totalOutputTokens": 12,
246
+ "totalTokens": 22,
247
+ "cost": 0.00007
248
+ }
249
+ },
250
+ "msg-304": {
251
+ "id": "msg-304",
252
+ "role": "assistant",
253
+ "content": "Procedural programming is straightforward and efficient.",
254
+ "parentId": "msg-301",
255
+ "createdAt": 1704067202200,
256
+ "updatedAt": 1704067202200,
257
+ "meta": {},
258
+ "metadata": {
259
+ "totalInputTokens": 10,
260
+ "totalOutputTokens": 13,
261
+ "totalTokens": 23,
262
+ "cost": 0.000069
263
+ }
264
+ },
265
+ "msg-305": {
266
+ "id": "msg-305",
267
+ "role": "user",
268
+ "content": "Can you explain more about functional programming?",
269
+ "parentId": "msg-302",
270
+ "createdAt": 1704067210000,
271
+ "updatedAt": 1704067210000,
272
+ "meta": {},
273
+ "metadata": {
274
+ "activeBranchIndex": 1
275
+ }
276
+ },
277
+ "msg-306": {
278
+ "id": "msg-306",
279
+ "role": "assistant",
280
+ "content": "Functional programming focuses on pure functions and immutability.",
281
+ "parentId": "msg-305",
282
+ "createdAt": 1704067212000,
283
+ "updatedAt": 1704067212000,
284
+ "meta": {},
285
+ "metadata": {
286
+ "totalInputTokens": 30,
287
+ "totalOutputTokens": 18,
288
+ "totalTokens": 48,
289
+ "cost": 0.00014
290
+ }
291
+ },
292
+ "msg-307": {
293
+ "id": "msg-307",
294
+ "role": "assistant",
295
+ "content": "In functional programming, functions are first-class citizens and side effects are minimized.",
296
+ "parentId": "msg-305",
297
+ "createdAt": 1704067212100,
298
+ "updatedAt": 1704067212100,
299
+ "meta": {},
300
+ "metadata": {
301
+ "totalInputTokens": 30,
302
+ "totalOutputTokens": 22,
303
+ "totalTokens": 52,
304
+ "cost": 0.00016
305
+ }
306
+ },
307
+ "msg-310": {
308
+ "id": "msg-310",
309
+ "role": "user",
310
+ "content": "What are some benefits of immutability?",
311
+ "parentId": "msg-307",
312
+ "createdAt": 1704067220000,
313
+ "updatedAt": 1704067220000,
314
+ "meta": {}
315
+ },
316
+ "msg-311": {
317
+ "id": "msg-311",
318
+ "role": "assistant",
319
+ "content": "Immutability prevents bugs from unexpected data changes.",
320
+ "parentId": "msg-310",
321
+ "createdAt": 1704067222000,
322
+ "updatedAt": 1704067222000,
323
+ "meta": {},
324
+ "metadata": {
325
+ "totalInputTokens": 55,
326
+ "totalOutputTokens": 16,
327
+ "totalTokens": 71,
328
+ "cost": 0.00021
329
+ }
330
+ },
331
+ "msg-312": {
332
+ "id": "msg-312",
333
+ "role": "assistant",
334
+ "content": "It makes code easier to reason about and test.",
335
+ "parentId": "msg-310",
336
+ "createdAt": 1704067222100,
337
+ "updatedAt": 1704067222100,
338
+ "meta": {},
339
+ "metadata": {
340
+ "totalInputTokens": 55,
341
+ "totalOutputTokens": 14,
342
+ "totalTokens": 69,
343
+ "cost": 0.0002
344
+ }
345
+ },
346
+ "msg-314": {
347
+ "id": "msg-314",
348
+ "role": "user",
349
+ "content": "Can you give me an example?",
350
+ "parentId": "msg-311",
351
+ "createdAt": 1704067230000,
352
+ "updatedAt": 1704067230000,
353
+ "meta": {},
354
+ "metadata": {
355
+ "activeBranchIndex": 1
356
+ }
357
+ },
358
+ "msg-315": {
359
+ "id": "msg-315",
360
+ "role": "assistant",
361
+ "content": "Sure! In JavaScript, using `const` with arrays means you can't reassign the variable, but you can still modify the array with push/pop.",
362
+ "parentId": "msg-314",
363
+ "createdAt": 1704067232000,
364
+ "updatedAt": 1704067232000,
365
+ "meta": {},
366
+ "metadata": {
367
+ "totalInputTokens": 75,
368
+ "totalOutputTokens": 35,
369
+ "totalTokens": 110,
370
+ "cost": 0.00033
371
+ }
372
+ },
373
+ "msg-316": {
374
+ "id": "msg-316",
375
+ "role": "assistant",
376
+ "content": "Here's a better example: Instead of mutating an array with push(), functional programming uses methods like concat() or the spread operator to create new arrays.",
377
+ "parentId": "msg-314",
378
+ "createdAt": 1704067232100,
379
+ "updatedAt": 1704067232100,
380
+ "meta": {},
381
+ "metadata": {
382
+ "totalInputTokens": 75,
383
+ "totalOutputTokens": 42,
384
+ "totalTokens": 117,
385
+ "cost": 0.00035
386
+ }
387
+ }
388
+ }
389
+ }
@@ -0,0 +1,8 @@
1
+ import type { SerializedParseResult } from '../..';
2
+ import simple from './simple.json';
3
+ import withTools from './with-tools.json';
4
+
5
+ export const compare = {
6
+ simple: simple as unknown as SerializedParseResult,
7
+ withTools: withTools as unknown as SerializedParseResult,
8
+ };