mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-27 17:56:25 +02:00
feat: enhance token usage tracking in chat messages with UI integration and dropdown display
This commit is contained in:
parent
3cfe53fb7f
commit
55099a20ac
5 changed files with 137 additions and 8 deletions
|
|
@ -39,13 +39,16 @@ export function convertToThreadMessage(msg: MessageRecord): ThreadMessageLike {
|
|||
content = [{ type: "text", text: String(msg.content) }];
|
||||
}
|
||||
|
||||
const metadata = msg.author_id
|
||||
const metadata = (msg.author_id || msg.token_usage)
|
||||
? {
|
||||
custom: {
|
||||
author: {
|
||||
displayName: msg.author_display_name ?? null,
|
||||
avatarUrl: msg.author_avatar_url ?? null,
|
||||
},
|
||||
...(msg.author_id && {
|
||||
author: {
|
||||
displayName: msg.author_display_name ?? null,
|
||||
avatarUrl: msg.author_avatar_url ?? null,
|
||||
},
|
||||
}),
|
||||
...(msg.token_usage && { usage: msg.token_usage }),
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue