|
@@ -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{
|