SimpleChatTC:Load allows old and new ChatMessage(Ex) formats
This commit is contained in:
parent
475858a4b3
commit
2ef201ff8d
|
|
@ -224,8 +224,13 @@ class SimpleChat {
|
||||||
this.iLastSys = ods.iLastSys;
|
this.iLastSys = ods.iLastSys;
|
||||||
this.xchat = [];
|
this.xchat = [];
|
||||||
for (const cur of ods.xchat) {
|
for (const cur of ods.xchat) {
|
||||||
// TODO: May have to account for missing fields
|
if (cur.ns == undefined) {
|
||||||
this.xchat.push(new ChatMessageEx(cur.ns.role, cur.ns.content, cur.ns.tool_calls, cur.trimmedContent))
|
/** @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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue