目标
AnythingLLM是一个图形化的工具,想要在项目中使用,就必须使用API调用。
好在AnythingLLM提供了这样的工具。
官方文档
API Access and Keys | AnythingLLM by Mintplex Labs
申请API-KEY
创建新的API-KEY
访问Swagger
访问本地的http://localhost:3001/api/docs/ 可以查询到官方的文档。
测试API
点击左上角的Authorize进行认证,API key是作为请求头传入的。
找到工作空间的进行POST的Chat
得到了这样的响应:
可以看到成功发挥了AnythingLLM的查询文档功能。
{
"id": "63dd7a4b-45f9-4b29-84be-74a0119f85e6",
"type": "textResponse",
"close": true,
"error": null,
"chatId": 17,
"textResponse": "ECharts is a powerful, open-source JavaScript visualization library that offers flexible chart types, robust rendering engines, and professional data analysis capabilities. It allows developers to create dynamic, interactive visualizations for web applications using various charts such as line charts, bar charts, scatter plots, pie charts, and more. ECharts supports customization in terms of appearance, layout, and interactivity, making it suitable for a wide range of uses from simple dashboards to complex data analysis tools.",
"sources": [
{
"id": "5be5be5f-a394-41b0-a47e-1db35c9fc8ce",
"url": "file://C:\\Users\\81067\\AppData\\Roaming\\anythingllm-desktop\\storage\\hotdir\\echarts使用 英文文档.docx",
"title": "echarts使用 英文文档.docx",
"docAuthor": "no author found",
"description": "No description found.",
"docSource": "pdf file uploaded by the user.",
"chunkSource": "",
"published": "2024/6/23 12:24:49",
"wordCount": 871,
"token_count_estimate": 904,
"text": "<document_metadata>\nsourceDocument: echarts使用 英文文档.docx\npublished: 2024/6/23 12:24:49\n</document_metadata>\n\nECh