3.4 KiB
3.4 KiB
> 简体中文 < | English
结构
每一个服务都放在 ./node 中,根据各自的 readme 分别配置。
你需要准备的环境变量:
export DEEPSEEK_API_TOKEN=xxx
export OMCP_DISCORD_SERVER_IP=xxx
export OMCP_DISCORD_SERVER_PORT=xxx
export OMCP_DISCORD_TOKEN=xxx
架构
graph TB
core(Lagrage.Core)
onebot(Lagrange.onebot)
vecdb(vecdb)
llm(LLM)
intent(intent tree)
core(Lagrange.Core) --> onebot(Lagrange.onebot)
onebot -->|query| intent
intent -->|intent| onebot
subgraph Intent Recognition
intent -->|query| vecdb
vecdb -->|ktop| intent
intent -->|ktop,query| llm
llm -->|intent| intent
end
subgraph execution
onebot --> command{intent}
command --> query
command --> upload
command --> ...
end
subgraph third party
LLM
Google
server
end
query --> LLM
query --> Google
upload --> server
Lagrange.onebot
--> 📁botvecdb
--> 📁ragintent tree
--> 📁prompt
接口规范
http 接口满足 HttpResponse
所示。
interface HttpResponse<T> {
code: number,
data: CommonResponse<T>
}
interface CommonResponse<T> {
code: number,
data?: T,
msg?: string
}
开发须知
- 非必要,请不要随意宣传本项目。
- 虽然曾经无数个 QQ 相关的项目都死了,但是基本的 API 端口算是传承了下来。拉格朗日的返回类型,请参考 go-cqhttp 帮助中心 - API 篇 中的内容。
启动
# 1. 启动 拉格朗日
tsc
pm2 start dist/main.js --name Lagrange.onebot
pm2 start rag/main.py --name rag
测试命令
重训练 embedding -> intent 分类层
curl -X POST http://127.0.0.1:8081/intent/retrain-embedding-mapping
获取意图
curl -X POST -H "Content-Type: application/json" -d '{"query": "真的开线程是要tcl指令去改的"}' http://127.0.0.1:8081/intent/get-intent-recogition
获取向量数据库中的 topk
curl -X POST -H "Content-Type: application/json" -d '{"query": "这个插件有什么比较好的文档吗?"}' http://127.0.0.1:8081/vecdb/similarity_search_with_score