Skip to content

Commit b6698ff

Browse files
Persist images attached in API requests to the UI for rendering (#3546)
Persist images attached in API requests to the UI for rendereing resolves #3518
1 parent 4d06884 commit b6698ff

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

server/utils/chats/apiChatHandler.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ async function chatSync({
115115
response: {
116116
text: textResponse,
117117
sources: [],
118+
attachments,
118119
type: chatMode,
119120
thoughts,
120121
},
@@ -155,6 +156,7 @@ async function chatSync({
155156
response: {
156157
text: textResponse,
157158
sources: [],
159+
attachments: attachments,
158160
type: chatMode,
159161
metrics: {},
160162
},
@@ -267,6 +269,7 @@ async function chatSync({
267269
response: {
268270
text: textResponse,
269271
sources: [],
272+
attachments: attachments,
270273
type: chatMode,
271274
metrics: {},
272275
},
@@ -324,6 +327,7 @@ async function chatSync({
324327
response: {
325328
text: textResponse,
326329
sources,
330+
attachments,
327331
type: chatMode,
328332
metrics: performanceMetrics,
329333
},
@@ -437,6 +441,7 @@ async function streamChat({
437441
response: {
438442
text: textResponse,
439443
sources: [],
444+
attachments: attachments,
440445
type: chatMode,
441446
thoughts,
442447
},
@@ -486,8 +491,8 @@ async function streamChat({
486491
response: {
487492
text: textResponse,
488493
sources: [],
494+
attachments: attachments,
489495
type: chatMode,
490-
attachments: [],
491496
metrics: {},
492497
},
493498
threadId: thread?.id || null,
@@ -610,8 +615,8 @@ async function streamChat({
610615
response: {
611616
text: textResponse,
612617
sources: [],
618+
attachments: attachments,
613619
type: chatMode,
614-
attachments: [],
615620
metrics: {},
616621
},
617622
threadId: thread?.id || null,
@@ -671,7 +676,13 @@ async function streamChat({
671676
const { chat } = await WorkspaceChats.new({
672677
workspaceId: workspace.id,
673678
prompt: message,
674-
response: { text: completeText, sources, type: chatMode, metrics },
679+
response: {
680+
text: completeText,
681+
sources,
682+
type: chatMode,
683+
metrics,
684+
attachments,
685+
},
675686
threadId: thread?.id || null,
676687
apiSessionId: sessionId,
677688
user,

0 commit comments

Comments
 (0)