Browse Source

合并冲突

kobe6258 2 ngày trước cách đây
mục cha
commit
4764acbcc3

+ 6 - 8
utils/llm/eta_llm/eta_llm_client.go

@@ -102,20 +102,18 @@ func (ds *ETALLMClient) DocumentChat(query string, KnowledgeId string, history [
 	return ds.DoStreamPost(DOCUMENT_CHAT_API, body)
 }
 
-
 func (ds *ETALLMClient) KnowledgeBaseChat(query string, KnowledgeBaseName string, history []json.RawMessage) (llmRes *http.Response, err error) {
 	ChatHistory := make([]eta_llm_http.HistoryContent, 0)
 	for _, historyItemStr := range history {
-		var historyMap = make(map[string]string, 2)
-		parseErr := json.Unmarshal(historyItemStr, &historyMap)
+		var historyItem eta_llm_http.HistoryContentWeb
+		parseErr := json.Unmarshal(historyItemStr, &historyItem)
 		if parseErr != nil {
 			continue
 		}
-		historyItem := eta_llm_http.HistoryContent{
-			Role:    historyMap["Role"],
-			Content: historyMap["Content"],
-		}
-		ChatHistory = append(ChatHistory, historyItem)
+		ChatHistory = append(ChatHistory, eta_llm_http.HistoryContent{
+			Content: historyItem.Content,
+			Role:    historyItem.Role,
+		})
 	}
 	kbReq := eta_llm_http.KbChatRequest{
 		Query:          query,

+ 4 - 1
utils/llm/eta_llm/eta_llm_http/request.go

@@ -30,7 +30,10 @@ type HistoryContent struct {
 	Content string `json:"content"`
 	Role    string `json:"role"`
 }
-
+type HistoryContentWeb struct {
+	Content string `json:"Content"`
+	Role    string `json:"Role"`
+}
 type KbSearchDocsRequest struct {
 	Query             string      `json:"query"`
 	KnowledgeBaseName string      `json:"knowledge_base_name"`