feat(copilot): finish configuration center
This commit is contained in:
@@ -88,7 +88,7 @@ func (h *SSEStreamHandler) StreamCopilotMessage(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if h.llmProvider == nil {
|
||||
writeSSEMessage(c, "error", `{"error": "Captain is disabled", "status": 422, "done": true}`)
|
||||
writeSSEMessage(c, "error", `{"code": "COPILOT_NOT_CONFIGURED", "error": "Copilot provider is not configured", "status": 503, "done": true}`)
|
||||
writeSSEMessage(c, "done", `{"done": true}`)
|
||||
return
|
||||
}
|
||||
@@ -98,14 +98,15 @@ func (h *SSEStreamHandler) StreamCopilotMessage(c *gin.Context) {
|
||||
|
||||
// Stream from LLM using callback pattern
|
||||
streamReq := llm.ChatRequest{
|
||||
Model: "gpt-4",
|
||||
Model: "",
|
||||
Messages: chatMessages,
|
||||
Temperature: 0.7,
|
||||
MaxTokens: 1024,
|
||||
Stream: true,
|
||||
}
|
||||
|
||||
err = h.llmProvider.ChatCompletionStream(c.Request.Context(), streamReq, func(chunk llm.StreamChunk) error {
|
||||
streamCtx := llm.WithAccountFeature(c.Request.Context(), uint(accountID), "copilot")
|
||||
err = h.llmProvider.ChatCompletionStream(streamCtx, streamReq, func(chunk llm.StreamChunk) error {
|
||||
if len(chunk.Choices) > 0 {
|
||||
content := chunk.Choices[0].Delta.Content
|
||||
if content != "" {
|
||||
|
||||
Reference in New Issue
Block a user