fix state updates
This commit is contained in:
parent
ac62fed5e8
commit
e25eceacee
2 changed files with 5 additions and 3 deletions
2
core/index.d.ts
vendored
2
core/index.d.ts
vendored
|
|
@ -276,7 +276,7 @@ export interface ToolCallDelta {
|
|||
type?: "function";
|
||||
function?: {
|
||||
name?: string;
|
||||
arguments?: string[];
|
||||
arguments?: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -273,14 +273,16 @@ export const stateSlice = createSlice({
|
|||
message: { id: "NONE", ...action.payload },
|
||||
});
|
||||
} else {
|
||||
console.log("ABC: ", action.payload);
|
||||
// Add to the existing message
|
||||
const msg = state.history[state.history.length - 1].message;
|
||||
if (action.payload.content) {
|
||||
msg.content += stripImages(action.payload.content);
|
||||
} else if (action.payload.toolCalls) {
|
||||
if (!msg.toolCalls) {
|
||||
msg.toolCalls = [];
|
||||
}
|
||||
action.payload.toolCalls.forEach((toolCall, i) => {
|
||||
if (msg.toolCalls.length < i) {
|
||||
if (msg.toolCalls.length <= i) {
|
||||
msg.toolCalls.push(toolCall);
|
||||
} else {
|
||||
msg.toolCalls[i].function.arguments +=
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue