SimpleChatTC:Load allows old and new ChatMessage(Ex) formats
This commit is contained in:
parent
475858a4b3
commit
2ef201ff8d
|
|
@ -224,10 +224,15 @@ class SimpleChat {
|
|||
this.iLastSys = ods.iLastSys;
|
||||
this.xchat = [];
|
||||
for (const cur of ods.xchat) {
|
||||
// TODO: May have to account for missing fields
|
||||
if (cur.ns == undefined) {
|
||||
/** @typedef {{role: string, content: string}} OldChatMessage */
|
||||
let tcur = /** @type {OldChatMessage} */(/** @type {unknown} */(cur));
|
||||
this.xchat.push(new ChatMessageEx(tcur.role, tcur.content))
|
||||
} else {
|
||||
this.xchat.push(new ChatMessageEx(cur.ns.role, cur.ns.content, cur.ns.tool_calls, cur.trimmedContent))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recent chat messages.
|
||||
|
|
|
|||
Loading…
Reference in New Issue