From 250ccd828ddd25eb46887eb6d17b740d1aa5effc Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 25 Jan 2024 14:38:21 -0800 Subject: [PATCH] fix: openai compatible api rag issue --- src/routes/(app)/+page.svelte | 2 +- src/routes/(app)/c/[id]/+page.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index 00a7aae34..eebf7743a 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -519,7 +519,7 @@ .filter((message) => message) .map((message, idx, arr) => ({ role: message.role, - ...(message.files.filter((file) => file.type === 'image') + ...(message.files?.filter((file) => file.type === 'image').length > 0 ?? false ? { content: [ { diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 5b08c4c35..c161435df 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -530,7 +530,7 @@ .filter((message) => message) .map((message, idx, arr) => ({ role: message.role, - ...(message.files.filter((file) => file.type === 'image') + ...(message.files?.filter((file) => file.type === 'image').length > 0 ?? false ? { content: [ {