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