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
3928ac19
Unverified
Commit
3928ac19
authored
Jul 05, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jul 05, 2024
Browse files
Merge pull request #3615 from michaelpoluektov/citations-event
feat: Citations event via __event_emitter__
parents
45fae65e
983fe4b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
src/lib/components/chat/Chat.svelte
src/lib/components/chat/Chat.svelte
+19
-11
No files found.
src/lib/components/chat/Chat.svelte
View file @
3928ac19
...
...
@@ -126,21 +126,29 @@
})();
}
const chatEventHandler = async (
data
) => {
if (
data
.chat_id === $chatId) {
const chatEventHandler = async (
event
) => {
if (
event
.chat_id === $chatId) {
await tick();
console.log(
data
);
let message = history.messages[
data
.message_id];
console.log(
event
);
let message = history.messages[
event
.message_id];
const status = {
done: data?.data?.done ?? null,
description: data?.data?.status ?? null
};
const type = event?.data?.type ?? null;
const data = event?.data?.data ?? null;
if (message.statusHistory) {
message.statusHistory.push(status);
if (type === 'status') {
if (message.statusHistory) {
message.statusHistory.push(data);
} else {
message.statusHistory = [data];
}
} else if (type === 'citation') {
if (message.citations) {
message.citations.push(data);
} else {
message.citations = [data];
}
} else {
message.statusHistory = [status]
;
console.log('Unknown message type', data)
;
}
messages = messages;
...
...
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