fix(chat): a stopped turn shows in its conversation, and the composer field draws no box of its own
This commit is contained in:
2 files changed
+8
-4
No files matched your search
@@ -220,7 +220,7 @@ function onKeydown(event: KeyboardEvent): void {
|
||||
aria-controls="slash-palette"
|
||||
:aria-expanded="isCommandMenuOpen && commandMatches.length ? 'true' : 'false'"
|
||||
:aria-activedescendant="isCommandMenuOpen && commandMatches.length ? `slash-palette-option-${commandSelection}` : undefined"
|
||||
class="max-h-40 min-h-11 flex-1 resize-none border-0 bg-transparent! px-0 py-1 text-label focus-visible:ring-0"
|
||||
class="max-h-40 min-h-11 flex-1 resize-none rounded-none border-0 bg-transparent! px-0 py-1 text-label shadow-none focus-visible:ring-0"
|
||||
@input="onInput"
|
||||
@keydown="onKeydown"
|
||||
/>
|
||||
|
||||
@@ -353,12 +353,13 @@ async function readTranscript(id: string): Promise<ChatMessage[]> {
|
||||
api.chatTurns<ChatTurnView[]>(id),
|
||||
]);
|
||||
const byAssistantMessage = new Map<string, ChatTurnView>();
|
||||
// A failed turn records no reply, so its error follows the message it failed on.
|
||||
// A failed or stopped turn records no reply, so what happened follows the
|
||||
// message it was answering.
|
||||
const failedByInput = new Map<string, ChatTurnView>();
|
||||
for (const turn of turns || []) {
|
||||
const assistantID = turn.assistant_message_id || turn.AssistantMessageID;
|
||||
if (assistantID) byAssistantMessage.set(assistantID, turn);
|
||||
else if (turn.status === "failed" && turn.input_message_id)
|
||||
else if ((turn.status === "failed" || turn.status === "cancelled") && turn.input_message_id)
|
||||
failedByInput.set(turn.input_message_id, turn);
|
||||
}
|
||||
return (msgs || []).flatMap((message) => {
|
||||
@@ -370,7 +371,10 @@ async function readTranscript(id: string): Promise<ChatMessage[]> {
|
||||
message,
|
||||
{
|
||||
from: "assistant",
|
||||
text: `Unable to complete that turn: ${failed.error || "unknown error"}`,
|
||||
text:
|
||||
failed.status === "cancelled"
|
||||
? "Stopped before replying."
|
||||
: `Unable to complete that turn: ${failed.error || "unknown error"}`,
|
||||
tool_calls: failed.tool_calls || [],
|
||||
},
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user