MCPcopy Index your code
hub / github.com/apache/answer / sendErrorResponse

Method sendErrorResponse

internal/controller/ai_controller.go:653–670  ·  view source on GitHub ↗

sendErrorResponse send error response in stream

(w http.ResponseWriter, id, model, errorMsg string)

Source from the content-addressed store, hash-verified

651
652// sendErrorResponse send error response in stream
653func (c *AIController) sendErrorResponse(w http.ResponseWriter, id, model, errorMsg string) {
654 errorResponse := StreamResponse{
655 ChatCompletionID: id,
656 Object: "chat.completion.chunk",
657 Created: time.Now().Unix(),
658 Model: model,
659 Choices: []StreamChoice{
660 {
661 Index: 0,
662 Delta: Delta{
663 Content: fmt.Sprintf("Error: %s", errorMsg),
664 },
665 FinishReason: nil,
666 },
667 },
668 }
669 sendStreamData(w, errorResponse)
670}
671
672// getMCPTools
673func (c *AIController) getMCPTools() []openai.Tool {

Callers 2

ChatCompletionsMethod · 0.95
processAIStreamMethod · 0.95

Calls 1

sendStreamDataFunction · 0.85

Tested by

no test coverage detected