Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
55b7c300
Commit
55b7c300
authored
Jul 04, 2024
by
Michael Poluektov
Browse files
simplify citation API
parent
05277556
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/lib/components/chat/Chat.svelte
src/lib/components/chat/Chat.svelte
+8
-3
No files found.
src/lib/components/chat/Chat.svelte
View file @
55b7c300
...
@@ -139,7 +139,7 @@
...
@@ -139,7 +139,7 @@
return;
return;
}
}
const status_keys = ["done", "description"];
const status_keys = ["done", "description"];
const citation_keys = ["document", "
metadata", "sourc
e"];
const citation_keys = ["document", "
url", "titl
e"];
if (type === "status" && status_keys.every(key => key in payload)) {
if (type === "status" && status_keys.every(key => key in payload)) {
if (message.statusHistory) {
if (message.statusHistory) {
message.statusHistory.push(payload);
message.statusHistory.push(payload);
...
@@ -147,10 +147,15 @@
...
@@ -147,10 +147,15 @@
message.statusHistory = [payload];
message.statusHistory = [payload];
}
}
} else if (type === "citation" && citation_keys.every(key => key in payload)) {
} else if (type === "citation" && citation_keys.every(key => key in payload)) {
const citation = {
document: [payload.document],
metadata: [{source: payload.url}],
source: {name: payload.title}
};
if (message.citations) {
if (message.citations) {
message.citations.push(
payload
);
message.citations.push(
citation
);
} else {
} else {
message.citations = [
payload
];
message.citations = [
citation
];
}
}
} else {
} else {
console.log("Unknown message type", data);
console.log("Unknown message type", data);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment