- 新增 RAG 聊天模式常量和前端字段设定 - 修改 Encounters Create 方法中的 ES 同步逻辑 - 更新 Rag ChatSSE 和 ChatWebSocket 方法,支持新的聊天模式 - 重构 NlpWebSocketResult 创建函数,使用新增的常量 - 新增 Encounter 的 TopK 方法,用于 ES 向量搜索 - 更新 DocResult 结构,实现 DocInterface 接口 - 修改 prompts.yml,增加 Diary 模式的提示模板
40 lines
854 B
Go
40 lines
854 B
Go
package model_res
|
|
|
|
import (
|
|
"catface/app/model"
|
|
"catface/app/model_es"
|
|
"time"
|
|
)
|
|
|
|
// INFO 由于直接放到 model 中会导致循环引用,所以放到 model_res 中
|
|
func NewDocResult(doc *model.Doc, doc_es *model_es.Doc) *DocResult {
|
|
return &DocResult{
|
|
DocBase: DocBase{Type: "doc"},
|
|
Id: doc.Id,
|
|
Name: doc.Name,
|
|
Content: doc_es.Content,
|
|
UpdatedAt: doc.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
type DocResult struct {
|
|
DocBase
|
|
Id int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Content string `json:"content"`
|
|
UpdatedAt *time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// GetType implements DocInterface.
|
|
func (d DocResult) GetType() string {
|
|
panic("unimplemented")
|
|
}
|
|
|
|
/**
|
|
* @description: 实现 DocInterface 接口,输出作为 LLM 的参考内容。
|
|
* @return {*}
|
|
*/
|
|
func (d DocResult) ToString() string {
|
|
return d.Content
|
|
}
|