Enhance message handling in OpenAI adapter to skip non-delta "done" messages
- Added logic to ignore "done" messages that are not delta updates, ensuring that final confirmation messages are not sent to OpenAI clients, which rely on finish_reason instead.
This commit is contained in:
parent
b43929210e
commit
fa95f32db7
1 changed files with 7 additions and 0 deletions
|
|
@ -68,6 +68,13 @@ func (a *Adapter) Adapt(msg *message.Message) ([]interface{}, error) {
|
|||
return []interface{}{}, nil // Return empty array, nothing to send
|
||||
}
|
||||
|
||||
// Skip "done" messages that are not delta updates
|
||||
// These are final confirmation messages for CUI clients
|
||||
// OpenAI clients don't need them - they use finish_reason instead
|
||||
if msg.Done && !msg.Delta {
|
||||
return []interface{}{}, nil // Return empty array, nothing to send
|
||||
}
|
||||
|
||||
// Get converter for this message type
|
||||
converter, exists := a.registry.GetConverter(msg.Type)
|
||||
if !exists {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue