mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 06:04:15 +00:00
Fix /copy after aborts
This commit is contained in:
parent
c193ef74d2
commit
e30c4e30cb
1 changed files with 7 additions and 1 deletions
|
|
@ -1525,7 +1525,13 @@ export class AgentSession {
|
||||||
const lastAssistant = this.messages
|
const lastAssistant = this.messages
|
||||||
.slice()
|
.slice()
|
||||||
.reverse()
|
.reverse()
|
||||||
.find((m) => m.role === "assistant");
|
.find((m) => {
|
||||||
|
if (m.role !== "assistant") return false;
|
||||||
|
const msg = m as AssistantMessage;
|
||||||
|
// Skip aborted messages with no content
|
||||||
|
if (msg.stopReason === "aborted" && msg.content.length === 0) return false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
if (!lastAssistant) return null;
|
if (!lastAssistant) return null;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue