Skip to content

Commit 45bc9cf

Browse files
committed
perf: add chat model
1 parent a7daa31 commit 45bc9cf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/httpd/chat.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func (h *chat) getOrCreateConversation(msg *Message) (*AIConversation, error) {
7676
conv := &AIConversation{
7777
Id: jmsSrv.Session.ID,
7878
Prompt: msg.Prompt,
79+
Model: msg.ChatModel,
7980
Context: make([]QARecord, 0),
8081
JMSServer: jmsSrv,
8182
}
@@ -106,11 +107,16 @@ func (h *chat) runChat(conv *AIConversation) {
106107
}
107108
messages := buildChatMessages(conv)
108109

110+
chatModel := conv.Model
111+
if conv.Model == "" {
112+
chatModel = h.term.GptModel
113+
}
114+
109115
conn := &srvconn.OpenAIConn{
110116
Id: conv.Id,
111117
Client: client,
112118
Prompt: conv.Prompt,
113-
Model: h.term.GptModel,
119+
Model: chatModel,
114120
Question: conv.Question,
115121
Context: messages,
116122
AnswerCh: make(chan string),

pkg/httpd/message.go

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Message struct {
1919
//Chat AI
2020
Prompt string `json:"prompt"`
2121
Interrupt bool `json:"interrupt"`
22+
ChatModel string `json:"chat_model"`
2223

2324
//K8s
2425
KubernetesId string `json:"k8s_id"`
@@ -173,6 +174,7 @@ type AIConversation struct {
173174
Id string
174175
Prompt string
175176
Question string
177+
Model string
176178
Context []QARecord
177179
JMSServer *proxy.ChatJMSServer
178180
InterruptCurrentChat bool

0 commit comments

Comments
 (0)