- Introduced a new POST endpoint `/completions/:context_id/append` to allow appending messages to ongoing chat completions. - Implemented `GinAppendMessages` function to handle request validation, including context ID and message requirements. - Added `AppendMessagesRequest` struct to define the request body format, ensuring proper handling of interrupt types and messages. - Enhanced error responses for invalid requests to improve user feedback and debugging capabilities.
10 lines
434 B
Go
10 lines
434 B
Go
package chat
|
|
|
|
import "github.com/yaoapp/yao/agent/context"
|
|
|
|
// AppendMessagesRequest represents the request body for appending messages to running completion
|
|
type AppendMessagesRequest struct {
|
|
Type context.InterruptType `json:"type" binding:"required"` // Interrupt type: "graceful" or "force"
|
|
Messages []context.Message `json:"messages" binding:"required"`
|
|
Metadata map[string]interface{} `json:"metadata,omitempty"`
|
|
}
|