fix: clean up
This commit is contained in:
parent
30de57993c
commit
38eb3ece2d
3 changed files with 1 additions and 6 deletions
|
|
@ -232,7 +232,6 @@ export async function executeStreaming({
|
|||
chatHistory,
|
||||
currentCompactionIndex,
|
||||
);
|
||||
const _originalLength = historyForLLM.length;
|
||||
|
||||
await streamChatResponse(
|
||||
historyForLLM,
|
||||
|
|
|
|||
|
|
@ -221,9 +221,6 @@ export function useChat({
|
|||
// Save the updated session with the latest chat history that includes the assistant's reply
|
||||
// The streamCallbacks update setChatHistory during streaming, so we need to get the current state
|
||||
setChatHistory((currentHistory) => {
|
||||
logger.debug("Saving session", {
|
||||
historyLength: currentHistory.length,
|
||||
});
|
||||
const updatedSession: Session = {
|
||||
...currentSession,
|
||||
history: currentHistory,
|
||||
|
|
@ -407,7 +404,7 @@ export function useChat({
|
|||
// Remove the last message if it's from assistant (partial response)
|
||||
setChatHistory((current) => {
|
||||
const lastMessage = current[current.length - 1];
|
||||
if (lastMessage?.message.role === "assistant") {
|
||||
if (lastMessage?.message.role === "assistant" && !lastMessage.toolCallStates?.length) {
|
||||
return current.slice(0, -1);
|
||||
}
|
||||
return current;
|
||||
|
|
|
|||
1
packages/openai-adapters/package-lock.json
generated
1
packages/openai-adapters/package-lock.json
generated
|
|
@ -12528,7 +12528,6 @@
|
|||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
|
||||
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue