Commit d9316079 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac: files

parent b4bdea6d
...@@ -586,19 +586,19 @@ ...@@ -586,19 +586,19 @@
} }
}); });
let docs = []; let files = [];
if (model?.info?.meta?.knowledge ?? false) { if (model?.info?.meta?.knowledge ?? false) {
docs = model.info.meta.knowledge; files = model.info.meta.knowledge;
} }
docs = [ files = [
...docs, ...files,
...messages ...messages
.filter((message) => message?.files ?? null) .filter((message) => message?.files ?? null)
.map((message) => .map((message) =>
message.files.filter((item) => message.files.filter((item) =>
['doc', 'collection', 'web_search_results'].includes(item.type) ['doc', 'file', 'collection', 'web_search_results'].includes(item.type)
) )
) )
.flat(1) .flat(1)
...@@ -634,8 +634,8 @@ ...@@ -634,8 +634,8 @@
format: $settings.requestFormat ?? undefined, format: $settings.requestFormat ?? undefined,
keep_alive: $settings.keepAlive ?? undefined, keep_alive: $settings.keepAlive ?? undefined,
tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined, tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined,
docs: docs.length > 0 ? docs : undefined, files: files.length > 0 ? files : undefined,
citations: docs.length > 0, citations: files.length > 0,
chat_id: $chatId chat_id: $chatId
}); });
...@@ -831,19 +831,19 @@ ...@@ -831,19 +831,19 @@
let _response = null; let _response = null;
const responseMessage = history.messages[responseMessageId]; const responseMessage = history.messages[responseMessageId];
let docs = []; let files = [];
if (model?.info?.meta?.knowledge ?? false) { if (model?.info?.meta?.knowledge ?? false) {
docs = model.info.meta.knowledge; files = model.info.meta.knowledge;
} }
docs = [ files = [
...docs, ...files,
...messages ...messages
.filter((message) => message?.files ?? null) .filter((message) => message?.files ?? null)
.map((message) => .map((message) =>
message.files.filter((item) => message.files.filter((item) =>
['doc', 'collection', 'web_search_results'].includes(item.type) ['doc', 'file', 'collection', 'web_search_results'].includes(item.type)
) )
) )
.flat(1) .flat(1)
...@@ -937,8 +937,8 @@ ...@@ -937,8 +937,8 @@
frequency_penalty: $settings?.params?.frequency_penalty ?? undefined, frequency_penalty: $settings?.params?.frequency_penalty ?? undefined,
max_tokens: $settings?.params?.max_tokens ?? undefined, max_tokens: $settings?.params?.max_tokens ?? undefined,
tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined, tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined,
docs: docs.length > 0 ? docs : undefined, files: files.length > 0 ? files : undefined,
citations: docs.length > 0, citations: files.length > 0,
chat_id: $chatId chat_id: $chatId
}, },
`${OPENAI_API_BASE_URL}` `${OPENAI_API_BASE_URL}`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment