Refactor conversation pkg done
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user