chore(addon/aikefu): 更新文档说明及功能

This commit is contained in:
2025-12-06 16:57:33 +08:00
parent 6a44d27fd3
commit 7d3d71e0e3
3 changed files with 29 additions and 474 deletions

View File

@@ -30,7 +30,7 @@
### 1. 系统健康检查
**接口地址**`/api/health`
**接口地址**`/api/kefu/health`
**请求方式**GET
@@ -106,7 +106,7 @@
### 2. 获取服务配置信息
**接口地址**`/api/info`
**接口地址**`/api/kefu/info`
**请求方式**GET
@@ -146,13 +146,13 @@
}
},
"endpoints": {
"chat": "/api/chat",
"chat_stream": "/api/chatStream",
"create_conversation": "/api/createConversation",
"get_history": "/api/getHistory",
"clear_conversation": "/api/clearConversation",
"health": "/api/health",
"info": "/api/info"
"chat": "/api/kefu/chat",
"chat_stream": "/api/kefu/chatStream",
"create_conversation": "/api/kefu/createConversation",
"get_history": "/api/kefu/getHistory",
"clear_conversation": "/api/kefu/clearConversation",
"health": "/api/kefu/health",
"info": "/api/kefu/info"
},
"api_config": {
"base_url": "https://api.dify.ai/v1",
@@ -181,7 +181,7 @@
### 3. 智能客服聊天接口
**接口地址**`/api/chat`
**接口地址**`/api/kefu/chat`
**请求方式**POST
@@ -219,11 +219,11 @@
### 4. 智能客服流式聊天接口
**接口地址**`/api/chatStream`
**接口地址**`/api/kefu/chatStream`
**请求方式**POST
**请求参数**:同 `/api/chat` 接口
**请求参数**:同 `/api/kefu/chat` 接口
**响应格式**Server-Sent Events (SSE)
@@ -284,7 +284,7 @@ data: {
### 5. 创建新会话
**接口地址**`/api/createConversation`
**接口地址**`/api/kefu/createConversation`
**请求方式**POST
@@ -313,7 +313,7 @@ data: {
### 6. 获取会话历史
**接口地址**`/api/getHistory`
**接口地址**`/api/kefu/getHistory`
**请求方式**POST
@@ -359,7 +359,7 @@ data: {
### 7. 清除会话历史
**接口地址**`/api/clearConversation`
**接口地址**`/api/kefu/clearConversation`
**请求方式**POST
@@ -398,7 +398,7 @@ import { request } from '@/utils/request';
async function getAIInfo() {
try {
const res = await request({
url: '/api/info',
url: '/api/kefu/info',
method: 'GET',
data: {
uniacid: 1
@@ -423,7 +423,7 @@ async function getAIInfo() {
async function chatWithAI(message, conversationId = '') {
try {
const res = await request({
url: '/api/chat',
url: '/api/kefu/chat',
method: 'POST',
data: {
uniacid: 1,
@@ -450,7 +450,7 @@ async function chatWithAI(message, conversationId = '') {
async function chatWithAIStream(message, conversationId = '', onMessage, onComplete, onError) {
try {
const response = await uni.request({
url: '/api/chatStream',
url: '/api/kefu/chatStream',
method: 'POST',
data: {
uniacid: 1,
@@ -490,7 +490,7 @@ async function chatWithAIStream(message, conversationId = '', onMessage, onCompl
async function createNewConversation() {
try {
const res = await request({
url: '/api/createConversation',
url: '/api/kefu/createConversation',
method: 'POST',
data: {
uniacid: 1
@@ -514,7 +514,7 @@ async function createNewConversation() {
async function getChatHistory(conversationId, limit = 20, offset = 0) {
try {
const res = await request({
url: '/api/getHistory',
url: '/api/kefu/getHistory',
method: 'POST',
data: {
uniacid: 1,
@@ -541,7 +541,7 @@ async function getChatHistory(conversationId, limit = 20, offset = 0) {
async function clearConversation(conversationId = '', userId = '') {
try {
const res = await request({
url: '/api/clearConversation',
url: '/api/kefu/clearConversation',
method: 'POST',
data: {
uniacid: 1,
@@ -566,7 +566,7 @@ async function clearConversation(conversationId = '', userId = '') {
async function checkHealth(checkType = 'full') {
try {
const res = await request({
url: '/api/health',
url: '/api/kefu/health',
method: 'GET',
data: {
uniacid: 1,