Refactor conversation pkg done

This commit is contained in:
dwrz
2026-10-30 02:01:51 +00:00
parent 7d8f8f1b2a
commit 05b61f81de
2 changed files with 17 additions and 13 deletions
+7 -3
View File
@@ -190,9 +190,9 @@ type AssistantUpdate struct {
func (AssistantUpdate) Type() EventType { return EventAssistantUpdate }
// Done reports that the Inference the subscriber joined has returned.
// Err is nil on success.
// Error is empty on success.
type Done struct {
Err error `json:"err"`
Error string `json:"error,omitempty"`
}
func (Done) Type() EventType { return EventDone }
@@ -297,7 +297,11 @@ func (inf *Inference) follow(
}
}
if done {
return send(ctx, ch, Done{Err: err})
var errStr string
if err != nil {
errStr = err.Error()
}
return send(ctx, ch, Done{Error: errStr})
}
// Wait for the call to close wait (when it appends new
// events or finishes), or for the subscriber to cancel ctx.