sendErrorResponse send error response in stream
(w http.ResponseWriter, id, model, errorMsg string)
| 651 | |
| 652 | // sendErrorResponse send error response in stream |
| 653 | func (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 |
| 673 | func (c *AIController) getMCPTools() []openai.Tool { |
no test coverage detected