-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapp_actions_diff.patch
More file actions
54 lines (47 loc) · 1.51 KB
/
app_actions_diff.patch
File metadata and controls
54 lines (47 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--- app/actions.tsx
+++ app/actions.tsx
@@ -84,7 +84,7 @@
});
messages.push({ role: 'user', content });
- const summaryStream = createStreamableValue<string>('');
+ const summaryStream = createStreamableValue<string>('Analyzing map view...');
const groupeId = nanoid();
async function processResolutionSearch() {
@@ -143,15 +143,26 @@
return m
})
+ const currentMessages = aiState.get().messages;
+ const sanitizedHistory = currentMessages.map(m => {
+ if (m.role === 'user' && Array.isArray(m.content)) {
+ return {
+ ...m,
+ content: m.content.map(part =>
+ part.type === 'image' ? { ...part, image: 'IMAGE_PROCESSED' } : part
+ )
+ } as AIMessage
+ }
+ return m
+ });
+
const relatedQueries = await querySuggestor(uiStream, sanitizedMessages);
uiStream.append(
<Section title="Follow-up">
<FollowupPanel />
</Section>
);
await new Promise(resolve => setTimeout(resolve, 500));
aiState.done({
...aiState.get(),
- messages: [
- ...aiState.get().messages,
+ messages: [
+ ...sanitizedHistory,
{
id: groupeId,
role: 'assistant',
@@ -241,7 +252,7 @@
</Section>
);
- uiStream.append(answerSection);
+ uiStream.update(answerSection);
const relatedQueries = { items: [] };