Browse Source

合并冲突

kobe6258 2 days ago
parent
commit
1efaa54b20
2 changed files with 10 additions and 9 deletions
  1. 8 7
      utils/llm/eta_llm/eta_llm_client.go
  2. 2 2
      utils/llm/eta_llm/eta_llm_http/request.go

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

@@ -101,19 +101,20 @@ 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 {
-		//str := strings.Split(historyItemStr, "-")
-		//historyItem := eta_llm_http.HistoryContent{
-		//	Role:    str[0],
-		//	Content: str[1],
-		//}
-		var historyItem eta_llm_http.HistoryContent
-		parseErr := json.Unmarshal(historyItemStr, &historyItem)
+		var historyMap = make(map[string]string, 2)
+		parseErr := json.Unmarshal(historyItemStr, &historyMap)
 		if parseErr != nil {
 			continue
 		}
+		historyItem := eta_llm_http.HistoryContent{
+			Role:    historyMap["Role"],
+			Content: historyMap["Content"],
+		}
 		ChatHistory = append(ChatHistory, historyItem)
 	}
 	kbReq := eta_llm_http.KbChatRequest{

+ 2 - 2
utils/llm/eta_llm/eta_llm_http/request.go

@@ -27,8 +27,8 @@ type DocumentChatRequest struct {
 	PromptName     string           `json:"prompt_name"`
 }
 type HistoryContent struct {
-	Content string `json:"Content"`
-	Role    string `json:"Role"`
+	Content string `json:"content"`
+	Role    string `json:"role"`
 }
 
 type KbSearchDocsRequest struct {