Merge branch 'main' into main
6
.github/dependabot.yml
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: pip
|
||||||
|
directory: /main/xiaozhi-server
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
49
.github/workflows/build-base-image.yml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
name: Build Base Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'main/xiaozhi-server/requirements.txt'
|
||||||
|
- 'Dockerfile-server-base'
|
||||||
|
- '.github/workflows/build-base-image.yml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-base:
|
||||||
|
name: Build and push server base image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push server-base
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile-server-base
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/${{ github.repository }}:server-base
|
||||||
|
platforms: linux/amd64
|
||||||
|
cache-from: type=gha,scope=server-base
|
||||||
|
cache-to: type=gha,mode=max,scope=server-base
|
||||||
|
build-args: |
|
||||||
|
BUILDKIT_PROGRESS=plain
|
||||||
|
|
||||||
|
- name: Output image info
|
||||||
|
run: |
|
||||||
|
echo "✅ Base image built and pushed successfully!"
|
||||||
|
echo "📦 Tag: ghcr.io/${{ github.repository }}:server-base"
|
||||||
4
.github/workflows/docker-image.yml
vendored
|
|
@ -5,6 +5,10 @@ on:
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*' # 只在以 v 开头的标签推送时触发,例如 v1.0.0
|
- 'v*.*.*' # 只在以 v 开头的标签推送时触发,例如 v1.0.0
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Build Base Image"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,6 @@
|
||||||
# 第一阶段:构建Python依赖
|
# 生产镜像,仅包含应用代码
|
||||||
FROM python:3.10-slim AS builder
|
FROM ghcr.io/xinnan-tech/xiaozhi-esp32-server:server-base
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# 配置pip使用国内镜像源(阿里云)并设置超时和重试
|
|
||||||
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \
|
|
||||||
pip config set global.trusted-host mirrors.aliyun.com && \
|
|
||||||
pip config set global.timeout 120 && \
|
|
||||||
pip config set install.retries 5
|
|
||||||
|
|
||||||
COPY main/xiaozhi-server/requirements.txt .
|
|
||||||
|
|
||||||
# 安装Python依赖,使用并行下载
|
|
||||||
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
|
||||||
pip install --no-cache-dir -r requirements.txt --default-timeout=120 --retries 5
|
|
||||||
|
|
||||||
# 第二阶段:生产镜像
|
|
||||||
FROM python:3.10-slim
|
|
||||||
|
|
||||||
WORKDIR /opt/xiaozhi-esp32-server
|
|
||||||
|
|
||||||
# 安装系统依赖
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends libopus0 ffmpeg && \
|
|
||||||
apt-get clean && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# 从构建阶段复制Python包和前端构建产物
|
|
||||||
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
|
||||||
COPY --from=builder /usr/local/bin/mcp-proxy /usr/local/bin/mcp-proxy
|
|
||||||
|
|
||||||
# 复制应用代码
|
|
||||||
COPY main/xiaozhi-server .
|
COPY main/xiaozhi-server .
|
||||||
|
|
||||||
# 启动应用
|
# 启动应用
|
||||||
|
|
|
||||||
32
Dockerfile-server-base
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
# Dockerfile-server-base
|
||||||
|
# 基础镜像,包含系统依赖和Python包
|
||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
# 安装系统依赖
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends libopus0 ffmpeg locales && \
|
||||||
|
sed -i '/zh_CN.UTF-8/s/^# //g' /etc/locale.gen && \
|
||||||
|
locale-gen && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 配置pip使用国内镜像源(阿里云)并设置超时和重试
|
||||||
|
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \
|
||||||
|
pip config set global.trusted-host mirrors.aliyun.com && \
|
||||||
|
pip config set global.timeout 120 && \
|
||||||
|
pip config set install.retries 5
|
||||||
|
|
||||||
|
# 设置环境变量以确保正确的字符编码
|
||||||
|
ENV LANG=zh_CN.UTF-8 \
|
||||||
|
LC_ALL=zh_CN.UTF-8 \
|
||||||
|
LANGUAGE=zh_CN:zh \
|
||||||
|
PYTHONIOENCODING=utf-8
|
||||||
|
|
||||||
|
WORKDIR /opt/xiaozhi-esp32-server
|
||||||
|
|
||||||
|
# 复制requirements.txt
|
||||||
|
COPY main/xiaozhi-server/requirements.txt .
|
||||||
|
|
||||||
|
# 安装Python依赖
|
||||||
|
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
||||||
|
pip install --no-cache-dir -r requirements.txt --default-timeout=120 --retries 5
|
||||||
104
README.md
|
|
@ -6,29 +6,24 @@
|
||||||
本项目基于人机共生智能理论和技术研发智能终端软硬件体系<br/>为开源智能硬件项目
|
本项目基于人机共生智能理论和技术研发智能终端软硬件体系<br/>为开源智能硬件项目
|
||||||
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a>提供后端服务<br/>
|
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a>提供后端服务<br/>
|
||||||
根据<a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">小智通信协议</a>使用Python、Java、Vue实现<br/>
|
根据<a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">小智通信协议</a>使用Python、Java、Vue实现<br/>
|
||||||
支持MQTT+UDP协议、Websocket协议、MCP接入点、声纹识别
|
支持MQTT+UDP协议、Websocket协议、MCP接入点、声纹识别、知识库
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="./README_en.md">English</a>
|
<a href="./docs/FAQ.md">常见问题</a>
|
||||||
· <a href="./docs/FAQ.md">常见问题</a>
|
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">反馈问题</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">反馈问题</a>
|
||||||
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">部署文档</a>
|
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">部署文档</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">更新日志</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">更新日志</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DBEDFA"></a>
|
||||||
|
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
||||||
|
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
||||||
|
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors">
|
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/xinnan-tech/xiaozhi-esp32-server?logo=github" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">
|
|
||||||
<img alt="Issues" src="https://img.shields.io/github/issues/xinnan-tech/xiaozhi-esp32-server?color=0088ff" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/pulls">
|
|
||||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/xinnan-tech/xiaozhi-esp32-server?color=0088ff" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/LICENSE">
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/LICENSE">
|
||||||
<img alt="GitHub pull requests" src="https://img.shields.io/badge/license-MIT-white?labelColor=black" />
|
<img alt="GitHub pull requests" src="https://img.shields.io/badge/license-MIT-white?labelColor=black" />
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -56,10 +51,24 @@ Spearheaded by Professor Siyuan Liu's Team (South China University of Technology
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="响应速度感受" src="docs/images/demo9.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="速度优化秘诀" src="docs/images/demo6.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="小智医疗救护车场景" src="docs/images/demo1.png" />
|
<img alt="复杂医疗场景" src="docs/images/demo1.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -71,19 +80,14 @@ Spearheaded by Professor Siyuan Liu's Team (South China University of Technology
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="自定义音色" src="docs/images/demo2.png" />
|
<img alt="声纹识别" src="docs/images/demo14.png" />
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="使用粤语交流" src="docs/images/demo3.png" />
|
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
|
|
@ -91,12 +95,17 @@ Spearheaded by Professor Siyuan Liu's Team (South China University of Technology
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="自定义音色" src="docs/images/demo6.png" />
|
<img alt="MCP接入点" src="docs/images/demo13.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="多指令任务" src="docs/images/demo11.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -114,20 +123,6 @@ Spearheaded by Professor Siyuan Liu's Team (South China University of Technology
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV178XuYfEpi" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="IOT指令控制设备" src="docs/images/demo9.png" />
|
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="播报新闻" src="docs/images/demo0.png" />
|
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -145,23 +140,23 @@ Spearheaded by Professor Siyuan Liu's Team (South China University of Technology
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="多指令任务" src="docs/images/demo11.png" />
|
<img alt="自定义音色" src="docs/images/demo2.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="MCP接入点" src="docs/images/demo13.png" />
|
<img alt="使用粤语交流" src="docs/images/demo3.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="声纹识别" src="docs/images/demo14.png" />
|
<img alt="播报新闻" src="docs/images/demo0.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -246,8 +241,9 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
| 声纹识别 | 支持多用户声纹注册、管理和识别,与ASR并行处理,实时识别说话人身份并传递给LLM进行个性化回应 |
|
| 声纹识别 | 支持多用户声纹注册、管理和识别,与ASR并行处理,实时识别说话人身份并传递给LLM进行个性化回应 |
|
||||||
| 智能对话 | 支持多种LLM(大语言模型),实现智能对话 |
|
| 智能对话 | 支持多种LLM(大语言模型),实现智能对话 |
|
||||||
| 视觉感知 | 支持多种VLLM(视觉大模型),实现多模态交互 |
|
| 视觉感知 | 支持多种VLLM(视觉大模型),实现多模态交互 |
|
||||||
| 意图识别 | 支持LLM意图识别、Function Call函数调用,提供插件化意图处理机制 |
|
| 意图识别 | 支持外挂的大模型意图识别、大模型自主函数调用,提供插件化意图处理机制 |
|
||||||
| 记忆系统 | 支持本地短期记忆、mem0ai接口记忆,具备记忆总结功能 |
|
| 记忆系统 | 支持本地短期记忆、mem0ai接口记忆,具备记忆总结功能 |
|
||||||
|
| 知识库 | 支持RAGFlow知识库,让大模型判断需要调度知识库后再回答 |
|
||||||
| 工具调用 | 支持客户端IOT协议、客户MCP协议、服务端MCP协议、MCP接入点协议、自定义工具函数 |
|
| 工具调用 | 支持客户端IOT协议、客户MCP协议、服务端MCP协议、MCP接入点协议、自定义工具函数 |
|
||||||
| 指令下发 | 依托MQTT协议,支持从智控台将MCP指令下发到ESP32设备 |
|
| 指令下发 | 依托MQTT协议,支持从智控台将MCP指令下发到ESP32设备 |
|
||||||
| 管理后台 | 提供Web管理界面,支持用户管理、系统配置和设备管理;界面支持中文简体、中文繁体、英文显示 |
|
| 管理后台 | 提供Web管理界面,支持用户管理、系统配置和设备管理;界面支持中文简体、中文繁体、英文显示 |
|
||||||
|
|
@ -273,7 +269,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
|
||||||
| 使用方式 | 支持平台 | 免费平台 |
|
| 使用方式 | 支持平台 | 免费平台 |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| openai 接口调用 | 阿里百炼、火山引擎豆包、深度求索、智谱ChatGLM、Gemini | 智谱ChatGLM、Gemini |
|
| openai 接口调用 | 阿里百炼、火山引擎、DeepSeek、智谱、Gemini、科大讯飞 | 智谱、Gemini |
|
||||||
| ollama 接口调用 | Ollama | - |
|
| ollama 接口调用 | Ollama | - |
|
||||||
| dify 接口调用 | Dify | - |
|
| dify 接口调用 | Dify | - |
|
||||||
| fastgpt 接口调用 | Fastgpt | - |
|
| fastgpt 接口调用 | Fastgpt | - |
|
||||||
|
|
@ -299,7 +295,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
|
||||||
| 使用方式 | 支持平台 | 免费平台 |
|
| 使用方式 | 支持平台 | 免费平台 |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| 接口调用 | EdgeTTS、火山引擎豆包TTS、腾讯云、阿里云TTS、阿里云流式TTS、CosyVoiceSiliconflow、TTS302AI、CozeCnTTS、GizwitsTTS、ACGNTTS、OpenAITTS、灵犀流式TTS、MinimaxTTS、火山双流式TTS | 灵犀流式TTS、EdgeTTS、CosyVoiceSiliconflow(部分) |
|
| 接口调用 | EdgeTTS、科大讯飞、火山引擎、腾讯云、阿里云及百炼、CosyVoiceSiliconflow、TTS302AI、CozeCnTTS、GizwitsTTS、ACGNTTS、OpenAITTS、灵犀流式TTS、MinimaxTTS | 灵犀流式TTS、EdgeTTS、CosyVoiceSiliconflow(部分) |
|
||||||
| 本地服务 | FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3、Index-TTS、PaddleSpeech | Index-TTS、PaddleSpeech、FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3 |
|
| 本地服务 | FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3、Index-TTS、PaddleSpeech | Index-TTS、PaddleSpeech、FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -317,7 +313,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
| 使用方式 | 支持平台 | 免费平台 |
|
| 使用方式 | 支持平台 | 免费平台 |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| 本地使用 | FunASR、SherpaASR | FunASR、SherpaASR |
|
| 本地使用 | FunASR、SherpaASR | FunASR、SherpaASR |
|
||||||
| 接口调用 | DoubaoASR、Doubao流式ASR、FunASRServer、TencentASR、AliyunASR、Aliyun流式ASR、百度ASR、OpenAI ASR | FunASRServer |
|
| 接口调用 | FunASRServer、火山引擎、科大讯飞、腾讯云、阿里云、百度云、OpenAI ASR | FunASRServer |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -349,6 +345,14 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Rag 检索增强生成
|
||||||
|
|
||||||
|
| 类型 | 平台名称 | 使用方式 | 收费模式 | 备注 |
|
||||||
|
|:------:|:-------------:|:----:|:-------:|:---------------------:|
|
||||||
|
| Rag | ragflow | 接口调用 | 根据切片、分词消耗的token收费 | 借助RagFlow的检索增强生成功能,提供更准确的对话回复 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 鸣谢 🙏
|
## 鸣谢 🙏
|
||||||
|
|
||||||
| Logo | 项目/公司 | 说明 |
|
| Logo | 项目/公司 | 说明 |
|
||||||
|
|
|
||||||
374
README_de.md
Normal file
|
|
@ -0,0 +1,374 @@
|
||||||
|
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
||||||
|
|
||||||
|
<h1 align="center">Xiaozhi Backend-Service xiaozhi-esp32-server</h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
Dieses Projekt basiert auf der Theorie und Technologie der Mensch-Maschine-symbiotischen Intelligenz zur Entwicklung intelligenter Terminal-Hardware- und Software-Systeme<br/>und bietet Backend-Dienste für das Open-Source-Hardware-Projekt
|
||||||
|
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a><br/>
|
||||||
|
Implementiert mit Python, Java und Vue gemäß dem <a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">Xiaozhi-Kommunikationsprotokoll</a><br/>
|
||||||
|
Unterstützt MQTT+UDP-Protokoll, Websocket-Protokoll, MCP-Endpunkte und Stimmabdruckerkennung
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./docs/FAQ.md">Häufige Fragen</a>
|
||||||
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Probleme melden</a>
|
||||||
|
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Deployment-Dokumentation</a>
|
||||||
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Release-Hinweise</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
||||||
|
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
||||||
|
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
||||||
|
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DBEDFA"></a>
|
||||||
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
||||||
|
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/LICENSE">
|
||||||
|
<img alt="GitHub pull requests" src="https://img.shields.io/badge/license-MIT-white?labelColor=black" />
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server">
|
||||||
|
<img alt="stars" src="https://img.shields.io/github/stars/xinnan-tech/xiaozhi-esp32-server?color=ffcb47&labelColor=black" />
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
Geleitet vom Team von Professor Siyuan Liu (South China University of Technology)
|
||||||
|
</br>
|
||||||
|
刘思源教授团队主导研发(华南理工大学)
|
||||||
|
</br>
|
||||||
|
<img src="./docs/images/hnlg.jpg" alt="South China University of Technology" width="50%">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Zielgruppe 👥
|
||||||
|
|
||||||
|
Dieses Projekt erfordert ESP32-Hardware-Geräte zum Betrieb. Wenn Sie ESP32-bezogene Hardware erworben haben, erfolgreich eine Verbindung zu Brother Xias bereitgestelltem Backend-Service hergestellt haben und Ihren eigenen `xiaozhi-esp32`-Backend-Service unabhängig aufbauen möchten, dann ist dieses Projekt perfekt für Sie.
|
||||||
|
|
||||||
|
Möchten Sie die Nutzungseffekte sehen? Klicken Sie auf die Videos unten 🎥
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="响应速度感受" src="docs/images/demo9.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="速度优化秘诀" src="docs/images/demo6.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="复杂医疗场景" src="docs/images/demo1.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="MQTT指令下发" src="docs/images/demo4.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="声纹识别" src="docs/images/demo14.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="控制家电开关" src="docs/images/demo5.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="MCP接入点" src="docs/images/demo13.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="多指令任务" src="docs/images/demo11.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="播放音乐" src="docs/images/demo7.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Z8XuYZEAS" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="天气插件" src="docs/images/demo8.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="实时打断" src="docs/images/demo10.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="拍照识物品" src="docs/images/demo12.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="自定义音色" src="docs/images/demo2.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="使用粤语交流" src="docs/images/demo3.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="播报新闻" src="docs/images/demo0.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Warnungen ⚠️
|
||||||
|
|
||||||
|
1. Dieses Projekt ist Open-Source-Software. Diese Software hat keine kommerzielle Partnerschaft mit Drittanbieter-API-Dienstleistern (einschließlich, aber nicht beschränkt auf Spracherkennung, große Modelle, Sprachsynthese und andere Plattformen), mit denen sie sich verbindet, und bietet keine Garantie für deren Servicequalität oder finanzielle Sicherheit. Es wird empfohlen, dass Benutzer Dienstleister mit entsprechenden Geschäftslizenzen bevorzugen und deren Servicevereinbarungen und Datenschutzrichtlinien sorgfältig lesen. Diese Software hostet keine Kontoschlüssel, nimmt nicht an Geldströmen teil und trägt nicht das Risiko von Verlusten bei Guthaben-Aufladungen.
|
||||||
|
|
||||||
|
2. Die Funktionalität dieses Projekts ist nicht vollständig und hat keine Netzwerksicherheitsbewertung bestanden. Bitte verwenden Sie es nicht in Produktionsumgebungen. Wenn Sie dieses Projekt zu Lernzwecken in einer öffentlichen Netzwerkumgebung bereitstellen, stellen Sie bitte sicher, dass notwendige Schutzmaßnahmen vorhanden sind.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Deployment-Dokumentation
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Dieses Projekt bietet zwei Bereitstellungsmethoden. Bitte wählen Sie basierend auf Ihren spezifischen Anforderungen:
|
||||||
|
|
||||||
|
#### 🚀 Auswahl der Bereitstellungsmethode
|
||||||
|
| Bereitstellungsmethode | Funktionen | Anwendungsszenarien | Deployment-Dokumente | Konfigurationsanforderungen | Video-Tutorials |
|
||||||
|
|---------|------|---------|---------|---------|---------|
|
||||||
|
| **Vereinfachte Installation** | Intelligenter Dialog, IOT, MCP, visuelle Wahrnehmung | Umgebungen mit geringer Konfiguration, Daten in Konfigurationsdateien gespeichert, keine Datenbank erforderlich | [①Docker-Version](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Quellcode-Deployment](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 2 Kerne 4GB bei Verwendung von `FunASR`, 2 Kerne 2GB bei allen APIs | - |
|
||||||
|
| **Vollständige Modulinstallation** | Intelligenter Dialog, IOT, MCP-Endpunkte, Stimmabdruckerkennung, visuelle Wahrnehmung, OTA, intelligente Steuerkonsole | Vollständige Funktionserfahrung, Daten in Datenbank gespeichert |[①Docker-Version](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Quellcode-Deployment](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Quellcode-Deployment Auto-Update-Tutorial](./docs/dev-ops-integration.md) | 4 Kerne 8GB bei Verwendung von `FunASR`, 2 Kerne 4GB bei allen APIs| [Video-Tutorial für lokalen Quellcode-Start](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
||||||
|
|
||||||
|
Häufige Fragen und entsprechende Tutorials finden Sie unter [diesem Link](./docs/FAQ.md)
|
||||||
|
|
||||||
|
> 💡 Hinweis: Unten ist eine Testplattform, die mit dem neuesten Code bereitgestellt wurde. Sie können bei Bedarf brennen und testen. Gleichzeitige Benutzer: 6, Daten werden täglich gelöscht.
|
||||||
|
|
||||||
|
```
|
||||||
|
Adresse der intelligenten Steuerkonsole: https://2662r3426b.vicp.fun
|
||||||
|
Adresse der intelligenten Steuerkonsole (H5): https://2662r3426b.vicp.fun/h5/index.html
|
||||||
|
|
||||||
|
Service-Testtool: https://2662r3426b.vicp.fun/test/
|
||||||
|
OTA-Schnittstellenadresse: https://2662r3426b.vicp.fun/xiaozhi/ota/
|
||||||
|
Websocket-Schnittstellenadresse: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 🚩 Konfigurationsbeschreibung und Empfehlungen
|
||||||
|
> [!Note]
|
||||||
|
> Dieses Projekt bietet zwei Konfigurationsschemata:
|
||||||
|
>
|
||||||
|
> 1. `Einstiegslevel Kostenlose Einstellungen`: Geeignet für den persönlichen und privaten Gebrauch, alle Komponenten verwenden kostenlose Lösungen, keine zusätzliche Zahlung erforderlich.
|
||||||
|
>
|
||||||
|
> 2. `Streaming-Konfiguration`: Geeignet für Demonstrationen, Schulungen, Szenarien mit mehr als 2 gleichzeitigen Benutzern usw. Verwendet Streaming-Verarbeitungstechnologie für schnellere Reaktionsgeschwindigkeit und bessere Erfahrung.
|
||||||
|
>
|
||||||
|
> Ab Version `0.5.2` unterstützt das Projekt Streaming-Konfiguration. Im Vergleich zu früheren Versionen ist die Reaktionsgeschwindigkeit um ca. `2,5 Sekunden` verbessert, was die Benutzererfahrung erheblich verbessert.
|
||||||
|
|
||||||
|
| Modulname | Einstiegslevel Kostenlose Einstellungen | Streaming-Konfiguration |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| ASR (Spracherkennung) | FunASR (Lokal) | 👍FunASR (Lokaler GPU-Modus) |
|
||||||
|
| LLM (Großes Modell) | ChatGLMLLM (Zhipu glm-4-flash) | 👍AliLLM (qwen3-235b-a22b-instruct-2507) oder 👍DoubaoLLM (doubao-1-5-pro-32k-250115) |
|
||||||
|
| VLLM (Vision Large Model) | ChatGLMVLLM (Zhipu glm-4v-flash) | 👍QwenVLVLLM (Qwen qwen2.5-vl-3b-instructh) |
|
||||||
|
| TTS (Sprachsynthese) | ✅LinkeraiTTS (Lingxi-Streaming) | 👍HuoshanDoubleStreamTTS (Volcano Dual-Stream-Sprachsynthese) oder 👍AliyunStreamTTS (Alibaba Cloud Streaming-Sprachsynthese) |
|
||||||
|
| Intent (Absichtserkennung) | function_call (Funktionsaufruf) | function_call (Funktionsaufruf) |
|
||||||
|
| Memory (Gedächtnisfunktion) | mem_local_short (Lokales Kurzzeitgedächtnis) | mem_local_short (Lokales Kurzzeitgedächtnis) |
|
||||||
|
|
||||||
|
Wenn Sie sich um die Latenz jeder Komponente kümmern, lesen Sie bitte den [Xiaozhi-Komponenten-Leistungstestbericht](https://github.com/xinnan-tech/xiaozhi-performance-research). Sie können gemäß den Testmethoden im Bericht in Ihrer Umgebung tatsächlich testen.
|
||||||
|
|
||||||
|
#### 🔧 Testwerkzeuge
|
||||||
|
Dieses Projekt bietet die folgenden Testwerkzeuge, um Ihnen bei der Überprüfung des Systems und der Auswahl geeigneter Modelle zu helfen:
|
||||||
|
|
||||||
|
| Werkzeugname | Standort | Verwendungsmethode | Funktionsbeschreibung |
|
||||||
|
|:---:|:---|:---:|:---:|
|
||||||
|
| Audio-Interaktionstesttool | main》xiaozhi-server》test》test_page.html | Direkt mit Google Chrome öffnen | Testet Audio-Wiedergabe- und Empfangsfunktionen, überprüft, ob die Python-seitige Audioverarbeitung normal ist |
|
||||||
|
| Modell-Reaktionstesttool | main》xiaozhi-server》performance_tester.py | Ausführen `python performance_tester.py` | Testet die Reaktionsgeschwindigkeit von ASR (Spracherkennung), LLM (großes Modell), VLLM (Vision-Modell), TTS (Sprachsynthese) drei Kernmodulen |
|
||||||
|
|
||||||
|
> 💡 Hinweis: Beim Testen der Modellgeschwindigkeit werden nur Modelle mit konfigurierten Schlüsseln getestet.
|
||||||
|
|
||||||
|
---
|
||||||
|
## Funktionsliste ✨
|
||||||
|
### Implementiert ✅
|
||||||
|

|
||||||
|
| Funktionsmodul | Beschreibung |
|
||||||
|
|:---:|:---|
|
||||||
|
| Kernarchitektur | Basierend auf [MQTT+UDP-Gateway](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket und HTTP-Servern, bietet vollständiges Konsolenverwaltungs- und Authentifizierungssystem |
|
||||||
|
| Sprachinteraktion | Unterstützt Streaming-ASR (Spracherkennung), Streaming-TTS (Sprachsynthese), VAD (Sprachaktivitätserkennung), unterstützt mehrsprachige Erkennung und Sprachverarbeitung |
|
||||||
|
| Stimmabdruckerkennung | Unterstützt Mehrbenutzer-Stimmabdruckregistrierung, -verwaltung und -erkennung, verarbeitet parallel mit ASR, Echtzeit-Sprecheridentitätserkennung und Weitergabe an LLM für personalisierte Antworten |
|
||||||
|
| Intelligenter Dialog | Unterstützt mehrere LLM (große Sprachmodelle), implementiert intelligenten Dialog |
|
||||||
|
| Visuelle Wahrnehmung | Unterstützt mehrere VLLM (Vision Large Models), implementiert multimodale Interaktion |
|
||||||
|
| Absichtserkennung | Unterstützt LLM-Absichtserkennung, Function Call-Funktionsaufruf, bietet plugin-basierten Absichtsverarbeitungsmechanismus |
|
||||||
|
| Gedächtnissystem | Unterstützt lokales Kurzzeitgedächtnis, mem0ai-Schnittstellengedächtnis, mit Gedächtniszusammenfassungsfunktion |
|
||||||
|
| Wissensdatenbank | Unterstützt RAGFlow-Wissensdatenbank, ermöglicht großem Modell die Bewertung, ob Wissensdatenbank benötigt wird, bevor geantwortet wird |
|
||||||
|
| Werkzeugaufruf | Unterstützt Client-IOT-Protokoll, Client-MCP-Protokoll, Server-MCP-Protokoll, MCP-Endpunktprotokoll, benutzerdefinierte Werkzeugfunktionen |
|
||||||
|
| Befehlsübermittlung | Basierend auf MQTT-Protokoll, unterstützt die Übermittlung von MCP-Befehlen von der intelligenten Steuerkonsole an ESP32-Geräte |
|
||||||
|
| Verwaltungs-Backend | Bietet Web-Verwaltungsoberfläche, unterstützt Benutzerverwaltung, Systemkonfiguration und Geräteverwaltung; Oberfläche unterstützt vereinfachtes Chinesisch, traditionelles Chinesisch und englische Anzeige |
|
||||||
|
| Testwerkzeuge | Bietet Leistungstestwerkzeuge, Vision-Modell-Testwerkzeuge und Audio-Interaktionstestwerkzeuge |
|
||||||
|
| Deployment-Unterstützung | Unterstützt Docker-Deployment und lokales Deployment, bietet vollständige Konfigurationsdateiverwaltung |
|
||||||
|
| Plugin-System | Unterstützt funktionale Plugin-Erweiterungen, benutzerdefinierte Plugin-Entwicklung und Plugin-Hot-Loading |
|
||||||
|
|
||||||
|
### In Entwicklung 🚧
|
||||||
|
|
||||||
|
Um über spezifische Entwicklungsplanfortschritte zu erfahren, [klicken Sie hier](https://github.com/users/xinnan-tech/projects/3). Häufige Fragen und entsprechende Tutorials finden Sie unter [diesem Link](./docs/FAQ.md)
|
||||||
|
|
||||||
|
Wenn Sie ein Softwareentwickler sind, finden Sie hier einen [Offenen Brief an Entwickler](docs/contributor_open_letter.md). Willkommen beim Beitritt!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Produktökosystem 👬
|
||||||
|
Xiaozhi ist ein Ökosystem. Wenn Sie dieses Produkt verwenden, können Sie sich auch andere [hervorragende Projekte](https://github.com/78/xiaozhi-esp32?tab=readme-ov-file#%E7%9B%B8%E5%85%B3%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE) in diesem Ökosystem ansehen
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Liste der von diesem Projekt unterstützten Plattformen/Komponenten 📋
|
||||||
|
### LLM-Sprachmodelle
|
||||||
|
|
||||||
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| OpenAI-Schnittstellenaufrufe | Alibaba Bailian, Volcano Engine Doubao, DeepSeek, Zhipu ChatGLM, Gemini | Zhipu ChatGLM, Gemini |
|
||||||
|
| Ollama-Schnittstellenaufrufe | Ollama | - |
|
||||||
|
| Dify-Schnittstellenaufrufe | Dify | - |
|
||||||
|
| FastGPT-Schnittstellenaufrufe | FastGPT | - |
|
||||||
|
| Coze-Schnittstellenaufrufe | Coze | - |
|
||||||
|
| Xinference-Schnittstellenaufrufe | Xinference | - |
|
||||||
|
| HomeAssistant-Schnittstellenaufrufe | HomeAssistant | - |
|
||||||
|
|
||||||
|
Tatsächlich kann jedes LLM, das OpenAI-Schnittstellenaufrufe unterstützt, integriert und verwendet werden.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### VLLM-Vision-Modelle
|
||||||
|
|
||||||
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| OpenAI-Schnittstellenaufrufe | Alibaba Bailian, Zhipu ChatGLMVLLM | Zhipu ChatGLMVLLM |
|
||||||
|
|
||||||
|
Tatsächlich kann jedes VLLM, das OpenAI-Schnittstellenaufrufe unterstützt, integriert und verwendet werden.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### TTS-Sprachsynthese
|
||||||
|
|
||||||
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| Schnittstellenaufrufe | EdgeTTS, Volcano Engine Doubao TTS, Tencent Cloud, Alibaba Cloud TTS, AliYun Stream TTS, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi Streaming TTS, MinimaxTTS, Volcano Dual-Stream TTS | Lingxi Streaming TTS, EdgeTTS, CosyVoiceSiliconflow (teilweise) |
|
||||||
|
| Lokale Dienste | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, Index-TTS, PaddleSpeech | Index-TTS, PaddleSpeech, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### VAD-Sprachaktivitätserkennung
|
||||||
|
|
||||||
|
| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
|
||||||
|
|:---:|:---------:|:----:|:----:|:--:|
|
||||||
|
| VAD | SileroVAD | Lokale Verwendung | Kostenlos | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ASR-Spracherkennung
|
||||||
|
|
||||||
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| Lokale Verwendung | FunASR, SherpaASR | FunASR, SherpaASR |
|
||||||
|
| Schnittstellenaufrufe | DoubaoASR, Doubao Streaming ASR, FunASRServer, TencentASR, AliyunASR, Aliyun Streaming ASR, Baidu ASR, OpenAI ASR | FunASRServer |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Voiceprint-Stimmabdruckerkennung
|
||||||
|
|
||||||
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| Lokale Verwendung | 3D-Speaker | 3D-Speaker |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Memory-Gedächtnisspeicher
|
||||||
|
|
||||||
|
| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
|
||||||
|
|:------:|:---------------:|:----:|:---------:|:--:|
|
||||||
|
| Memory | mem0ai | Schnittstellenaufrufe | 1000 Mal/Monat Kontingent | |
|
||||||
|
| Memory | mem_local_short | Lokale Zusammenfassung | Kostenlos | |
|
||||||
|
| Memory | nomem | Kein Gedächtnismodus | Kostenlos | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Intent-Absichtserkennung
|
||||||
|
|
||||||
|
| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
|
||||||
|
|:------:|:-------------:|:----:|:-------:|:---------------------:|
|
||||||
|
| Intent | intent_llm | Schnittstellenaufrufe | Basierend auf LLM-Preisen | Erkennt Absicht durch große Modelle, starke Allgemeingültigkeit |
|
||||||
|
| Intent | function_call | Schnittstellenaufrufe | Basierend auf LLM-Preisen | Vervollständigt Absicht durch Funktionsaufruf großer Modelle, schnelle Geschwindigkeit, guter Effekt |
|
||||||
|
| Intent | nointent | Kein Absichtsmodus | Kostenlos | Führt keine Absichtserkennung durch, gibt direkt Dialogergebnis zurück |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Rag Retrieval Augmented Generation
|
||||||
|
|
||||||
|
| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
|
||||||
|
|:------:|:-------------:|:----:|:-------:|:---------------------:|
|
||||||
|
| Rag | ragflow | Schnittstellenaufrufe | Gebühren basierend auf Token-Verbrauch für Segmentierung und Tokenisierung | Nutzt RAGFlow's Retrieval-Augmented-Generation-Funktion für präzisere Dialogantworten |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Danksagungen 🙏
|
||||||
|
|
||||||
|
| Logo | Projekt/Unternehmen | Beschreibung |
|
||||||
|
|:---:|:---:|:---|
|
||||||
|
| <img src="./docs/images/logo_bailing.png" width="160"> | [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) | Dieses Projekt wurde von [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) inspiriert und auf dessen Basis implementiert |
|
||||||
|
| <img src="./docs/images/logo_tenclass.png" width="160"> | [Tenclass](https://www.tenclass.com/) | Dank an [Tenclass](https://www.tenclass.com/) für die Formulierung von Standardkommunikationsprotokollen, Multi-Geräte-Kompatibilitätslösungen und High-Concurrency-Szenario-Praxisdemonstrationen für das Xiaozhi-Ökosystem; für die Bereitstellung vollständiger technischer Dokumentationsunterstützung für dieses Projekt |
|
||||||
|
| <img src="./docs/images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology](https://github.com/Eric0308) | Dank an [Xuanfeng Technology](https://github.com/Eric0308) für den Beitrag des Funktionsaufruf-Frameworks, des MCP-Kommunikationsprotokolls und der plugin-basierten Aufrufmechanismus-Implementierungscode. Durch standardisiertes Befehlsplanungssystem und dynamische Erweiterungsfähigkeiten wird die Interaktionseffizienz und funktionale Erweiterbarkeit von Frontend-Geräten (IoT) erheblich verbessert |
|
||||||
|
| <img src="./docs/images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Dank an [huangjunsen](https://github.com/huangjunsen0406) für den Beitrag des `Smart Control Console Mobile`-Moduls, das eine effiziente Steuerung und Echtzeit-Interaktion über mobile Geräte ermöglicht und die Betriebsbequemlichkeit und Verwaltungseffizienz des Systems in mobilen Szenarien erheblich verbessert |
|
||||||
|
| <img src="./docs/images/logo_huiyuan.png" width="160"> | [Huiyuan Design](http://ui.kwd988.net/) | Dank an [Huiyuan Design](http://ui.kwd988.net/) für die Bereitstellung professioneller visueller Lösungen für dieses Projekt, unter Verwendung ihrer Design-Praxiserfahrung im Dienst von über tausend Unternehmen, um die Produktbenutzererfahrung dieses Projekts zu stärken |
|
||||||
|
| <img src="./docs/images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology](https://www.029app.com/) | Dank an [Xi'an Qinren Information Technology](https://www.029app.com/) für die Vertiefung des visuellen Systems dieses Projekts und die Sicherstellung der Konsistenz und Erweiterbarkeit des Gesamtdesignstils in Multi-Szenario-Anwendungen |
|
||||||
|
| <img src="./docs/images/logo_contributors.png" width="160"> | [Code-Mitwirkende](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Dank an [alle Code-Mitwirkenden](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), Ihre Bemühungen haben das Projekt robuster und leistungsfähiger gemacht. |
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://star-history.com/#xinnan-tech/xiaozhi-esp32-server&Date">
|
||||||
|
|
||||||
|
<picture>
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date&theme=dark" />
|
||||||
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
122
README_en.md
|
|
@ -6,29 +6,24 @@
|
||||||
This project is based on human-machine symbiotic intelligence theory and technology to develop intelligent terminal hardware and software systems<br/>providing backend services for the open-source intelligent hardware project
|
This project is based on human-machine symbiotic intelligence theory and technology to develop intelligent terminal hardware and software systems<br/>providing backend services for the open-source intelligent hardware project
|
||||||
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a><br/>
|
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a><br/>
|
||||||
Implemented using Python, Java, and Vue according to the <a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">Xiaozhi Communication Protocol</a><br/>
|
Implemented using Python, Java, and Vue according to the <a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">Xiaozhi Communication Protocol</a><br/>
|
||||||
Supports MCP endpoints and voiceprint recognition
|
Support for MQTT+UDP protocol, Websocket protocol, MCP access point, voiceprint recognition, and knowledge base
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="./README.md">中文</a>
|
<a href="./docs/FAQ.md">FAQ</a>
|
||||||
· <a href="./docs/FAQ.md">FAQ</a>
|
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Report Issues</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Report Issues</a>
|
||||||
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Deployment Docs</a>
|
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Deployment Docs</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Release Notes</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Release Notes</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
||||||
|
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DBEDFA"></a>
|
||||||
|
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
||||||
|
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors">
|
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/xinnan-tech/xiaozhi-esp32-server?logo=github" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">
|
|
||||||
<img alt="Issues" src="https://img.shields.io/github/issues/xinnan-tech/xiaozhi-esp32-server?color=0088ff" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/pulls">
|
|
||||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/xinnan-tech/xiaozhi-esp32-server?color=0088ff" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/LICENSE">
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/LICENSE">
|
||||||
<img alt="GitHub pull requests" src="https://img.shields.io/badge/license-MIT-white?labelColor=black" />
|
<img alt="GitHub pull requests" src="https://img.shields.io/badge/license-MIT-white?labelColor=black" />
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -58,72 +53,72 @@ Want to see the usage effects? Click the videos below 🎥
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Xiaozhi ESP32 connecting to own backend model" src="docs/images/demo1.png" />
|
<img alt="响应速度感受" src="docs/images/demo9.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="速度优化秘诀" src="docs/images/demo6.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="复杂医疗场景" src="docs/images/demo1.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="MQTT command issuance" src="docs/images/demo4.png" />
|
<img alt="MQTT指令下发" src="docs/images/demo4.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Custom voice timbre" src="docs/images/demo2.png" />
|
<img alt="声纹识别" src="docs/images/demo14.png" />
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Using Cantonese for communication" src="docs/images/demo3.png" />
|
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Controlling home appliances" src="docs/images/demo5.png" />
|
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Custom voice timbre" src="docs/images/demo6.png" />
|
<img alt="控制家电开关" src="docs/images/demo5.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="MCP接入点" src="docs/images/demo13.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="多指令任务" src="docs/images/demo11.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Playing music" src="docs/images/demo7.png" />
|
<img alt="播放音乐" src="docs/images/demo7.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1Z8XuYZEAS" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Z8XuYZEAS" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Weather plugin" src="docs/images/demo8.png" />
|
<img alt="天气插件" src="docs/images/demo8.png" />
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV178XuYfEpi" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="IOT command control devices" src="docs/images/demo9.png" />
|
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="News broadcasting" src="docs/images/demo0.png" />
|
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -132,35 +127,35 @@ Want to see the usage effects? Click the videos below 🎥
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Real-time interruption" src="docs/images/demo10.png" />
|
<img alt="实时打断" src="docs/images/demo10.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Photo recognition of objects" src="docs/images/demo12.png" />
|
<img alt="拍照识物品" src="docs/images/demo12.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Multi-command tasks" src="docs/images/demo11.png" />
|
<img alt="自定义音色" src="docs/images/demo2.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="MCP endpoint" src="docs/images/demo13.png" />
|
<img alt="使用粤语交流" src="docs/images/demo3.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Voiceprint recognition" src="docs/images/demo14.png" />
|
<img alt="播报新闻" src="docs/images/demo0.png" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -244,6 +239,7 @@ This project provides the following testing tools to help you verify the system
|
||||||
| Visual Perception | Supports multiple VLLM(vision large models), implements multimodal interaction |
|
| Visual Perception | Supports multiple VLLM(vision large models), implements multimodal interaction |
|
||||||
| Intent Recognition | Supports LLM intent recognition, Function Call function calling, provides plugin-based intent processing mechanism |
|
| Intent Recognition | Supports LLM intent recognition, Function Call function calling, provides plugin-based intent processing mechanism |
|
||||||
| Memory System | Supports local short-term memory, mem0ai interface memory, with memory summarization functionality |
|
| Memory System | Supports local short-term memory, mem0ai interface memory, with memory summarization functionality |
|
||||||
|
| Knowledge Base | Supports RAGFlow knowledge base, enabling LLM to judge whether to schedule the knowledge base after receiving the user's question, and then answer the question |
|
||||||
| Command Delivery | Supports MCP command delivery to ESP32 devices via MQTT protocol from Smart Console |
|
| Command Delivery | Supports MCP command delivery to ESP32 devices via MQTT protocol from Smart Console |
|
||||||
| Tool Calling | Supports client IOT protocol, client MCP protocol, server MCP protocol, MCP endpoint protocol, custom tool functions |
|
| Tool Calling | Supports client IOT protocol, client MCP protocol, server MCP protocol, MCP endpoint protocol, custom tool functions |
|
||||||
| Management Backend | Provides Web management interface, supports user management, system configuration and device management; Supports Simplified Chinese, Traditional Chinese and English display |
|
| Management Backend | Provides Web management interface, supports user management, system configuration and device management; Supports Simplified Chinese, Traditional Chinese and English display |
|
||||||
|
|
@ -275,7 +271,7 @@ Xiaozhi is an ecosystem. When using this product, you can also check out other [
|
||||||
|
|
||||||
| Usage Method | Supported Platforms | Free Platforms |
|
| Usage Method | Supported Platforms | Free Platforms |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| OpenAI interface calls | Alibaba Bailian, Volcano Engine Doubao, DeepSeek, Zhipu ChatGLM, Gemini | Zhipu ChatGLM, Gemini |
|
| OpenAI interface calls | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFLYTEK | Zhipu, Gemini |
|
||||||
| Ollama interface calls | Ollama | - |
|
| Ollama interface calls | Ollama | - |
|
||||||
| Dify interface calls | Dify | - |
|
| Dify interface calls | Dify | - |
|
||||||
| FastGPT interface calls | FastGPT | - |
|
| FastGPT interface calls | FastGPT | - |
|
||||||
|
|
@ -299,7 +295,7 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use
|
||||||
|
|
||||||
| Usage Method | Supported Platforms | Free Platforms |
|
| Usage Method | Supported Platforms | Free Platforms |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Interface calls | EdgeTTS, Volcano Engine Doubao TTS, Tencent Cloud, Alibaba Cloud TTS, AliYun Stream TTS, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi Streaming TTS, MinimaxTTS | Lingxi Streaming TTS, EdgeTTS, CosyVoiceSiliconflow(partial) |
|
| Interface calls | EdgeTTS, iFLYTEK, Volcano Engine, Tencent Cloud, Alibaba Cloud and Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi Streaming TTS, MinimaxTTS | Lingxi Streaming TTS, EdgeTTS, CosyVoiceSiliconflow(partial) |
|
||||||
| Local services | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, MinimaxTTS | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, MinimaxTTS |
|
| Local services | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, MinimaxTTS | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, MinimaxTTS |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -317,7 +313,7 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use
|
||||||
| Usage Method | Supported Platforms | Free Platforms |
|
| Usage Method | Supported Platforms | Free Platforms |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Local use | FunASR, SherpaASR | FunASR, SherpaASR |
|
| Local use | FunASR, SherpaASR | FunASR, SherpaASR |
|
||||||
| Interface calls | DoubaoASR, FunASRServer, TencentASR, AliyunASR | FunASRServer |
|
| Interface calls | FunASRServer, Volcano Engine, iFLYTEK, Tencent Cloud, Alibaba Cloud, Baidu Cloud, OpenAI ASR | FunASRServer |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -347,6 +343,14 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Rag Retrieval-Augmented Generation
|
||||||
|
|
||||||
|
| Type | Platform Name | Usage Method | Pricing Model | Notes |
|
||||||
|
|:------:|:-------------:|:----:|:-------:|:---------------------:|
|
||||||
|
| Rag | ragflow | Interface calls | Charged based on tokens consumed for slicing and word segmentation | Utilizes RagFlow's retrieval-augmented generation feature to provide more accurate dialog responses |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Acknowledgments 🙏
|
## Acknowledgments 🙏
|
||||||
|
|
||||||
| Logo | Project/Company | Description |
|
| Logo | Project/Company | Description |
|
||||||
|
|
|
||||||
375
README_vi.md
Normal file
|
|
@ -0,0 +1,375 @@
|
||||||
|
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
||||||
|
|
||||||
|
<h1 align="center">Dịch vụ Backend Xiaozhi xiaozhi-esp32-server</h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
Dự án này dựa trên lý thuyết và công nghệ trí tuệ cộng sinh người-máy để phát triển hệ thống phần mềm và phần cứng thiết bị đầu cuối thông minh<br/>Cung cấp dịch vụ backend cho dự án phần cứng thông minh mã nguồn mở
|
||||||
|
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a><br/>
|
||||||
|
Được triển khai bằng Python, Java, Vue theo <a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">giao thức truyền thông Xiaozhi</a><br/>
|
||||||
|
Hỗ trợ giao thức MQTT+UDP, giao thức Websocket, điểm truy cập MCP, nhận dạng giọng nói và kho tri thức
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./docs/FAQ.md">Câu hỏi thường gặp</a>
|
||||||
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Báo cáo vấn đề</a>
|
||||||
|
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Tài liệu triển khai</a>
|
||||||
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Nhật ký cập nhật</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
||||||
|
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
||||||
|
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DBEDFA"></a>
|
||||||
|
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
||||||
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
||||||
|
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/LICENSE">
|
||||||
|
<img alt="GitHub pull requests" src="https://img.shields.io/badge/license-MIT-white?labelColor=black" />
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server">
|
||||||
|
<img alt="stars" src="https://img.shields.io/github/stars/xinnan-tech/xiaozhi-esp32-server?color=ffcb47&labelColor=black" />
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
Spearheaded by Professor Siyuan Liu's Team (South China University of Technology)
|
||||||
|
</br>
|
||||||
|
Được dẫn dắt bởi nhóm Giáo sư Lưu Tư Nguyên (Đại học Bách khoa Nam Trung Quốc)
|
||||||
|
</br>
|
||||||
|
<img src="./docs/images/hnlg.jpg" alt="华南理工大学" width="50%">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Người dùng phù hợp 👥
|
||||||
|
|
||||||
|
Dự án này cần được sử dụng cùng với thiết bị phần cứng ESP32. Nếu bạn đã mua phần cứng liên quan đến ESP32, đã thành công kết nối với dịch vụ backend do anh Xia triển khai, và muốn xây dựng dịch vụ backend `xiaozhi-esp32` riêng của mình, thì dự án này rất phù hợp với bạn.
|
||||||
|
|
||||||
|
Muốn xem hiệu quả sử dụng? Hãy xem video 🎥
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="响应速度感受" src="docs/images/demo9.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="速度优化秘诀" src="docs/images/demo6.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="复杂医疗场景" src="docs/images/demo1.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="MQTT指令下发" src="docs/images/demo4.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="声纹识别" src="docs/images/demo14.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="控制家电开关" src="docs/images/demo5.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="MCP接入点" src="docs/images/demo13.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="多指令任务" src="docs/images/demo11.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="播放音乐" src="docs/images/demo7.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Z8XuYZEAS" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="天气插件" src="docs/images/demo8.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="实时打断" src="docs/images/demo10.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="拍照识物品" src="docs/images/demo12.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="自定义音色" src="docs/images/demo2.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="使用粤语交流" src="docs/images/demo3.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="播报新闻" src="docs/images/demo0.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cảnh báo ⚠️
|
||||||
|
|
||||||
|
1. Dự án này là phần mềm mã nguồn mở, phần mềm này không có quan hệ hợp tác thương mại với bất kỳ nhà cung cấp dịch vụ API bên thứ ba nào (bao gồm nhưng không giới hạn ở các nền tảng nhận dạng giọng nói, mô hình lớn, tổng hợp giọng nói, v.v.), và không đảm bảo chất lượng dịch vụ cũng như an toàn tài chính của họ.
|
||||||
|
Khuyến nghị người dùng ưu tiên lựa chọn nhà cung cấp dịch vụ có giấy phép kinh doanh liên quan và đọc kỹ thỏa thuận dịch vụ và chính sách bảo mật của họ. Phần mềm này không lưu trữ bất kỳ khóa tài khoản nào, không tham gia vào luồng tiền và không chịu rủi ro mất tiền nạp.
|
||||||
|
|
||||||
|
2. Chức năng của dự án này chưa hoàn thiện và chưa qua đánh giá bảo mật mạng, vui lòng không sử dụng trong môi trường sản xuất. Nếu bạn triển khai dự án này trong môi trường mạng công cộng để học tập, vui lòng thực hiện các biện pháp bảo vệ cần thiết.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Tài liệu triển khai
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Dự án này cung cấp hai phương pháp triển khai, vui lòng chọn theo nhu cầu cụ thể của bạn:
|
||||||
|
|
||||||
|
#### 🚀 Lựa chọn phương pháp triển khai
|
||||||
|
| Phương pháp triển khai | Đặc điểm | Tình huống áp dụng | Tài liệu triển khai | Yêu cầu cấu hình | Video hướng dẫn |
|
||||||
|
|---------|------|---------|---------|---------|---------|
|
||||||
|
| **Cài đặt tối giản** | Đối thoại thông minh, IOT, MCP, cảm nhận thị giác | Môi trường cấu hình thấp, dữ liệu lưu trong tệp cấu hình, không cần cơ sở dữ liệu | [①Phiên bản Docker](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Triển khai mã nguồn](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 2 nhân 4GB nếu dùng `FunASR`, 2 nhân 2GB nếu toàn API | - |
|
||||||
|
| **Cài đặt toàn bộ module** | Đối thoại thông minh, IOT, điểm truy cập MCP, nhận dạng giọng nói, cảm nhận thị giác, OTA, bảng điều khiển thông minh | Trải nghiệm đầy đủ tính năng, dữ liệu lưu trong cơ sở dữ liệu |[①Phiên bản Docker](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Triển khai mã nguồn](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Hướng dẫn tự động cập nhật triển khai mã nguồn](./docs/dev-ops-integration.md) | 4 nhân 8GB nếu dùng `FunASR`, 2 nhân 4GB nếu toàn API| [Video hướng dẫn khởi động mã nguồn cục bộ](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
||||||
|
|
||||||
|
Câu hỏi thường gặp và hướng dẫn liên quan, vui lòng tham khảo [liên kết này](./docs/FAQ.md)
|
||||||
|
|
||||||
|
> 💡 Gợi ý: Dưới đây là nền tảng thử nghiệm được triển khai theo mã mới nhất, có thể flash để thử nghiệm nếu cần, đồng thời là 6, dữ liệu sẽ được xóa mỗi ngày,
|
||||||
|
|
||||||
|
```
|
||||||
|
Địa chỉ bảng điều khiển thông minh: https://2662r3426b.vicp.fun
|
||||||
|
Bảng điều khiển thông minh (phiên bản h5): https://2662r3426b.vicp.fun/h5/index.html
|
||||||
|
|
||||||
|
Công cụ kiểm tra dịch vụ: https://2662r3426b.vicp.fun/test/
|
||||||
|
Địa chỉ giao diện OTA: https://2662r3426b.vicp.fun/xiaozhi/ota/
|
||||||
|
Địa chỉ giao diện Websocket: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 🚩 Mô tả và khuyến nghị cấu hình
|
||||||
|
> [!Note]
|
||||||
|
> Dự án này cung cấp hai phương án cấu hình:
|
||||||
|
>
|
||||||
|
> 1. Cấu hình `Miễn phí hoàn toàn cho người mới`: Phù hợp với sử dụng gia đình cá nhân, tất cả các thành phần đều sử dụng phương án miễn phí, không cần thanh toán thêm.
|
||||||
|
>
|
||||||
|
> 2. `Cấu hình streaming`: Phù hợp với demo, đào tạo, hơn 2 đồng thời, v.v., sử dụng công nghệ xử lý streaming, tốc độ phản hồi nhanh hơn, trải nghiệm tốt hơn.
|
||||||
|
>
|
||||||
|
> Từ phiên bản `0.5.2`, dự án hỗ trợ cấu hình streaming, so với phiên bản đầu, tốc độ phản hồi cải thiện khoảng `2.5 giây`, cải thiện đáng kể trải nghiệm người dùng.
|
||||||
|
|
||||||
|
| Tên module | Cài đặt miễn phí cho người mới | Cấu hình streaming |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| ASR(Nhận dạng giọng nói) | FunASR(Local) | 👍FunASR(Chế độ GPU cục bộ) |
|
||||||
|
| LLM(Mô hình lớn) | ChatGLMLLM(Zhipu glm-4-flash) | 👍AliLLM(qwen3-235b-a22b-instruct-2507) hoặc 👍DoubaoLLM(doubao-1-5-pro-32k-250115) |
|
||||||
|
| VLLM(Mô hình lớn thị giác) | ChatGLMVLLM(Zhipu glm-4v-flash) | 👍QwenVLVLLM(Qwen qwen2.5-vl-3b-instructh) |
|
||||||
|
| TTS(Tổng hợp giọng nói) | ✅LinkeraiTTS(Lingxi streaming) | 👍HuoshanDoubleStreamTTS(Tổng hợp giọng nói streaming kép Volcano) hoặc 👍AliyunStreamTTS(Tổng hợp giọng nói streaming Alibaba Cloud) |
|
||||||
|
| Intent(Nhận dạng ý định) | function_call(Gọi hàm) | function_call(Gọi hàm) |
|
||||||
|
| Memory(Chức năng bộ nhớ) | mem_local_short(Bộ nhớ ngắn hạn cục bộ) | mem_local_short(Bộ nhớ ngắn hạn cục bộ) |
|
||||||
|
|
||||||
|
Nếu bạn quan tâm đến thời gian của từng thành phần, vui lòng xem [Báo cáo kiểm tra hiệu suất các thành phần Xiaozhi](https://github.com/xinnan-tech/xiaozhi-performance-research), có thể kiểm tra thực tế trong môi trường của bạn theo phương pháp kiểm tra trong báo cáo.
|
||||||
|
|
||||||
|
#### 🔧 Công cụ kiểm tra
|
||||||
|
Dự án này cung cấp các công cụ kiểm tra sau để giúp bạn xác minh hệ thống và chọn mô hình phù hợp:
|
||||||
|
|
||||||
|
| Tên công cụ | Vị trí | Phương pháp sử dụng | Mô tả chức năng |
|
||||||
|
|:---:|:---|:---:|:---:|
|
||||||
|
| Công cụ kiểm tra tương tác âm thanh | main》xiaozhi-server》test》test_page.html | Mở trực tiếp bằng trình duyệt Google Chrome | Kiểm tra chức năng phát và nhận âm thanh, xác minh xử lý âm thanh phía Python có bình thường không |
|
||||||
|
| Công cụ kiểm tra phản hồi mô hình | main》xiaozhi-server》performance_tester.py | Thực hiện `python performance_tester.py` | Kiểm tra tốc độ phản hồi của ba module cốt lõi ASR(Nhận dạng giọng nói), LLM(Mô hình lớn), VLLM(Mô hình thị giác), TTS(Tổng hợp giọng nói) |
|
||||||
|
|
||||||
|
> 💡 Gợi ý: Khi kiểm tra tốc độ mô hình, chỉ kiểm tra các mô hình đã cấu hình khóa.
|
||||||
|
|
||||||
|
---
|
||||||
|
## Danh sách tính năng ✨
|
||||||
|
### Đã thực hiện ✅
|
||||||
|

|
||||||
|
| Module chức năng | Mô tả |
|
||||||
|
|:---:|:---|
|
||||||
|
| Kiến trúc cốt lõi | Dựa trên [cổng MQTT+UDP](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket, máy chủ HTTP, cung cấp hệ thống quản lý bảng điều khiển và xác thực hoàn chỉnh |
|
||||||
|
| Tương tác giọng nói | Hỗ trợ ASR streaming(Nhận dạng giọng nói), TTS streaming(Tổng hợp giọng nói), VAD(Phát hiện hoạt động giọng nói), hỗ trợ nhận dạng đa ngôn ngữ và xử lý giọng nói |
|
||||||
|
| Nhận dạng vân giọng | Hỗ trợ đăng ký, quản lý và nhận dạng vân giọng đa người dùng, xử lý song song với ASR, nhận dạng danh tính người nói theo thời gian thực và truyền cho LLM để phản hồi cá nhân hóa |
|
||||||
|
| Đối thoại thông minh | Hỗ trợ nhiều LLM(Mô hình ngôn ngữ lớn), thực hiện đối thoại thông minh |
|
||||||
|
| Cảm nhận thị giác | Hỗ trợ nhiều VLLM(Mô hình lớn thị giác), thực hiện tương tác đa phương thức |
|
||||||
|
| Nhận dạng ý định | Hỗ trợ nhận dạng ý định mô hình lớn gắn ngoài, gọi hàm tự chủ mô hình lớn, cung cấp cơ chế xử lý ý định dạng plugin |
|
||||||
|
| Hệ thống bộ nhớ | Hỗ trợ bộ nhớ ngắn hạn cục bộ, bộ nhớ giao diện mem0ai, có chức năng tóm tắt bộ nhớ |
|
||||||
|
| Kho tri thức | Hỗ trợ kho tri thức RAGFlow, cho phép mô hình lớn đánh giá cần gọi kho tri thức trước khi trả lời |
|
||||||
|
| Gọi công cụ | Hỗ trợ giao thức IOT phía client, giao thức MCP phía client, giao thức MCP phía server, giao thức điểm truy cập MCP, hàm công cụ tùy chỉnh |
|
||||||
|
| Gửi lệnh | Dựa vào giao thức MQTT, hỗ trợ gửi lệnh MCP từ bảng điều khiển thông minh xuống thiết bị ESP32 |
|
||||||
|
| Backend quản lý | Cung cấp giao diện quản lý Web, hỗ trợ quản lý người dùng, cấu hình hệ thống và quản lý thiết bị; giao diện hỗ trợ hiển thị tiếng Trung giản thể, tiếng Trung phồn thể, tiếng Anh |
|
||||||
|
| Công cụ kiểm tra | Cung cấp công cụ kiểm tra hiệu suất, công cụ kiểm tra mô hình thị giác và công cụ kiểm tra tương tác âm thanh |
|
||||||
|
| Hỗ trợ triển khai | Hỗ trợ triển khai Docker và triển khai cục bộ, cung cấp quản lý tệp cấu hình hoàn chỉnh |
|
||||||
|
| Hệ thống plugin | Hỗ trợ mở rộng plugin chức năng, phát triển plugin tùy chỉnh và hot loading plugin |
|
||||||
|
|
||||||
|
### Đang phát triển 🚧
|
||||||
|
|
||||||
|
Muốn hiểu tiến độ kế hoạch phát triển cụ thể, [vui lòng nhấp vào đây](https://github.com/users/xinnan-tech/projects/3). Câu hỏi thường gặp và hướng dẫn liên quan, vui lòng tham khảo [liên kết này](./docs/FAQ.md)
|
||||||
|
|
||||||
|
Nếu bạn là một nhà phát triển phần mềm, đây có một [Lá thư mở gửi các nhà phát triển](docs/contributor_open_letter.md), chào mừng tham gia!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Hệ sinh thái sản phẩm 👬
|
||||||
|
Xiaozhi là một hệ sinh thái, khi bạn sử dụng sản phẩm này, bạn cũng có thể xem các [dự án xuất sắc](https://github.com/78/xiaozhi-esp32?tab=readme-ov-file#%E7%9B%B8%E5%85%B3%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE) khác trong hệ sinh thái này
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Danh sách nền tảng/thành phần được dự án này hỗ trợ 📋
|
||||||
|
### LLM Mô hình ngôn ngữ
|
||||||
|
|
||||||
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| Gọi giao diện openai | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFlytek | Zhipu, Gemini |
|
||||||
|
| Gọi giao diện ollama | Ollama | - |
|
||||||
|
| Gọi giao diện dify | Dify | - |
|
||||||
|
| Gọi giao diện fastgpt | Fastgpt | - |
|
||||||
|
| Gọi giao diện coze | Coze | - |
|
||||||
|
| Gọi giao diện xinference | Xinference | - |
|
||||||
|
| Gọi giao diện homeassistant | HomeAssistant | - |
|
||||||
|
|
||||||
|
Trên thực tế, bất kỳ LLM nào hỗ trợ gọi giao diện openai đều có thể truy cập sử dụng.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### VLLM Mô hình thị giác
|
||||||
|
|
||||||
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| Gọi giao diện openai | Alibaba Bailian, Zhipu ChatGLMVLLM | Zhipu ChatGLMVLLM |
|
||||||
|
|
||||||
|
Trên thực tế, bất kỳ VLLM nào hỗ trợ gọi giao diện openai đều có thể truy cập sử dụng.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### TTS Tổng hợp giọng nói
|
||||||
|
|
||||||
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| Gọi giao diện | EdgeTTS, iFlytek, Volcano Engine, Tencent Cloud, Alibaba Cloud và Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi streaming TTS, MinimaxTTS | Lingxi streaming TTS, EdgeTTS, CosyVoiceSiliconflow(một phần) |
|
||||||
|
| Dịch vụ cục bộ | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, Index-TTS, PaddleSpeech | Index-TTS, PaddleSpeech, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### VAD Phát hiện hoạt động giọng nói
|
||||||
|
|
||||||
|
| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
|
||||||
|
|:---:|:---------:|:----:|:----:|:--:|
|
||||||
|
| VAD | SileroVAD | Sử dụng cục bộ | Miễn phí | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ASR Nhận dạng giọng nói
|
||||||
|
|
||||||
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| Sử dụng cục bộ | FunASR, SherpaASR | FunASR, SherpaASR |
|
||||||
|
| Gọi giao diện | FunASRServer, Volcano Engine, iFlytek, Tencent Cloud, Alibaba Cloud, Baidu Cloud, OpenAI ASR | FunASRServer |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Voiceprint Nhận dạng vân giọng
|
||||||
|
|
||||||
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
| Sử dụng cục bộ | 3D-Speaker | 3D-Speaker |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Memory Lưu trữ bộ nhớ
|
||||||
|
|
||||||
|
| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
|
||||||
|
|:------:|:---------------:|:----:|:---------:|:--:|
|
||||||
|
| Memory | mem0ai | Gọi giao diện | Hạn mức 1000 lần/tháng | |
|
||||||
|
| Memory | mem_local_short | Tóm tắt cục bộ | Miễn phí | |
|
||||||
|
| Memory | nomem | Chế độ không có bộ nhớ | Miễn phí | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Intent Nhận dạng ý định
|
||||||
|
|
||||||
|
| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
|
||||||
|
|:------:|:-------------:|:----:|:-------:|:---------------------:|
|
||||||
|
| Intent | intent_llm | Gọi giao diện | Thu phí theo LLM | Nhận dạng ý định qua mô hình lớn, tính tổng quát mạnh |
|
||||||
|
| Intent | function_call | Gọi giao diện | Thu phí theo LLM | Hoàn thành ý định qua gọi hàm mô hình lớn, tốc độ nhanh, hiệu quả tốt |
|
||||||
|
| Intent | nointent | Chế độ không có ý định | Miễn phí | Không thực hiện nhận dạng ý định, trả về trực tiếp kết quả đối thoại |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Rag Tăng cường truy xuất thông tin
|
||||||
|
|
||||||
|
| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
|
||||||
|
|:------:|:-------------:|:----:|:-------:|:---------------------:|
|
||||||
|
| Rag | ragflow | Gọi giao diện | Thu phí theo token tiêu tốn của phân đoạn, phân từ | Sử dụng chức năng tăng cường truy xuất của RagFlow, cung cấp phản hồi đối thoại chính xác hơn |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Lời cảm ơn 🙏
|
||||||
|
|
||||||
|
| Logo | Dự án/Công ty | Mô tả |
|
||||||
|
|:---:|:---:|:---|
|
||||||
|
| <img src="./docs/images/logo_bailing.png" width="160"> | [Robot đối thoại giọng nói Bailing](https://github.com/wwbin2017/bailing) | Dự án này được lấy cảm hứng từ [Robot đối thoại giọng nói Bailing](https://github.com/wwbin2017/bailing) và được triển khai trên cơ sở đó |
|
||||||
|
| <img src="./docs/images/logo_tenclass.png" width="160"> | [Shifang Ronghai](https://www.tenclass.com/) | Cảm ơn [Shifang Ronghai](https://www.tenclass.com/) đã xây dựng giao thức truyền thông tiêu chuẩn, phương án tương thích đa thiết bị và mô phạm thực hành tình huống đồng thời cao cho hệ sinh thái Xiaozhi; cung cấp tài liệu hỗ trợ kỹ thuật toàn diện cho dự án này |
|
||||||
|
| <img src="./docs/images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology](https://github.com/Eric0308) | Cảm ơn [Xuanfeng Technology](https://github.com/Eric0308) đã đóng góp khung gọi hàm, giao thức truyền thông MCP và mã triển khai cơ chế gọi dạng plugin, thông qua hệ thống điều phối lệnh tiêu chuẩn hóa và khả năng mở rộng động, đã cải thiện đáng kể hiệu suất tương tác và khả năng mở rộng chức năng của thiết bị front-end(IoT) |
|
||||||
|
| <img src="./docs/images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Cảm ơn [huangjunsen](https://github.com/huangjunsen0406) đã đóng góp module `Bảng điều khiển thông minh di động`, thực hiện điều khiển hiệu quả và tương tác thời gian thực trên thiết bị di động đa nền tảng, cải thiện đáng kể sự tiện lợi vận hành và hiệu quả quản lý của hệ thống trong tình huống di động |
|
||||||
|
| <img src="./docs/images/logo_huiyuan.png" width="160"> | [Huiyuan Design](http://ui.kwd988.net/) | Cảm ơn [Huiyuan Design](http://ui.kwd988.net/) đã cung cấp giải pháp thị giác chuyên nghiệp cho dự án này, sử dụng kinh nghiệm thực tế thiết kế phục vụ hơn nghìn doanh nghiệp, trao quyền cho trải nghiệm người dùng sản phẩm của dự án này |
|
||||||
|
| <img src="./docs/images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology](https://www.029app.com/) | Cảm ơn [Xi'an Qinren Information Technology](https://www.029app.com/) đã làm sâu sắc hệ thống thị giác của dự án này, đảm bảo tính nhất quán và khả năng mở rộng của phong cách thiết kế tổng thể trong ứng dụng đa tình huống |
|
||||||
|
| <img src="./docs/images/logo_contributors.png" width="160"> | [Người đóng góp mã](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Cảm ơn [tất cả người đóng góp mã](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), sự cống hiến của bạn khiến dự án mạnh mẽ và vững chắc hơn. |
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://star-history.com/#xinnan-tech/xiaozhi-esp32-server&Date">
|
||||||
|
|
||||||
|
<picture>
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date&theme=dark" />
|
||||||
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
|
@ -80,7 +80,7 @@ After configuring the project files, return to this tutorial to continue.
|
||||||
Open the command line tool, use the `terminal` or `command line` tool to enter your `xiaozhi-server`, and execute the following command
|
Open the command line tool, use the `terminal` or `command line` tool to enter your `xiaozhi-server`, and execute the following command
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
After the execution is complete, execute the following command to view the log information.
|
After the execution is complete, execute the following command to view the log information.
|
||||||
|
|
@ -139,6 +139,9 @@ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
|
||||||
|
|
||||||
conda install libopus -y
|
conda install libopus -y
|
||||||
conda install ffmpeg -y
|
conda install ffmpeg -y
|
||||||
|
|
||||||
|
# 在 Linux 环境下进行部署时,如出现类似缺失 libiconv.so.2 动态库的报错 请通过以下命令进行安装
|
||||||
|
conda install libiconv -y
|
||||||
```
|
```
|
||||||
|
|
||||||
Please note that the above commands are not executed successfully all at once. You need to execute them step by step. After each step, check the output log to see if it is successful.
|
Please note that the above commands are not executed successfully all at once. You need to execute them step by step. After each step, check the output log to see if it is successful.
|
||||||
|
|
@ -242,44 +245,47 @@ If you can see logs similar to the following, it means that the project service
|
||||||
250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-==========================================================
|
250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-==========================================================
|
||||||
```
|
```
|
||||||
|
|
||||||
Normally, if you run this project through source code, the log will have your interface address information.
|
正常来说,如果您是通过源码运行本项目,日志会有你的接口地址信息。
|
||||||
However, if you deploy with Docker, the interface address information given in your log is not the real interface address.
|
但是如果你用docker部署,那么你的日志里给出的接口地址信息就不是真实的接口地址。
|
||||||
|
|
||||||
The most correct way is to determine your interface address based on the computer's LAN IP.
|
最正确的方法,是根据电脑的局域网IP来确定你的接口地址。
|
||||||
If your computer's LAN IP is, for example, `192.168.1.25`, then your interface address is: `ws://192.168.1.25:8000/xiaozhi/v1/`, and the corresponding OTA address is: `http://192.168.1.25:8003/xiaozhi/ota/`.
|
如果你的电脑的局域网IP比如是`192.168.1.25`,那么你的接口地址就是:`ws://192.168.1.25:8000/xiaozhi/v1/`,对应的OTA地址就是:`http://192.168.1.25:8003/xiaozhi/ota/`。
|
||||||
|
|
||||||
This information is very useful and will be needed later when `compiling the ESP32 firmware`.
|
这个信息很有用的,后面`编译esp32固件`需要用到。
|
||||||
|
|
||||||
Next, you can start operating your ESP32 device. You can either compile the ESP32 firmware yourself or use the firmware compiled by Xiage (version 1.6.1 or above).
|
接下来,你就可以开始操作你的esp32设备了,你可以`自行编译esp32固件`也可以配置使用`虾哥编译好的1.6.1以上版本的固件`。两个任选一个
|
||||||
|
|
||||||
1. [Compile your own ESP32 firmware](firmware-build.md).
|
1、 [编译自己的esp32固件](firmware-build.md)了。
|
||||||
|
|
||||||
2. [Configure a custom server based on the firmware compiled by Xia Ge](firmware-setting.md).
|
2、 [基于虾哥编译好的固件配置自定义服务器](firmware-setting.md)了。
|
||||||
|
|
||||||
# FAQ
|
# 常见问题
|
||||||
Here are some frequently asked questions for your reference:
|
以下是一些常见问题,供参考:
|
||||||
|
|
||||||
1. [Why does Xiaozhi recognize a lot of Korean, Japanese, and English when I say something?](./FAQ.md)
|
1、[为什么我说的话,小智识别出来很多韩文、日文、英文](./FAQ.md)<br/>
|
||||||
2. [Why does the error "TTS task error file does not exist" appear?](./FAQ.md)<br/>
|
2、[为什么会出现“TTS 任务出错 文件不存在”?](./FAQ.md)<br/>
|
||||||
3. [TTS often fails and times out](./FAQ.md)<br/>
|
3、[TTS 经常失败,经常超时](./FAQ.md)<br/>
|
||||||
4. [I can connect to my own server using Wi-Fi, but not using 4G](./FAQ.md)<br/>
|
4、[使用Wifi能连接自建服务器,但是4G模式却接不上](./FAQ.md)<br/>
|
||||||
5. [How to improve Xiaozhi's dialogue response speed? ](./FAQ.md)<br/>
|
5、[如何提高小智对话响应速度?](./FAQ.md)<br/>
|
||||||
6. [I speak very slowly, and Xiaozhi always interrupts me when I pause](./FAQ.md)
|
6、[我说话很慢,停顿时小智老是抢话](./FAQ.md)<br/>
|
||||||
## Deployment related tutorials
|
## 部署相关教程
|
||||||
1. [How to automatically pull the latest code of this project, compile and start it](./dev-ops-integration.md)<br/>
|
1、[如何自动拉取本项目最新代码自动编译和启动](./dev-ops-integration.md)<br/>
|
||||||
2. [How to integrate with Nginx](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
|
2、[如何部署MQTT网关开启MQTT+UDP协议](./mqtt-gateway-integration.md)<br/>
|
||||||
## Expand related tutorials
|
3、[如何与Nginx集成](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)<br/>
|
||||||
1. [How to enable mobile phone number registration smart console](./ali-sms-integration.md)<br/>
|
## 拓展相关教程
|
||||||
2. [How to integrate HomeAssistant to achieve smart home control](./homeassistant-integration.md)
|
1、[如何开启手机号码注册智控台](./ali-sms-integration.md)<br/>
|
||||||
3. [How to enable the vision model to realize photo recognition](./mcp-vision-integration.md)
|
2、[如何集成HomeAssistant实现智能家居控制](./homeassistant-integration.md)<br/>
|
||||||
4. [How to deploy MCP access points](./mcp-endpoint-enable.md)
|
3、[如何开启视觉模型实现拍照识物](./mcp-vision-integration.md)<br/>
|
||||||
5. [How to access the MCP access point](./mcp-endpoint-integration.md)
|
4、[如何部署MCP接入点](./mcp-endpoint-enable.md)<br/>
|
||||||
6. [How to enable voiceprint recognition](./voiceprint-integration.md)
|
5、[如何接入MCP接入点](./mcp-endpoint-integration.md)<br/>
|
||||||
10. [News plugin source configuration guide](./newsnow_plugin_config.md)<br/>
|
6、[如何开启声纹识别](./voiceprint-integration.md)<br/>
|
||||||
## Tutorials on voice cloning and local voice deployment
|
7、[新闻插件源配置指南](./newsnow_plugin_config.md)<br/>
|
||||||
1. [How to deploy and integrate index-tts local voice](./index-stream-integration.md)<br/>
|
8、[天气插件使用指南](./weather-integration.md)<br/>
|
||||||
2. [How to deploy integrated fish-speech local voice](./fish-speech-integration.md)<br/>
|
## 语音克隆、本地语音部署相关教程
|
||||||
3. [How to deploy and integrate PaddleSpeech local voice](./paddlespeech-deploy.md)<br/>
|
1、[如何在智控台克隆音色](./huoshan-streamTTS-voice-cloning.md)<br/>
|
||||||
## Performance Testing Tutorial
|
2、[如何部署集成index-tts本地语音](./index-stream-integration.md)<br/>
|
||||||
1. [Component Speed Test Guide](./performance_tester.md)<br/>
|
3、[如何部署集成fish-speech本地语音](./fish-speech-integration.md)<br/>
|
||||||
2. [Publish test results regularly](https://github.com/xinnan-tech/xiaozhi-performance-research)
|
4、[如何部署集成PaddleSpeech本地语音](./paddlespeech-deploy.md)<br/>
|
||||||
|
## 性能测试教程
|
||||||
|
1、[各组件速度测试指南](./performance_tester.md)<br/>
|
||||||
|
2、[定期公开测试结果](https://github.com/xinnan-tech/xiaozhi-performance-research)<br/>
|
||||||
|
|
|
||||||
|
|
@ -355,6 +355,9 @@ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
|
||||||
|
|
||||||
conda install libopus -y
|
conda install libopus -y
|
||||||
conda install ffmpeg -y
|
conda install ffmpeg -y
|
||||||
|
|
||||||
|
# 在 Linux 环境下进行部署时,如出现类似缺失 libiconv.so.2 动态库的报错 请通过以下命令进行安装
|
||||||
|
conda install libiconv -y
|
||||||
```
|
```
|
||||||
|
|
||||||
Please note that the above commands are not executed successfully all at once. You need to execute them step by step. After each step, check the output log to see if it is successful.
|
Please note that the above commands are not executed successfully all at once. You need to execute them step by step. After each step, check the output log to see if it is successful.
|
||||||
|
|
@ -460,28 +463,30 @@ Next, you can start operating your ESP32 device. You can either compile the ESP3
|
||||||
# FAQ
|
# FAQ
|
||||||
Here are some frequently asked questions for your reference:
|
Here are some frequently asked questions for your reference:
|
||||||
|
|
||||||
1. [Why does Xiaozhi recognize a lot of Korean, Japanese, and English when I say something?](./FAQ.md)
|
1、[为什么我说的话,小智识别出来很多韩文、日文、英文](./FAQ.md)<br/>
|
||||||
2. [Why does the error "TTS task error file does not exist" appear?](./FAQ.md)<br/>
|
2、[为什么会出现“TTS 任务出错 文件不存在”?](./FAQ.md)<br/>
|
||||||
3. [TTS often fails and times out](./FAQ.md)<br/>
|
3、[TTS 经常失败,经常超时](./FAQ.md)<br/>
|
||||||
4. [I can connect to my own server using Wi-Fi, but not using 4G](./FAQ.md)<br/>
|
4、[使用Wifi能连接自建服务器,但是4G模式却接不上](./FAQ.md)<br/>
|
||||||
5. [How to improve Xiaozhi's dialogue response speed? ](./FAQ.md)<br/>
|
5、[如何提高小智对话响应速度?](./FAQ.md)<br/>
|
||||||
6. [I speak very slowly, and Xiaozhi always interrupts me when I pause](./FAQ.md)
|
6、[我说话很慢,停顿时小智老是抢话](./FAQ.md)<br/>
|
||||||
## Deployment related tutorials
|
## 部署相关教程
|
||||||
1. [How to automatically pull the latest code of this project, compile and start it](./dev-ops-integration.md)<br/>
|
1、[如何自动拉取本项目最新代码自动编译和启动](./dev-ops-integration.md)<br/>
|
||||||
2. [How to integrate with Nginx](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
|
2、[如何部署MQTT网关开启MQTT+UDP协议](./mqtt-gateway-integration.md)<br/>
|
||||||
## Expand related tutorials
|
3、[如何与Nginx集成](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)<br/>
|
||||||
1. [How to enable mobile phone number registration smart console](./ali-sms-integration.md)<br/>
|
## 拓展相关教程
|
||||||
2. [How to integrate HomeAssistant to achieve smart home control](./homeassistant-integration.md)
|
1、[如何开启手机号码注册智控台](./ali-sms-integration.md)<br/>
|
||||||
3. [How to enable the vision model to realize photo recognition](./mcp-vision-integration.md)
|
2、[如何集成HomeAssistant实现智能家居控制](./homeassistant-integration.md)<br/>
|
||||||
4. [How to deploy MCP access points](./mcp-endpoint-enable.md)
|
3、[如何开启视觉模型实现拍照识物](./mcp-vision-integration.md)<br/>
|
||||||
5. [How to access the MCP access point](./mcp-endpoint-integration.md)
|
4、[如何部署MCP接入点](./mcp-endpoint-enable.md)<br/>
|
||||||
6. [How to enable voiceprint recognition](./voiceprint-integration.md)
|
5、[如何接入MCP接入点](./mcp-endpoint-integration.md)<br/>
|
||||||
7. [News plugin source configuration guide](./newsnow_plugin_config.md)<br/>
|
6、[如何开启声纹识别](./voiceprint-integration.md)<br/>
|
||||||
8. [Weather Plugin Usage Guide](./weather-integration.md)
|
7、[新闻插件源配置指南](./newsnow_plugin_config.md)<br/>
|
||||||
## Tutorials on voice cloning and local voice deployment
|
8、[天气插件使用指南](./weather-integration.md)<br/>
|
||||||
1. [How to deploy and integrate index-tts local voice](./index-stream-integration.md)<br/>
|
## 语音克隆、本地语音部署相关教程
|
||||||
2. [How to deploy integrated fish-speech local voice](./fish-speech-integration.md)<br/>
|
1、[如何在智控台克隆音色](./huoshan-streamTTS-voice-cloning.md)<br/>
|
||||||
3. [How to deploy and integrate PaddleSpeech local voice](./paddlespeech-deploy.md)<br/>
|
2、[如何部署集成index-tts本地语音](./index-stream-integration.md)<br/>
|
||||||
## Performance Testing Tutorial
|
3、[如何部署集成fish-speech本地语音](./fish-speech-integration.md)<br/>
|
||||||
1. [Component Speed Test Guide](./performance_tester.md)<br/>
|
4、[如何部署集成PaddleSpeech本地语音](./paddlespeech-deploy.md)<br/>
|
||||||
2. [Publish test results regularly](https://github.com/xinnan-tech/xiaozhi-performance-research)
|
## 性能测试教程
|
||||||
|
1、[各组件速度测试指南](./performance_tester.md)<br/>
|
||||||
|
2、[定期公开测试结果](https://github.com/xinnan-tech/xiaozhi-performance-research)<br/>
|
||||||
|
|
|
||||||
55
docs/FAQ.md
|
|
@ -59,35 +59,38 @@ VAD:
|
||||||
min_silence_duration_ms: 700 # If the pauses in speaking are long, you can increase this value
|
min_silence_duration_ms: 700 # If the pauses in speaking are long, you can increase this value
|
||||||
```
|
```
|
||||||
|
|
||||||
### 7. Deployment related tutorials
|
### 7、部署相关教程
|
||||||
1. [How to perform the simplest deployment](./Deployment.md)
|
1、[如何进行最简化部署](./Deployment.md)<br/>
|
||||||
2. [How to deploy all modules](./Deployment_all.md)<br/>
|
2、[如何进行全模块部署](./Deployment_all.md)<br/>
|
||||||
2. [How to deploy an MQTT gateway and enable the MQTT+UDP protocol](./mqtt-gateway-integration.md)
|
3、[如何部署MQTT网关开启MQTT+UDP协议](./mqtt-gateway-integration.md)<br/>
|
||||||
3. [How to automatically pull the latest code of this project, compile and start it](./dev-ops-integration.md)<br/>
|
4、[如何自动拉取本项目最新代码自动编译和启动](./dev-ops-integration.md)<br/>
|
||||||
4. [How to integrate with Nginx](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
|
5、[如何与Nginx集成](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)<br/>
|
||||||
|
|
||||||
### 8. Compile firmware related tutorials
|
### 9、编译固件相关教程
|
||||||
1. [How to compile Xiaozhi firmware yourself](./firmware-build.md)<br/>
|
1、[如何自己编译小智固件](./firmware-build.md)<br/>
|
||||||
2. [How to modify the OTA address based on the firmware compiled by Xia Ge](./firmware-setting.md)<br/>
|
2、[如何基于虾哥编译好的固件修改OTA地址](./firmware-setting.md)<br/>
|
||||||
|
|
||||||
### 8. Expand related tutorials
|
### 10、拓展相关教程
|
||||||
1. [How to enable mobile phone number registration smart console](./ali-sms-integration.md)<br/>
|
1、[如何开启手机号码注册智控台](./ali-sms-integration.md)<br/>
|
||||||
2. [How to integrate HomeAssistant to achieve smart home control](./homeassistant-integration.md)
|
2、[如何集成HomeAssistant实现智能家居控制](./homeassistant-integration.md)<br/>
|
||||||
3. [How to enable the vision model to realize photo recognition](./mcp-vision-integration.md)
|
3、[如何开启视觉模型实现拍照识物](./mcp-vision-integration.md)<br/>
|
||||||
4. [How to deploy MCP access points](./mcp-endpoint-enable.md)
|
4、[如何部署MCP接入点](./mcp-endpoint-enable.md)<br/>
|
||||||
5. [How to access the MCP access point](./mcp-endpoint-integration.md)
|
5、[如何接入MCP接入点](./mcp-endpoint-integration.md)<br/>
|
||||||
6. [How to enable voiceprint recognition](./voiceprint-integration.md)
|
6、[MCP方法如何获取设备信息](./mcp-get-device-info.md)<br/>
|
||||||
10. [News plugin source configuration guide](./newsnow_plugin_config.md)<br/>
|
7、[如何开启声纹识别](./voiceprint-integration.md)<br/>
|
||||||
|
8、[新闻插件源配置指南](./newsnow_plugin_config.md)<br/>
|
||||||
|
9、[知识库ragflow集成指南](./ragflow-integration.md)<br/>
|
||||||
|
|
||||||
### 9. Tutorials on voice cloning and local voice deployment
|
### 11、语音克隆、本地语音部署相关教程
|
||||||
1. [How to deploy and integrate index-tts local voice](./index-stream-integration.md)<br/>
|
1、[如何在智控台克隆音色](./huoshan-streamTTS-voice-cloning.md)<br/>
|
||||||
2. [How to deploy integrated fish-speech local voice](./fish-speech-integration.md)<br/>
|
2、[如何部署集成index-tts本地语音](./index-stream-integration.md)<br/>
|
||||||
3. [How to deploy and integrate PaddleSpeech local voice](./paddlespeech-deploy.md)<br/>
|
3、[如何部署集成fish-speech本地语音](./fish-speech-integration.md)<br/>
|
||||||
|
4、[如何部署集成PaddleSpeech本地语音](./paddlespeech-deploy.md)<br/>
|
||||||
|
|
||||||
### 10. Performance Testing Tutorial
|
### 12、性能测试教程
|
||||||
1. [Component Speed Test Guide](./performance_tester.md)<br/>
|
1、[各组件速度测试指南](./performance_tester.md)<br/>
|
||||||
2. [Publish test results regularly](https://github.com/xinnan-tech/xiaozhi-performance-research)
|
2、[定期公开测试结果](https://github.com/xinnan-tech/xiaozhi-performance-research)<br/>
|
||||||
|
|
||||||
### 13. For more questions, please contact us for feedback💬
|
### 13、更多问题,可联系我们反馈 💬
|
||||||
|
|
||||||
Please submit your issues at [issues](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues).
|
可以在[issues](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues)提交您的问题。
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ docker build -t xiaozhi-esp32-server:web_latest -f ./Dockerfile-web .
|
||||||
# After compilation is complete, you can use docker-compose to start the project
|
# After compilation is complete, you can use docker-compose to start the project
|
||||||
# You need to modify docker-compose.yml to the image version you compiled yourself
|
# You need to modify docker-compose.yml to the image version you compiled yourself
|
||||||
cd main/xiaozhi-server
|
cd main/xiaozhi-server
|
||||||
docker-compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ This string, which we call "device list string", needs to be saved as it will be
|
||||||
|
|
||||||
Log in to the Smart Console using an administrator account. In Agent Management, find your agent and click Configure Role.
|
Log in to the Smart Console using an administrator account. In Agent Management, find your agent and click Configure Role.
|
||||||
|
|
||||||
Set intent recognition to `Function Call` or `LLM Intent Recognition`. You will see an `Edit Function` button on the right. Click the `Edit Function` button and the `Function Management` dialog box will pop up.
|
将意图识别设置成`外挂的大模型意图识别`或`大模型自主函数调用`。这时你会看到右侧有一个`编辑功能`。点击`编辑功能`按钮,会弹出`功能管理`的框。
|
||||||
|
|
||||||
In the `Feature Management` box, you need to check `HomeAssistant device status query` and `HomeAssistant device status modification`.
|
In the `Feature Management` box, you need to check `HomeAssistant device status query` and `HomeAssistant device status modification`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,56 @@
|
||||||
# Volcano Bidirectional Streaming TTS + Voice Cloning Configuration Tutorial
|
# 智控台 火山双流式语音合成+音色克隆配置教程
|
||||||
In a single-module deployment, voice cloning is performed while using the Volcano Engine bidirectional streaming speech synthesis service, supporting WebSocket protocol streaming calls.
|
|
||||||
### 1. Open the Volcano Engine service
|
|
||||||
Visit https://console.volcengine.com/speech/app and create an app in the App Manager. Select the speech synthesis model and the sound replication model. Click the sound replication model in the list on the left and scroll down to obtain the App ID, Access Token, Cluster ID, and Sound ID (S_xxxxx).
|
|
||||||
### 2. Clone the sound
|
|
||||||
To clone the voice, please refer to the tutorial https://github.com/104gogo/huoshan-voice-copy
|
|
||||||
|
|
||||||
Prepare a 10-30 second audio file (.wav format) and add it to the cloned project. Fill the key obtained from the platform into ```uploadAndStatus.py``` and ```tts_http_demo.py```
|
本教程分为4个阶段:准备阶段、配置阶段、克隆阶段、使用阶段。主要是介绍通过智控台配置火山双流式语音合成+音色克隆的过程。
|
||||||
|
|
||||||
In uploadAndStatus.py, change audio_path= to your own .wav file name
|
## 第一阶段:准备阶段
|
||||||
```Python
|
超级管理员先预先把火山引擎服务开通好,获取到App Id,Access Token。默认火上引擎会赠送一个音色资源。这个音色资源需要把它复制到本项目里。
|
||||||
train(appid=appid, token=token, audio_path=r".\audios\xiaohe.wav", spk_id=spk_id)
|
|
||||||
```
|
|
||||||
|
|
||||||
Run the following command to generate test_submit.mp3 and click Play to listen to the cloned effect.
|
如果你想克隆多个音色,需要购买开通多个音色资源。只要把每个音色资源的声音ID(S_xxxxx)复制到本项目。然后分配给系统的账号使用即可。以下是详细步骤:
|
||||||
|
|
||||||
```Python
|
### 1.开通火山引擎服务
|
||||||
python uploadAndStatus.py
|
访问 https://console.volcengine.com/speech/app 在应用管理创建应用,勾选语音合成大模型和声音复刻大模型。
|
||||||
python tts_http_demo.py
|
|
||||||
```
|
|
||||||
Go back to the Volcano Engine console page and refresh it to see that the status of the sound replication details is successful.
|
|
||||||
### 3. Fill in the configuration file
|
|
||||||
Fill in the key applied for by the Volcano Engine service into the HuoshanDoubleStreamTTS configuration file in .config.yaml
|
|
||||||
|
|
||||||
Modify the resource_id parameter to ``` volc.megatts.default```
|
### 2.获取音色资源ID
|
||||||
(See the official documentation at https://www.volcengine.com/docs/6561/1329505)
|
访问 https://console.volcengine.com/speech/service/9999 复制三项内容,分别是App Id,Access Token以及声音ID(S_xxxxx)。如图
|
||||||
Fill in the sound ID (S_xxxxx) of the speaker parameter
|
|
||||||
|
|
||||||
Start the service. If the sound produced by Xiaozhi when waking him up is the cloned one, it means success.
|

|
||||||
|
|
||||||
|
## 第二阶段:配置火山引擎服务
|
||||||
|
|
||||||
|
### 1.填写火山引擎配置
|
||||||
|
|
||||||
|
使用超级管理员账号登录智控台,点击顶部【模型配置】,再点击模型配置页面左侧的【语音合成】,搜索找到“火山双流式语音合成”,点击修改,将你火山引擎的`App Id`填入到【应用ID】字段里,将`Access Token`填入到【访问令牌】字段里。然后保存。
|
||||||
|
|
||||||
|
### 2.将音色资源ID分配给系统账号
|
||||||
|
|
||||||
|
使用超级管理员账号登录智控台,点击顶部【音色克隆】、【音色资源】。
|
||||||
|
|
||||||
|
点击新增按钮,在【平台名称】选择“火山双流式语音合成”;
|
||||||
|
|
||||||
|
在【音色资源ID】填入你火山引擎的声音资源ID(S_xxxxx),填入后按回车;
|
||||||
|
|
||||||
|
在【归属账号】选择你要分配给的系统账号,你可以分配给你自己。然后点击保存
|
||||||
|
|
||||||
|
## 第三阶段:克隆阶段
|
||||||
|
|
||||||
|
如果登录后,点击顶部【音色克隆】》【音色克隆】,显示【您的账号暂无音色资源请联系管理员分配音色资源】,说明你在第二阶段还没有把音色资源ID分配给这个账号。那就是回到第二阶段,分配音色资源给对应的账号。
|
||||||
|
|
||||||
|
如果登录后,点击顶部【音色克隆】》【音色克隆】,能看到对应的音色列表。请继续。
|
||||||
|
|
||||||
|
在列表里会看到对应的音色列表。选择其中一个音色资源,点击【上传音频】按钮。上传后,可以试听一下声音或者截取某段声音。确认后点击【上传音频】按钮。
|
||||||
|

|
||||||
|
|
||||||
|
上传音频后,在列表里会看到对应的音色会变成“待复刻”状态。点击【立即复刻】按钮。等1~2秒会返回结果。
|
||||||
|
|
||||||
|
如果复刻失败,请将鼠标放到“错误信息”图标上,会显示失败的原因。
|
||||||
|
|
||||||
|
如果复刻成功,在列表里会看到对应的音色会变成“训练成功”状态。此时你可以点击【声音名称】栏的修改按钮,修改音色资源的名称,方便后期选择使用。
|
||||||
|
|
||||||
|
## 第四阶段:使用阶段
|
||||||
|
|
||||||
|
点击顶部【智能体管理】,选择任意一个智能体,点击【配置角色】按钮。
|
||||||
|
|
||||||
|
语音合成(TTS)选择“火山双流式语音合成”。在列表里,找到名字带有“克隆音色”的音色资源(如图),选择它,点击保存。
|
||||||
|

|
||||||
|
|
||||||
|
接下来,可以唤醒小智和它对话。
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 298 KiB After Width: | Height: | Size: 100 KiB |
BIN
docs/images/image-clone-integration-01.png
Normal file
|
After Width: | Height: | Size: 143 KiB |
BIN
docs/images/image-clone-integration-02.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
docs/images/image-clone-integration-03.png
Normal file
|
After Width: | Height: | Size: 129 KiB |
|
|
@ -1,14 +1,18 @@
|
||||||
# IndexStreamTTS Usage Guide
|
# IndexStreamTTS Usage Guide
|
||||||
|
|
||||||
## Environment Preparation
|
## 环境准备
|
||||||
### 1. Clone the project (note that the release version of VLLM1.0 is used here)
|
### 1. 克隆项目
|
||||||
```bash
|
```bash
|
||||||
https://github.com/Ksuriuri/index-tts-vllm/releases/tag/IndexTTS-vLLM-1.0
|
git clone https://github.com/Ksuriuri/index-tts-vllm.git
|
||||||
```
|
```
|
||||||
Enter the unzipped directory
|
Enter the unzipped directory
|
||||||
```bash
|
```bash
|
||||||
cd index-tts-vllm
|
cd index-tts-vllm
|
||||||
```
|
```
|
||||||
|
切换到指定版本 (使用VLLM-0.10.2的历史版本)
|
||||||
|
```bash
|
||||||
|
git checkout 224e8d5e5c8f66801845c66b30fa765328fd0be3
|
||||||
|
```
|
||||||
|
|
||||||
### 2. Create and activate a conda environment
|
### 2. Create and activate a conda environment
|
||||||
```bash
|
```bash
|
||||||
|
|
@ -34,22 +38,23 @@ Cuda compilation tools, release 12.8, V12.8.89
|
||||||
```bash
|
```bash
|
||||||
pip install torch torchvision
|
pip install torch torchvision
|
||||||
```
|
```
|
||||||
You need PyTorch version 2.8.0 (corresponding to VLLM 0.10.2). For specific installation instructions, please refer to the [PyTorch official website](https://pytorch.org/get-started/locally/)
|
需要 pytorch 版本 2.8.0(对应 vllm 0.10.2),具体安装指令请参考:[pytorch 官网](https://pytorch.org/get-started/locally/)
|
||||||
|
|
||||||
### 4. Install dependencies
|
### 4. Install dependencies
|
||||||
```bash
|
```bash
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5. Download model weights
|
### 5. 下载模型权重
|
||||||
This is the official weight file, which can be downloaded to any local path. It supports the weight of IndexTTS-1.5.
|
### 方案一:下载官方权重文件后转换
|
||||||
|
此为官方权重文件,下载到本地任意路径即可,支持 IndexTTS-1.5 的权重
|
||||||
| HuggingFace | ModelScope |
|
| HuggingFace | ModelScope |
|
||||||
|---------------------------------------------------------------|---------------------------------------------------------------------|
|
|---------------------------------------------------------------|---------------------------------------------------------------------|
|
||||||
| [IndexTTS](https://huggingface.co/IndexTeam/Index-TTS) | [IndexTTS](https://modelscope.cn/models/IndexTeam/Index-TTS) |
|
| [IndexTTS](https://huggingface.co/IndexTeam/Index-TTS) | [IndexTTS](https://modelscope.cn/models/IndexTeam/Index-TTS) |
|
||||||
| [IndexTTS-1.5](https://huggingface.co/IndexTeam/IndexTTS-1.5) | [IndexTTS-1.5](https://modelscope.cn/models/IndexTeam/IndexTTS-1.5) |
|
| [IndexTTS-1.5](https://huggingface.co/IndexTeam/IndexTTS-1.5) | [IndexTTS-1.5](https://modelscope.cn/models/IndexTeam/IndexTTS-1.5) |
|
||||||
|
|
||||||
The following is an example of how to install ModelScope
|
下面以ModelScope的安装方法为例
|
||||||
### Please note: Git needs to be installed and initialized to enable LFS (if already installed, you can skip this step)
|
#### 请注意:git需要安装并初始化启用lfs(如已安装可以跳过)
|
||||||
```bash
|
```bash
|
||||||
sudo apt-get install git-lfs
|
sudo apt-get install git-lfs
|
||||||
git lfs install
|
git lfs install
|
||||||
|
|
@ -61,7 +66,7 @@ cd model_dir
|
||||||
git clone https://www.modelscope.cn/IndexTeam/IndexTTS-1.5.git
|
git clone https://www.modelscope.cn/IndexTeam/IndexTTS-1.5.git
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5. Model weight conversion
|
#### 模型权重转换
|
||||||
```bash
|
```bash
|
||||||
bash convert_hf_format.sh /path/to/your/model_dir
|
bash convert_hf_format.sh /path/to/your/model_dir
|
||||||
```
|
```
|
||||||
|
|
@ -169,10 +174,12 @@ The log will be output in tmp/server.log. You can view the log status by the fol
|
||||||
```bash
|
```bash
|
||||||
tail -f tmp/server.log
|
tail -f tmp/server.log
|
||||||
```
|
```
|
||||||
## Tone Configuration
|
如果显卡内存足够,可在脚本中添加启动参数 ----gpu_memory_utilization 来调整显存占用比例,默认值为 0.25
|
||||||
index-tts-vllm supports registering custom timbres through configuration files, and supports single-timbre and mixed-timbre configurations.
|
|
||||||
Configure custom timbre in the assets/speaker.json file in the project root directory
|
## 音色配置
|
||||||
### Configuration format description
|
index-tts-vllm支持通过配置文件注册自定义音色,支持单音色和混合音色配置。
|
||||||
|
在项目根目录下的assets/speaker.json文件中配置自定义音色
|
||||||
|
### 配置格式说明
|
||||||
```bash
|
```bash
|
||||||
{
|
{
|
||||||
"Speaker Name 1": [
|
"Speaker Name 1": [
|
||||||
|
|
@ -184,5 +191,5 @@ Configure custom timbre in the assets/speaker.json file in the project root dire
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
### Note (need to restart the service to register)
|
### 注意 (配置角色后需重启服务进行音色注册)
|
||||||
After adding, you need to add the corresponding speaker in the smart console (for single module, change the corresponding voice)
|
添加后需在智控台中添加相应的说话人(单模块则更换相应的voice)
|
||||||
|
|
|
||||||
40
docs/mcp-get-device-info.md
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
# MCP 方法如何获取设备信息
|
||||||
|
|
||||||
|
本教程将指导你如何使用MCP方法获取设备信息。
|
||||||
|
|
||||||
|
第一步:自定义你的`agent-base-prompt.txt`文件
|
||||||
|
|
||||||
|
把xiaozhi-server目录的`agent-base-prompt.txt`文件内容复制到你的`data`目录下,并重命名为`.agent-base-prompt.txt`。
|
||||||
|
|
||||||
|
第二步:修改`data/.agent-base-prompt.txt`文件,找到`<context>`标签,在标签内容中添加以下代码内容:
|
||||||
|
```
|
||||||
|
- **设备ID:** {{device_id}}
|
||||||
|
```
|
||||||
|
|
||||||
|
添加完成后,你的`data/.agent-base-prompt.txt`文件的`<context>`标签内容大致如下:
|
||||||
|
```
|
||||||
|
<context>
|
||||||
|
【重要!以下信息已实时提供,无需调用工具查询,请直接使用:】
|
||||||
|
- **设备ID:** {{device_id}}
|
||||||
|
- **当前时间:** {{current_time}}
|
||||||
|
- **今天日期:** {{today_date}} ({{today_weekday}})
|
||||||
|
- **今天农历:** {{lunar_date}}
|
||||||
|
- **用户所在城市:** {{local_address}}
|
||||||
|
- **当地未来7天天气:** {{weather_info}}
|
||||||
|
</context>
|
||||||
|
```
|
||||||
|
|
||||||
|
第三步:修改`data/.config.yaml`文件,找到`agent-base-prompt`配置,修改前内容如下:
|
||||||
|
```
|
||||||
|
prompt_template: agent-base-prompt.txt
|
||||||
|
```
|
||||||
|
修改成
|
||||||
|
```
|
||||||
|
prompt_template: data/.agent-base-prompt.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
第四步:重启你的xiaozhi-server服务。
|
||||||
|
|
||||||
|
第五步:在你的mcp方法增加名称为`device_id`,类型为`string`,描述为`设备ID`的参数。
|
||||||
|
|
||||||
|
第六步:重新唤醒小智,让他调用mcp方法,查看你的mcp方法是否可以获取`设备ID`。
|
||||||
|
|
@ -11,12 +11,12 @@ Prepare the `mqtt-websocket` connection address of your `xiaozhi-server`. Based
|
||||||
|
|
||||||
1. If you are deploying from source code, your `mqtt-websocket` address is:
|
1. If you are deploying from source code, your `mqtt-websocket` address is:
|
||||||
```
|
```
|
||||||
ws://127.0.0.1:8000/xiaozhi/v1?from=mqtt_gateway
|
ws://127.0.0.1:8000/xiaozhi/v1/?from=mqtt_gateway
|
||||||
```
|
```
|
||||||
|
|
||||||
2. If you are deploying with docker, your `mqtt-websocket` address is
|
2. If you are deploying with docker, your `mqtt-websocket` address is
|
||||||
```
|
```
|
||||||
ws://your host LAN IP:8000/xiaozhi/v1?from=mqtt_gateway
|
ws://你宿主机局域网IP:8000/xiaozhi/v1/?from=mqtt_gateway
|
||||||
```
|
```
|
||||||
|
|
||||||
## Important Note
|
## Important Note
|
||||||
|
|
@ -53,7 +53,7 @@ cp config/mqtt.json.example config/mqtt.json
|
||||||
{
|
{
|
||||||
"production": {
|
"production": {
|
||||||
"chat_servers": [
|
"chat_servers": [
|
||||||
"ws://127.0.0.1:8000/xiaozhi/v1?from=mqtt_gateway"
|
"ws://127.0.0.1:8000/xiaozhi/v1/?from=mqtt_gateway"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"debug": false,
|
"debug": false,
|
||||||
|
|
|
||||||
259
docs/ragflow-integration.md
Normal file
|
|
@ -0,0 +1,259 @@
|
||||||
|
# ragflow 集成指南
|
||||||
|
|
||||||
|
本教程主要是是两部分
|
||||||
|
|
||||||
|
- 一、如何部署ragflow
|
||||||
|
- 二、如何在智控台配置ragflow接口
|
||||||
|
|
||||||
|
如果您对ragflow很熟悉,且已经部署了ragflow,可直接跳过第一部分,直接进入第二部分。但是如果你希望有人指导你部署ragflow,让它能够和`xiaozhi-esp32-server`共同使用`mysql`、`redis`基础服务,以减少资源成本,你需要从第一部分开始。
|
||||||
|
|
||||||
|
# 第一部分 如何部署ragflow
|
||||||
|
## 第一步, 确认mysql、redis是否可用
|
||||||
|
|
||||||
|
ragflow需要依赖`mysql`数据库。如果你之前已经部署`智控台`,说明你已经安装了`mysql`。你可以共用它。
|
||||||
|
|
||||||
|
你可以你试一下在宿主机使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
|
||||||
|
``` shell
|
||||||
|
telnet 127.0.0.1 3306
|
||||||
|
|
||||||
|
telnet 127.0.0.1 6379
|
||||||
|
```
|
||||||
|
如果能访问到`3306`端口和`6379`端口,请忽略以下的内容,直接进入第二步。
|
||||||
|
|
||||||
|
如果不能访问,你需要回忆一下,你的`mysql`是怎么安装的。
|
||||||
|
|
||||||
|
如果你的mysql是通过自己使用安装包安装的,说明你的`mysql`做了网络隔离。你可能先解决访问`mysql`的`3306`端口这个问题。
|
||||||
|
|
||||||
|
如果你`mysql`是通过本项目的`docker-compose_all.yml`安装的。你需要找一下你当时创建数据库的`docker-compose_all.yml`文件,修改以下的内容
|
||||||
|
|
||||||
|
修改前
|
||||||
|
``` yaml
|
||||||
|
xiaozhi-esp32-server-db:
|
||||||
|
...
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
expose:
|
||||||
|
- "3306:3306"
|
||||||
|
xiaozhi-esp32-server-redis:
|
||||||
|
...
|
||||||
|
expose:
|
||||||
|
- 6379
|
||||||
|
```
|
||||||
|
|
||||||
|
修改后
|
||||||
|
``` yaml
|
||||||
|
xiaozhi-esp32-server-db:
|
||||||
|
...
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
xiaozhi-esp32-server-redis:
|
||||||
|
...
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
```
|
||||||
|
|
||||||
|
注意是将`xiaozhi-esp32-server-db`和`xiaozhi-esp32-server-redis`下面的`expose`改成`ports`。改完后,需要重新启动。以下是重启mysql的命令:
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
# 进入你docker-compose_all.yml所在的文件夹,例如我的是xiaozhi-server
|
||||||
|
cd xiaozhi-server
|
||||||
|
docker compose -f docker-compose_all.yml down
|
||||||
|
docker compose -f docker-compose.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
启动完后,在宿主机再使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
|
||||||
|
``` shell
|
||||||
|
telnet 127.0.0.1 3306
|
||||||
|
|
||||||
|
telnet 127.0.0.1 6379
|
||||||
|
```
|
||||||
|
正常来说这样就可以访问的了。
|
||||||
|
|
||||||
|
## 第二步, 创建数据库和表
|
||||||
|
如果你的宿主机,能正常访问mysql数据库,那就在mysql上创建一个名字为`rag_flow`的数据库和`rag_flow`用户,密码为`infini_rag_flow`。
|
||||||
|
|
||||||
|
``` sql
|
||||||
|
-- 创建数据库
|
||||||
|
CREATE DATABASE IF NOT EXISTS rag_flow CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
-- 创建用户并授权
|
||||||
|
CREATE USER IF NOT EXISTS 'rag_flow'@'%' IDENTIFIED BY 'infini_rag_flow';
|
||||||
|
GRANT ALL PRIVILEGES ON rag_flow.* TO 'rag_flow'@'%';
|
||||||
|
|
||||||
|
-- 刷新权限
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
```
|
||||||
|
|
||||||
|
## 第三步, 下载ragflow项目
|
||||||
|
|
||||||
|
你需要在你电脑找一个文件夹,用来存放ragflow项目。例如我在`/home/system/xiaozhi`文件夹。
|
||||||
|
|
||||||
|
你可以使用`git`命令,将ragflow项目下载到这个文件夹,本教程使用的是`v0.22.0`版本进行安装部署。
|
||||||
|
```
|
||||||
|
git clone https://ghfast.top/https://github.com/infiniflow/ragflow.git
|
||||||
|
cd ragflow
|
||||||
|
git checkout v0.22.0
|
||||||
|
```
|
||||||
|
下载完后,进入`docker`文件夹。
|
||||||
|
``` shell
|
||||||
|
cd docker
|
||||||
|
```
|
||||||
|
修改`ragflow/docker`文件夹下的`docker-compose.yml`文件,将`ragflow-cpu`和`ragflow-gpu`服务的`depends_on`配置去掉,用于解除`ragflow-cpu`服务对`mysql`的依赖。
|
||||||
|
|
||||||
|
这是修改前:
|
||||||
|
``` yaml
|
||||||
|
ragflow-cpu:
|
||||||
|
depends_on:
|
||||||
|
mysql:
|
||||||
|
condition: service_healthy
|
||||||
|
profiles:
|
||||||
|
- cpu
|
||||||
|
...
|
||||||
|
ragflow-gpu:
|
||||||
|
depends_on:
|
||||||
|
mysql:
|
||||||
|
condition: service_healthy
|
||||||
|
profiles:
|
||||||
|
- gpu
|
||||||
|
```
|
||||||
|
这是修改后:
|
||||||
|
``` yaml
|
||||||
|
ragflow-cpu:
|
||||||
|
profiles:
|
||||||
|
- cpu
|
||||||
|
...
|
||||||
|
ragflow-gpu:
|
||||||
|
profiles:
|
||||||
|
- gpu
|
||||||
|
```
|
||||||
|
|
||||||
|
接着,修改`ragflow/docker`文件夹下的`docker-compose-base.yml`文件,去掉`mysql`和`redis`的配置。
|
||||||
|
|
||||||
|
例如,删除前:
|
||||||
|
``` yaml
|
||||||
|
services:
|
||||||
|
minio:
|
||||||
|
image: quay.io/minio/minio:RELEASE.2025-06-13T11-33-47Z
|
||||||
|
...
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.0
|
||||||
|
...
|
||||||
|
redis:
|
||||||
|
image: redis:6.2-alpine
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
删除后
|
||||||
|
``` yaml
|
||||||
|
services:
|
||||||
|
minio:
|
||||||
|
image: quay.io/minio/minio:RELEASE.2025-06-13T11-33-47Z
|
||||||
|
...
|
||||||
|
```
|
||||||
|
## 第四步,修改环境变量配置
|
||||||
|
|
||||||
|
编辑`ragflow/docker`文件夹下的`.env`文件,找到以下配置,逐个搜索,逐个修改!逐个搜索,逐个修改!
|
||||||
|
|
||||||
|
``` env
|
||||||
|
# 端口设置
|
||||||
|
SVR_WEB_HTTP_PORT=8008 # HTTP端口
|
||||||
|
SVR_WEB_HTTPS_PORT=8009 # HTTPS端口
|
||||||
|
# MySQL配置 - 修改为您本地MySQL的信息
|
||||||
|
MYSQL_HOST=host.docker.internal # 使用host.docker.internal让容器访问主机服务
|
||||||
|
MYSQL_PORT=3306 # 本地MySQL端口
|
||||||
|
MYSQL_USER=rag_flow # 上面创建的用户名,如果没有这项就增加这一项
|
||||||
|
MYSQL_PASSWORD=infini_rag_flow # 上面设置的密码
|
||||||
|
MYSQL_DBNAME=rag_flow # 数据库名称
|
||||||
|
|
||||||
|
# Redis配置 - 修改为您本地Redis的信息
|
||||||
|
REDIS_HOST=host.docker.internal # 使用host.docker.internal让容器访问主机服务
|
||||||
|
REDIS_PORT=6379 # 本地Redis端口
|
||||||
|
REDIS_PASSWORD= # 如果你的Redis没有设置密码,就按这样子填写,否则填写密码
|
||||||
|
```
|
||||||
|
|
||||||
|
注意,如果你的Redis没有设置密码,还要修改`ragflow/docker`文件夹下`service_conf.yaml.template`,将`infini_rag_flow`替换成空字符串。
|
||||||
|
|
||||||
|
修改前
|
||||||
|
``` shell
|
||||||
|
redis:
|
||||||
|
db: 1
|
||||||
|
password: '${REDIS_PASSWORD:-infini_rag_flow}'
|
||||||
|
host: '${REDIS_HOST:-redis}:6379'
|
||||||
|
```
|
||||||
|
修改后
|
||||||
|
``` shell
|
||||||
|
redis:
|
||||||
|
db: 1
|
||||||
|
password: '${REDIS_PASSWORD:-}'
|
||||||
|
host: '${REDIS_HOST:-redis}:6379'
|
||||||
|
```
|
||||||
|
|
||||||
|
## 第五步,启动ragflow服务
|
||||||
|
执行命令:
|
||||||
|
``` shell
|
||||||
|
docker-compose -f docker-compose.yml up -d
|
||||||
|
```
|
||||||
|
执行成功后,你可以使用`docker logs -n 20 -f docker-ragflow-cpu-1`命令,查看`docker-ragflow-cpu-1`服务的日志。
|
||||||
|
|
||||||
|
如果日志中没有报错,说明ragflow服务启动成功。
|
||||||
|
|
||||||
|
# 第五步,注册账号
|
||||||
|
你可以在浏览器中访问`http://127.0.0.1:8008`,点击`Sign Up`,注册一个账号。
|
||||||
|
|
||||||
|
注册成功后,你可以点击`Sign In`,登录到ragflow服务。如果你想关闭ragflow服务的注册服务,不想让其他人注册账号,你可以在`ragflow/docker`文件夹下的`.env`文件中,将`REGISTER_ENABLED`配置项设置为`0`。
|
||||||
|
|
||||||
|
``` dotenv
|
||||||
|
REGISTER_ENABLED=0
|
||||||
|
```
|
||||||
|
修改后,重启启动ragflow服务。
|
||||||
|
``` shell
|
||||||
|
docker-compose -f docker-compose.yml down
|
||||||
|
docker-compose -f docker-compose.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
# 第六步,配置ragflow服务的模型
|
||||||
|
你可以在浏览器中访问`http://127.0.0.1:8008`,点击`Sign In`,登录到ragflow服务。点击页面右上角的`头像`,进入设置页面。
|
||||||
|
首先,在左侧导航栏中,点击`模型供应商`,进入到模型配置页面。在右侧的`可选模型`搜索框下,选择`LLM`,在列表选择你使用的模型供应商,点击`添加`,输入你的密钥;
|
||||||
|
然后,选择`TEXT EMBEDDING`,在列表选择你使用的模型供应商,点击`添加`,输入你的密钥。
|
||||||
|
最后,刷新一下页面,分别点击`设置默认模型`列表的LLM和Embedding,选择你使用的模型即可。请确认你的密钥开通了相应的服务,比如我是用的Embedding模型是xxx供应商的,需要去这个供应商官网查看这个模型是否需要购买资源包才能使用。
|
||||||
|
|
||||||
|
|
||||||
|
# 第二部分 配置ragflow服务
|
||||||
|
|
||||||
|
# 第一步 登录ragflow服务
|
||||||
|
你可以在浏览器中访问`http://127.0.0.1:8008`,点击`Sign In`,登录到ragflow服务。
|
||||||
|
|
||||||
|
然后点击右上角的`头像`,进入设置页面。在左侧导航栏中,点击`API`功能,然后点击"API Key"按钮。出现一个弹框,
|
||||||
|
|
||||||
|
在弹框中,点击"Create new Key"按钮,生成一个API Key。复制这个`API Key`,你稍后会用到。
|
||||||
|
|
||||||
|
# 第二步 配置到智控台
|
||||||
|
确保你的智控台版本是`0.8.7`或以上。使用超级管理员账号登录到智控台。在顶部导航栏中,点击`模型配置`,在左侧导航栏中,点击`知识库`。
|
||||||
|
|
||||||
|
在列表中找到`RAG_RAGFlow`,点击`编辑`按钮。
|
||||||
|
|
||||||
|
在`服务地址`中,填写`http://你的ragflow服务的局域网IP:8008`,例如我的ragflow服务的局域网IP是`192.168.1.100`,那么我就填写`http://192.168.1.100:8008`。
|
||||||
|
|
||||||
|
在`API密钥`中,填写之前复制的`API Key`。
|
||||||
|
|
||||||
|
最后点击保存按钮。
|
||||||
|
|
||||||
|
# 第二步 创建一个知识库
|
||||||
|
使用超级管理员账号登录到智控台。在顶部导航栏中,点击`知识库`,在列表左下脚,点击`新增`按钮。填写一个知识库的名字和描述。点击保存。
|
||||||
|
|
||||||
|
为了提高大模型对知识库的理解和召回能力,建议在创建知识库时,填写一个有意义的名字和描述。例如,如果你要创建一个关于`公司介绍`的知识库,那么知识库的名字可以是`公司介绍`,描述可以是`关于公司的相关信息例如公司基本信息、服务项目、联系电话、地址等。`。
|
||||||
|
|
||||||
|
保存后,你可以在知识库列表中看到这个知识库。点击刚才创建的知识库的`查看`按钮,进入知识库详情页面。
|
||||||
|
|
||||||
|
在知识库详情页面中,左下角点击`新增`按钮,可以上传文档到知识库。
|
||||||
|
|
||||||
|
上传后,你可以在知识库详情页面中,看到上传的文档。此时可以点击文档的`解析`按钮,解析文档。
|
||||||
|
|
||||||
|
解析完成后,你可以查看解析后的切片信息。你可以在知识库详情页面中,点击`召回测试`按钮,可以测试知识库的召回/检索功能。
|
||||||
|
|
||||||
|
# 第三步 让小智使用ragflow知识库
|
||||||
|
登录到智控台。在顶部导航栏中,点击`智能体`,找到你要配置的智能体,点击`配置角色`按钮。
|
||||||
|
|
||||||
|
在意图识别左侧,点击`编辑功能`按钮,弹出一个弹框。在弹框中选择你要添加的知识库。保存即可。
|
||||||
|
|
@ -28,7 +28,7 @@ If you can access port 3306, please ignore the following content and go directly
|
||||||
|
|
||||||
If you can't access it, you need to recall how you installed `mysql`.
|
If you can't access it, you need to recall how you installed `mysql`.
|
||||||
|
|
||||||
If you installed MySQL using a package yourself, it means your MySQL server is isolated from the network. You may need to first resolve the issue of accessing port 3306 of MySQL server.
|
如果你的mysql是通过自己使用安装包安装的,说明你的`mysql`做了网络隔离。你可能先解决访问`mysql`的`3306`端口这个问题。
|
||||||
|
|
||||||
If you installed `mysql` through `docker-compose_all.yml` of this project, you need to find the `docker-compose_all.yml` file where you created the database and modify the following content
|
If you installed `mysql` through `docker-compose_all.yml` of this project, you need to find the `docker-compose_all.yml` file where you created the database and modify the following content
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,16 @@ public interface Constant {
|
||||||
*/
|
*/
|
||||||
String MEMORY_NO_MEM = "Memory_nomem";
|
String MEMORY_NO_MEM = "Memory_nomem";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 火山引擎双声道语音克隆
|
||||||
|
*/
|
||||||
|
String VOICE_CLONE_HUOSHAN_DOUBLE_STREAM = "huoshan_double_stream";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RAG配置类型
|
||||||
|
*/
|
||||||
|
String RAG_CONFIG_TYPE = "RAG";
|
||||||
|
|
||||||
enum SysBaseParam {
|
enum SysBaseParam {
|
||||||
/**
|
/**
|
||||||
* ICP备案号
|
* ICP备案号
|
||||||
|
|
@ -171,6 +181,38 @@ public interface Constant {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 训练状态
|
||||||
|
*/
|
||||||
|
enum TrainStatus {
|
||||||
|
/**
|
||||||
|
* 未训练
|
||||||
|
*/
|
||||||
|
NOT_TRAINED(0),
|
||||||
|
/**
|
||||||
|
* 训练中
|
||||||
|
*/
|
||||||
|
TRAINING(1),
|
||||||
|
/**
|
||||||
|
* 已训练
|
||||||
|
*/
|
||||||
|
TRAINED(2),
|
||||||
|
/**
|
||||||
|
* 训练失败
|
||||||
|
*/
|
||||||
|
TRAIN_FAILED(3);
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
|
||||||
|
TrainStatus(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统短信
|
* 系统短信
|
||||||
*/
|
*/
|
||||||
|
|
@ -257,7 +299,7 @@ public interface Constant {
|
||||||
/**
|
/**
|
||||||
* 版本号
|
* 版本号
|
||||||
*/
|
*/
|
||||||
public static final String VERSION = "0.8.4";
|
public static final String VERSION = "0.8.8";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无效固件URL
|
* 无效固件URL
|
||||||
|
|
|
||||||
|
|
@ -82,14 +82,6 @@ public interface ErrorCode {
|
||||||
int DEVICE_ALREADY_ACTIVATED = 10063;
|
int DEVICE_ALREADY_ACTIVATED = 10063;
|
||||||
// 默认模型删除错误
|
// 默认模型删除错误
|
||||||
int DEFAULT_MODEL_DELETE_ERROR = 10064;
|
int DEFAULT_MODEL_DELETE_ERROR = 10064;
|
||||||
// 设备相关错误码
|
|
||||||
int MAC_ADDRESS_ALREADY_EXISTS = 10090; // Mac地址已存在
|
|
||||||
// 模型相关错误码
|
|
||||||
int MODEL_PROVIDER_NOT_EXIST = 10091; // 供应器不存在
|
|
||||||
int LLM_NOT_EXIST = 10092; // 设置的LLM不存在
|
|
||||||
int MODEL_REFERENCED_BY_AGENT = 10093; // 该模型配置已被智能体引用,无法删除
|
|
||||||
int LLM_REFERENCED_BY_INTENT = 10094; // 该LLM模型已被意图识别配置引用,无法删除
|
|
||||||
|
|
||||||
// 登录相关错误码
|
// 登录相关错误码
|
||||||
int ADD_DATA_FAILED = 10065; // 新增数据失败
|
int ADD_DATA_FAILED = 10065; // 新增数据失败
|
||||||
int UPDATE_DATA_FAILED = 10066; // 修改数据失败
|
int UPDATE_DATA_FAILED = 10066; // 修改数据失败
|
||||||
|
|
@ -127,6 +119,10 @@ public interface ErrorCode {
|
||||||
int VOICEPRINT_UNREGISTER_PROCESS_ERROR = 10090; // 声纹注销处理失败
|
int VOICEPRINT_UNREGISTER_PROCESS_ERROR = 10090; // 声纹注销处理失败
|
||||||
int VOICEPRINT_IDENTIFY_REQUEST_ERROR = 10091; // 声纹识别请求失败
|
int VOICEPRINT_IDENTIFY_REQUEST_ERROR = 10091; // 声纹识别请求失败
|
||||||
|
|
||||||
|
int LLM_NOT_EXIST = 10092; // 设置的LLM不存在
|
||||||
|
int MODEL_REFERENCED_BY_AGENT = 10093; // 该模型配置已被智能体引用,无法删除
|
||||||
|
int LLM_REFERENCED_BY_INTENT = 10094; // 该LLM模型已被意图识别配置引用,无法删除
|
||||||
|
|
||||||
// 服务端管理相关错误码
|
// 服务端管理相关错误码
|
||||||
int INVALID_SERVER_ACTION = 10095; // 无效服务端操作
|
int INVALID_SERVER_ACTION = 10095; // 无效服务端操作
|
||||||
int SERVER_WEBSOCKET_NOT_CONFIGURED = 10096; // 未配置服务端WebSocket地址
|
int SERVER_WEBSOCKET_NOT_CONFIGURED = 10096; // 未配置服务端WebSocket地址
|
||||||
|
|
@ -188,4 +184,33 @@ public interface ErrorCode {
|
||||||
int VOICE_RESOURCE_ACCOUNT_EMPTY = 10148; // 归属账号不能为空
|
int VOICE_RESOURCE_ACCOUNT_EMPTY = 10148; // 归属账号不能为空
|
||||||
int VOICE_RESOURCE_DELETE_ID_EMPTY = 10149; // 删除的音色资源ID不能为空
|
int VOICE_RESOURCE_DELETE_ID_EMPTY = 10149; // 删除的音色资源ID不能为空
|
||||||
int VOICE_RESOURCE_NO_PERMISSION = 10150; // 您没有权限操作该记录
|
int VOICE_RESOURCE_NO_PERMISSION = 10150; // 您没有权限操作该记录
|
||||||
|
int VOICE_CLONE_AUDIO_NOT_UPLOADED = 10151; // 请先上传音频文件
|
||||||
|
int VOICE_CLONE_MODEL_CONFIG_NOT_FOUND = 10152; // 模型配置未找到
|
||||||
|
int VOICE_CLONE_MODEL_TYPE_NOT_FOUND = 10153; // 模型类型未找到
|
||||||
|
int VOICE_CLONE_TRAINING_FAILED = 10154; // 训练失败
|
||||||
|
int VOICE_CLONE_HUOSHAN_CONFIG_MISSING = 10155; // 火山引擎缺少配置
|
||||||
|
int VOICE_CLONE_RESPONSE_FORMAT_ERROR = 10156; // 响应格式错误
|
||||||
|
int VOICE_CLONE_REQUEST_FAILED = 10157; // 请求失败
|
||||||
|
int VOICE_CLONE_PREFIX = 10158; // 复刻音色前缀
|
||||||
|
int VOICE_ID_ALREADY_EXISTS = 10159; // 音色ID已存在
|
||||||
|
int VOICE_CLONE_HUOSHAN_VOICE_ID_ERROR = 10160; // 火山引擎音色ID格式错误
|
||||||
|
|
||||||
|
// 设备相关错误码
|
||||||
|
int MAC_ADDRESS_ALREADY_EXISTS = 10161; // Mac地址已存在
|
||||||
|
// 模型相关错误码
|
||||||
|
int MODEL_PROVIDER_NOT_EXIST = 10162; // 供应器不存在
|
||||||
|
|
||||||
|
// 知识库相关错误码
|
||||||
|
int Knowledge_Base_RECORD_NOT_EXISTS = 10163; // 知识库记录不存在
|
||||||
|
int RAG_CONFIG_NOT_FOUND = 10164; // RAG配置未找到
|
||||||
|
int RAG_CONFIG_TYPE_ERROR = 10165; // RAG配置类型错误
|
||||||
|
int RAG_DEFAULT_CONFIG_NOT_FOUND = 10166; // 默认RAG配置未找到
|
||||||
|
int RAG_API_ERROR = 10167; // RAG调用失败
|
||||||
|
int UPLOAD_FILE_ERROR = 10168; // 上传文件失败
|
||||||
|
int NO_PERMISSION = 10169; // 没有权限
|
||||||
|
int KNOWLEDGE_BASE_NAME_EXISTS = 10170; // 同名知识库已存在
|
||||||
|
int RAG_API_ERROR_URL_NULL = 10171; // RAG配置中base_url为空,请完善配置
|
||||||
|
int RAG_API_ERROR_API_KEY_NULL = 10172; // RAG配置中api_key为空,请完善配置
|
||||||
|
int RAG_API_ERROR_API_KEY_INVALID = 10173; // RAG配置中api_key包含占位符,请替换为实际的API密钥
|
||||||
|
int RAG_API_ERROR_URL_INVALID = 10174; // RAG配置中base_url格式不正确,请检查协议是否正确
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,23 @@ public class FieldMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
// 创建者
|
// 创建者
|
||||||
strictInsertFill(metaObject, CREATOR, Long.class, user.getId());
|
strictInsertFill(metaObject, CREATOR, Long.class, user.getId());
|
||||||
// 创建时间
|
// 创建时间 - 支持createDate和createdAt两种字段名
|
||||||
strictInsertFill(metaObject, CREATE_DATE, Date.class, date);
|
if (metaObject.hasSetter(CREATE_DATE)) {
|
||||||
|
strictInsertFill(metaObject, CREATE_DATE, Date.class, date);
|
||||||
|
}
|
||||||
|
if (metaObject.hasSetter("createdAt")) {
|
||||||
|
strictInsertFill(metaObject, "createdAt", Date.class, date);
|
||||||
|
}
|
||||||
|
|
||||||
// 更新者
|
// 更新者
|
||||||
strictInsertFill(metaObject, UPDATER, Long.class, user.getId());
|
strictInsertFill(metaObject, UPDATER, Long.class, user.getId());
|
||||||
// 更新时间
|
// 更新时间 - 支持updateDate和updatedAt两种字段名
|
||||||
strictInsertFill(metaObject, UPDATE_DATE, Date.class, date);
|
if (metaObject.hasSetter(UPDATE_DATE)) {
|
||||||
|
strictInsertFill(metaObject, UPDATE_DATE, Date.class, date);
|
||||||
|
}
|
||||||
|
if (metaObject.hasSetter("updatedAt")) {
|
||||||
|
strictInsertFill(metaObject, "updatedAt", Date.class, date);
|
||||||
|
}
|
||||||
|
|
||||||
// 数据标识
|
// 数据标识
|
||||||
strictInsertFill(metaObject, DATA_OPERATION, String.class, Constant.DataOperation.INSERT.getValue());
|
strictInsertFill(metaObject, DATA_OPERATION, String.class, Constant.DataOperation.INSERT.getValue());
|
||||||
|
|
@ -46,10 +56,17 @@ public class FieldMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFill(MetaObject metaObject) {
|
public void updateFill(MetaObject metaObject) {
|
||||||
|
Date date = new Date();
|
||||||
|
|
||||||
// 更新者
|
// 更新者
|
||||||
strictUpdateFill(metaObject, UPDATER, Long.class, SecurityUser.getUserId());
|
strictUpdateFill(metaObject, UPDATER, Long.class, SecurityUser.getUserId());
|
||||||
// 更新时间
|
// 更新时间 - 支持updateDate和updatedAt两种字段名
|
||||||
strictUpdateFill(metaObject, UPDATE_DATE, Date.class, new Date());
|
if (metaObject.hasSetter(UPDATE_DATE)) {
|
||||||
|
strictUpdateFill(metaObject, UPDATE_DATE, Date.class, date);
|
||||||
|
}
|
||||||
|
if (metaObject.hasSetter("updatedAt")) {
|
||||||
|
strictUpdateFill(metaObject, "updatedAt", Date.class, date);
|
||||||
|
}
|
||||||
|
|
||||||
// 数据标识
|
// 数据标识
|
||||||
strictInsertFill(metaObject, DATA_OPERATION, String.class, Constant.DataOperation.UPDATE.getValue());
|
strictInsertFill(metaObject, DATA_OPERATION, String.class, Constant.DataOperation.UPDATE.getValue());
|
||||||
|
|
|
||||||
|
|
@ -152,4 +152,11 @@ public class RedisKeys {
|
||||||
public static String getVoiceCloneAudioIdKey(String uuid) {
|
public static String getVoiceCloneAudioIdKey(String uuid) {
|
||||||
return "voiceClone:audio:id:" + uuid;
|
return "voiceClone:audio:id:" + uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取知识库缓存key
|
||||||
|
*/
|
||||||
|
public static String getKnowledgeBaseCacheKey(String datasetId) {
|
||||||
|
return "knowledge:base:" + datasetId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,15 @@ import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
public class MessageUtils {
|
public class MessageUtils {
|
||||||
private static MessageSource messageSource;
|
private static MessageSource messageSource;
|
||||||
|
|
||||||
static {
|
|
||||||
messageSource = (MessageSource) SpringContextUtils.getBean("messageSource");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getMessage(int code) {
|
public static String getMessage(int code) {
|
||||||
return getMessage(code, new String[0]);
|
return getMessage(code, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMessage(int code, String... params) {
|
public static String getMessage(int code, String... params) {
|
||||||
|
if (messageSource == null) {
|
||||||
|
// 延迟初始化,确保Spring上下文已完全初始化
|
||||||
|
messageSource = (MessageSource) SpringContextUtils.getBean("messageSource");
|
||||||
|
}
|
||||||
return messageSource.getMessage(code + "", params, LocaleContextHolder.getLocale());
|
return messageSource.getMessage(code + "", params, LocaleContextHolder.getLocale());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
package xiaozhi.common.utils;
|
package xiaozhi.common.utils;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 敏感数据处理工具类
|
* 敏感数据处理工具类
|
||||||
*/
|
*/
|
||||||
|
|
@ -30,7 +31,7 @@ public class SensitiveDataUtils {
|
||||||
* 隐藏字符串中间部分
|
* 隐藏字符串中间部分
|
||||||
*/
|
*/
|
||||||
public static String maskMiddle(String value) {
|
public static String maskMiddle(String value) {
|
||||||
if (StringUtils.isBlank(value)) {
|
if (StringUtils.isBlank(value) || value.length() == 1) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,26 @@
|
||||||
package xiaozhi.modules.agent.service.impl;
|
package xiaozhi.modules.agent.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import xiaozhi.common.utils.JsonUtils;
|
||||||
import xiaozhi.modules.agent.dao.AgentPluginMappingMapper;
|
import xiaozhi.modules.agent.dao.AgentPluginMappingMapper;
|
||||||
import xiaozhi.modules.agent.entity.AgentPluginMapping;
|
import xiaozhi.modules.agent.entity.AgentPluginMapping;
|
||||||
import xiaozhi.modules.agent.service.AgentPluginMappingService;
|
import xiaozhi.modules.agent.service.AgentPluginMappingService;
|
||||||
|
import xiaozhi.modules.knowledge.entity.KnowledgeBaseEntity;
|
||||||
|
import xiaozhi.modules.knowledge.service.KnowledgeBaseService;
|
||||||
|
import xiaozhi.modules.model.entity.ModelConfigEntity;
|
||||||
|
import xiaozhi.modules.model.service.ModelConfigService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 针对表【ai_agent_plugin_mapping(Agent与插件的唯一映射表)】的数据库操作Service实现
|
* @description 针对表【ai_agent_plugin_mapping(Agent与插件的唯一映射表)】的数据库操作Service实现
|
||||||
|
|
@ -18,13 +28,73 @@ import xiaozhi.modules.agent.service.AgentPluginMappingService;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class AgentPluginMappingServiceImpl extends ServiceImpl<AgentPluginMappingMapper, AgentPluginMapping>
|
public class AgentPluginMappingServiceImpl extends ServiceImpl<AgentPluginMappingMapper, AgentPluginMapping>
|
||||||
implements AgentPluginMappingService {
|
implements AgentPluginMappingService {
|
||||||
private final AgentPluginMappingMapper agentPluginMappingMapper;
|
private final AgentPluginMappingMapper agentPluginMappingMapper;
|
||||||
|
private final KnowledgeBaseService knowledgeBaseService;
|
||||||
|
private final ModelConfigService modelConfigService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AgentPluginMapping> agentPluginParamsByAgentId(String agentId) {
|
public List<AgentPluginMapping> agentPluginParamsByAgentId(String agentId) {
|
||||||
return agentPluginMappingMapper.selectPluginsByAgentId(agentId);
|
List<AgentPluginMapping> list = agentPluginMappingMapper.selectPluginsByAgentId(agentId);
|
||||||
|
Map<String, List<KnowledgeBaseEntity>> knowledgeBaseMap = new HashMap<>();
|
||||||
|
Map<String, ModelConfigEntity> modelConfigMap = new HashMap<>();
|
||||||
|
for (int i = list.size() - 1; i >= 0; i--) {
|
||||||
|
AgentPluginMapping mapping = list.get(i);
|
||||||
|
if (StringUtils.isBlank(mapping.getProviderCode())) {
|
||||||
|
// 查询知识库插件参数
|
||||||
|
KnowledgeBaseEntity knowledgeBaseEntity = knowledgeBaseService.selectById(mapping.getPluginId());
|
||||||
|
if (knowledgeBaseEntity == null) {
|
||||||
|
list.remove(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ModelConfigEntity modelConfigEntity = modelConfigService
|
||||||
|
.getModelByIdFromCache(knowledgeBaseEntity.getRagModelId());
|
||||||
|
if (modelConfigEntity == null) {
|
||||||
|
list.remove(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<KnowledgeBaseEntity> knowledgeBaseList = knowledgeBaseMap.get(modelConfigEntity.getModelCode());
|
||||||
|
if (knowledgeBaseList == null) {
|
||||||
|
knowledgeBaseList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
modelConfigMap.put(modelConfigEntity.getModelCode(), modelConfigEntity);
|
||||||
|
knowledgeBaseList.add(knowledgeBaseEntity);
|
||||||
|
knowledgeBaseMap.put(modelConfigEntity.getModelCode(), knowledgeBaseList);
|
||||||
|
list.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (knowledgeBaseMap.size() > 0) {
|
||||||
|
for (String pluginCode : knowledgeBaseMap.keySet()) {
|
||||||
|
List<KnowledgeBaseEntity> knowledgeBaseList = knowledgeBaseMap.get(pluginCode);
|
||||||
|
if (knowledgeBaseList == null || knowledgeBaseList.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
AgentPluginMapping agentPluginMapping = new AgentPluginMapping();
|
||||||
|
agentPluginMapping.setAgentId(agentId);
|
||||||
|
agentPluginMapping.setPluginId(pluginCode);
|
||||||
|
agentPluginMapping.setProviderCode("search_from_" + pluginCode);
|
||||||
|
agentPluginMapping.setId(Long.valueOf(list.size() + 1));
|
||||||
|
|
||||||
|
Map<String, Object> paramInfo = new HashMap<>(4);
|
||||||
|
ModelConfigEntity modelConfigEntity = modelConfigMap.get(pluginCode);
|
||||||
|
paramInfo.put("base_url", modelConfigEntity.getConfigJson().getStr("base_url"));
|
||||||
|
paramInfo.put("api_key", modelConfigEntity.getConfigJson().getStr("api_key"));
|
||||||
|
paramInfo.put("dataset_ids",
|
||||||
|
knowledgeBaseList.stream().map(KnowledgeBaseEntity::getDatasetId).toList());
|
||||||
|
|
||||||
|
String description = "如果用户询问与【"
|
||||||
|
+ String.join(",", knowledgeBaseList.stream().map(KnowledgeBaseEntity::getName).toList())
|
||||||
|
+ "】涵盖的主体范围相关内容时应调用本方法,用于查询:" + String.join(",",
|
||||||
|
knowledgeBaseList.stream().map(KnowledgeBaseEntity::getDescription).toList());
|
||||||
|
paramInfo.put("description", description);
|
||||||
|
agentPluginMapping.setParamInfo(JsonUtils.toJsonString(paramInfo));
|
||||||
|
list.add(agentPluginMapping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ import xiaozhi.modules.agent.service.AgentTemplateService;
|
||||||
import xiaozhi.modules.agent.vo.AgentInfoVO;
|
import xiaozhi.modules.agent.vo.AgentInfoVO;
|
||||||
import xiaozhi.modules.device.service.DeviceService;
|
import xiaozhi.modules.device.service.DeviceService;
|
||||||
import xiaozhi.modules.model.dto.ModelProviderDTO;
|
import xiaozhi.modules.model.dto.ModelProviderDTO;
|
||||||
|
import xiaozhi.modules.model.dto.VoiceDTO;
|
||||||
import xiaozhi.modules.model.entity.ModelConfigEntity;
|
import xiaozhi.modules.model.entity.ModelConfigEntity;
|
||||||
import xiaozhi.modules.model.service.ModelConfigService;
|
import xiaozhi.modules.model.service.ModelConfigService;
|
||||||
import xiaozhi.modules.model.service.ModelProviderService;
|
import xiaozhi.modules.model.service.ModelProviderService;
|
||||||
|
|
@ -373,6 +374,22 @@ public class AgentServiceImpl extends BaseServiceImpl<AgentDao, AgentEntity> imp
|
||||||
entity.setLlmModelId(template.getLlmModelId());
|
entity.setLlmModelId(template.getLlmModelId());
|
||||||
entity.setVllmModelId(template.getVllmModelId());
|
entity.setVllmModelId(template.getVllmModelId());
|
||||||
entity.setTtsModelId(template.getTtsModelId());
|
entity.setTtsModelId(template.getTtsModelId());
|
||||||
|
|
||||||
|
if (template.getTtsVoiceId() == null && template.getTtsModelId() != null) {
|
||||||
|
ModelConfigEntity ttsModel = modelConfigService.selectById(template.getTtsModelId());
|
||||||
|
if (ttsModel != null && ttsModel.getConfigJson() != null) {
|
||||||
|
Map<String, Object> config = ttsModel.getConfigJson();
|
||||||
|
String voice = (String) config.get("voice");
|
||||||
|
if (StringUtils.isBlank(voice)) {
|
||||||
|
voice = (String) config.get("speaker");
|
||||||
|
}
|
||||||
|
VoiceDTO timbre = timbreModelService.getByVoiceCode(template.getTtsModelId(), voice);
|
||||||
|
if (timbre != null) {
|
||||||
|
template.setTtsVoiceId(timbre.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
entity.setTtsVoiceId(template.getTtsVoiceId());
|
entity.setTtsVoiceId(template.getTtsVoiceId());
|
||||||
entity.setMemModelId(template.getMemModelId());
|
entity.setMemModelId(template.getMemModelId());
|
||||||
entity.setIntentModelId(template.getIntentModelId());
|
entity.setIntentModelId(template.getIntentModelId());
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,10 @@ public class AgentTemplateServiceImpl extends ServiceImpl<AgentTemplateDao, Agen
|
||||||
@Override
|
@Override
|
||||||
public void updateDefaultTemplateModelId(String modelType, String modelId) {
|
public void updateDefaultTemplateModelId(String modelType, String modelId) {
|
||||||
modelType = modelType.toUpperCase();
|
modelType = modelType.toUpperCase();
|
||||||
|
// 如果是rag模型,不需要更新
|
||||||
|
if (modelType.equals("RAG")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWrapper<AgentTemplateEntity> wrapper = new UpdateWrapper<>();
|
UpdateWrapper<AgentTemplateEntity> wrapper = new UpdateWrapper<>();
|
||||||
switch (modelType) {
|
switch (modelType) {
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@ import xiaozhi.modules.sys.dto.SysParamsDTO;
|
||||||
import xiaozhi.modules.sys.service.SysParamsService;
|
import xiaozhi.modules.sys.service.SysParamsService;
|
||||||
import xiaozhi.modules.timbre.service.TimbreService;
|
import xiaozhi.modules.timbre.service.TimbreService;
|
||||||
import xiaozhi.modules.timbre.vo.TimbreDetailsVO;
|
import xiaozhi.modules.timbre.vo.TimbreDetailsVO;
|
||||||
|
import xiaozhi.modules.voiceclone.entity.VoiceCloneEntity;
|
||||||
|
import xiaozhi.modules.voiceclone.service.VoiceCloneService;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|
@ -51,6 +53,7 @@ public class ConfigServiceImpl implements ConfigService {
|
||||||
private final TimbreService timbreService;
|
private final TimbreService timbreService;
|
||||||
private final AgentPluginMappingService agentPluginMappingService;
|
private final AgentPluginMappingService agentPluginMappingService;
|
||||||
private final AgentMcpAccessPointService agentMcpAccessPointService;
|
private final AgentMcpAccessPointService agentMcpAccessPointService;
|
||||||
|
private final VoiceCloneService cloneVoiceService;
|
||||||
private final AgentVoicePrintDao agentVoicePrintDao;
|
private final AgentVoicePrintDao agentVoicePrintDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -88,6 +91,7 @@ public class ConfigServiceImpl implements ConfigService {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
result,
|
result,
|
||||||
isCache);
|
isCache);
|
||||||
|
|
||||||
|
|
@ -124,6 +128,11 @@ public class ConfigServiceImpl implements ConfigService {
|
||||||
voice = timbre.getTtsVoice();
|
voice = timbre.getTtsVoice();
|
||||||
referenceAudio = timbre.getReferenceAudio();
|
referenceAudio = timbre.getReferenceAudio();
|
||||||
referenceText = timbre.getReferenceText();
|
referenceText = timbre.getReferenceText();
|
||||||
|
} else {
|
||||||
|
VoiceCloneEntity voice_print = cloneVoiceService.selectById(agent.getTtsVoiceId());
|
||||||
|
if (voice_print != null) {
|
||||||
|
voice = voice_print.getVoiceId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 构建返回数据
|
// 构建返回数据
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|
@ -187,6 +196,7 @@ public class ConfigServiceImpl implements ConfigService {
|
||||||
agent.getTtsModelId(),
|
agent.getTtsModelId(),
|
||||||
agent.getMemModelId(),
|
agent.getMemModelId(),
|
||||||
agent.getIntentModelId(),
|
agent.getIntentModelId(),
|
||||||
|
null,
|
||||||
result,
|
result,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
|
|
@ -363,12 +373,14 @@ public class ConfigServiceImpl implements ConfigService {
|
||||||
String ttsModelId,
|
String ttsModelId,
|
||||||
String memModelId,
|
String memModelId,
|
||||||
String intentModelId,
|
String intentModelId,
|
||||||
|
String ragModelId,
|
||||||
Map<String, Object> result,
|
Map<String, Object> result,
|
||||||
boolean isCache) {
|
boolean isCache) {
|
||||||
Map<String, String> selectedModule = new HashMap<>();
|
Map<String, String> selectedModule = new HashMap<>();
|
||||||
|
|
||||||
String[] modelTypes = { "VAD", "ASR", "TTS", "Memory", "Intent", "LLM", "VLLM" };
|
String[] modelTypes = { "VAD", "ASR", "TTS", "Memory", "Intent", "LLM", "VLLM", "RAG" };
|
||||||
String[] modelIds = { vadModelId, asrModelId, ttsModelId, memModelId, intentModelId, llmModelId, vllmModelId };
|
String[] modelIds = { vadModelId, asrModelId, ttsModelId, memModelId, intentModelId, llmModelId, vllmModelId,
|
||||||
|
ragModelId };
|
||||||
String intentLLMModelId = null;
|
String intentLLMModelId = null;
|
||||||
String memLocalShortLLMModelId = null;
|
String memLocalShortLLMModelId = null;
|
||||||
|
|
||||||
|
|
@ -392,6 +404,15 @@ public class ConfigServiceImpl implements ConfigService {
|
||||||
((Map<String, Object>) model.getConfigJson()).put("ref_audio", referenceAudio);
|
((Map<String, Object>) model.getConfigJson()).put("ref_audio", referenceAudio);
|
||||||
if (referenceText != null)
|
if (referenceText != null)
|
||||||
((Map<String, Object>) model.getConfigJson()).put("ref_text", referenceText);
|
((Map<String, Object>) model.getConfigJson()).put("ref_text", referenceText);
|
||||||
|
|
||||||
|
// 火山引擎声音克隆需要替换resource_id
|
||||||
|
Map<String, Object> map = (Map<String, Object>) model.getConfigJson();
|
||||||
|
if (Constant.VOICE_CLONE_HUOSHAN_DOUBLE_STREAM.equals(map.get("type"))) {
|
||||||
|
// 如果voice是”S_“开头的,使用seed-icl-1.0
|
||||||
|
if (voice != null && voice.startsWith("S_")) {
|
||||||
|
map.put("resource_id", "seed-icl-1.0");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 如果是Intent类型,且type=intent_llm,则给他添加附加模型
|
// 如果是Intent类型,且type=intent_llm,则给他添加附加模型
|
||||||
if ("Intent".equals(modelTypes[i])) {
|
if ("Intent".equals(modelTypes[i])) {
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public class DeviceController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/bind/{agentId}")
|
@PostMapping("/bind/{agentId}")
|
||||||
@Operation(summary = "转发POST请求到MQTT网关")
|
@Operation(summary = "设备在线接口")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<String> forwardToMqttGateway(@PathVariable String agentId, @RequestBody String requestBody) {
|
public Result<String> forwardToMqttGateway(@PathVariable String agentId, @RequestBody String requestBody) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -208,63 +208,4 @@ public class DeviceController {
|
||||||
deviceService.manualAddDevice(user.getId(), dto);
|
deviceService.manualAddDevice(user.getId(), dto);
|
||||||
return new Result<>();
|
return new Result<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/commands/{deviceId}")
|
|
||||||
@Operation(summary = "发送设备指令")
|
|
||||||
@RequiresPermissions("sys:role:normal")
|
|
||||||
public Result<String> sendDeviceCommand(@PathVariable String deviceId, @RequestBody String command) {
|
|
||||||
try {
|
|
||||||
// 从系统参数中获取MQTT网关地址
|
|
||||||
String mqttGatewayUrl = sysParamsService.getValue("server.mqtt_manager_api", true);
|
|
||||||
if (StringUtils.isBlank(mqttGatewayUrl) || "null".equals(mqttGatewayUrl)) {
|
|
||||||
return new Result<String>().error("MQTT网关地址未配置");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建完整的URL
|
|
||||||
// 获取设备信息以构建mqttClientId
|
|
||||||
DeviceEntity deviceById = deviceService.selectById(deviceId);
|
|
||||||
|
|
||||||
if (!deviceById.getUserId().equals(SecurityUser.getUser().getId())) {
|
|
||||||
return new Result<String>().error("设备不存在");
|
|
||||||
}
|
|
||||||
String macAddress = deviceById != null ? deviceById.getMacAddress() : "unknown";
|
|
||||||
String groupId = deviceById != null ? deviceById.getBoard() : null;
|
|
||||||
if (groupId == null) {
|
|
||||||
groupId = "GID_default";
|
|
||||||
}
|
|
||||||
groupId = groupId.replace(":", "_");
|
|
||||||
macAddress = macAddress.replace(":", "_");
|
|
||||||
|
|
||||||
// 拼接为groupId@@@macAddress@@@deviceId格式
|
|
||||||
String mqttClientId = groupId + "@@@" + macAddress + "@@@" + macAddress;
|
|
||||||
|
|
||||||
String url = "http://" + mqttGatewayUrl + "/api/commands/" + mqttClientId;
|
|
||||||
|
|
||||||
// 设置请求头
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
|
||||||
headers.set("Content-Type", "application/json");
|
|
||||||
|
|
||||||
// 生成Bearer令牌
|
|
||||||
String dateStr = java.time.LocalDate.now()
|
|
||||||
.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
||||||
String signatureKey = sysParamsService.getValue("server.mqtt_signature_key", false);
|
|
||||||
if (StringUtils.isBlank(signatureKey)) {
|
|
||||||
return new Result<String>().error("MQTT签名密钥未配置");
|
|
||||||
}
|
|
||||||
String tokenContent = dateStr + signatureKey;
|
|
||||||
String token = org.apache.commons.codec.digest.DigestUtils.sha256Hex(tokenContent);
|
|
||||||
headers.set("Authorization", "Bearer " + token);
|
|
||||||
|
|
||||||
// 构建请求体
|
|
||||||
HttpEntity<String> requestEntity = new HttpEntity<>(command, headers);
|
|
||||||
|
|
||||||
// 发送POST请求
|
|
||||||
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
|
|
||||||
|
|
||||||
// 返回响应
|
|
||||||
return new Result<String>().ok(response.getBody());
|
|
||||||
} catch (Exception e) {
|
|
||||||
return new Result<String>().error("发送指令失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -72,6 +72,8 @@ public class DeviceReportRespDTO {
|
||||||
public static class Websocket {
|
public static class Websocket {
|
||||||
@Schema(description = "WebSocket服务器地址")
|
@Schema(description = "WebSocket服务器地址")
|
||||||
private String url;
|
private String url;
|
||||||
|
@Schema(description = "WebSocket 认证 token")
|
||||||
|
private String token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,7 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceDao, DeviceEntity>
|
||||||
DeviceReportRespDTO.Websocket websocket = new DeviceReportRespDTO.Websocket();
|
DeviceReportRespDTO.Websocket websocket = new DeviceReportRespDTO.Websocket();
|
||||||
// 从系统参数获取WebSocket URL,如果未配置则使用默认值
|
// 从系统参数获取WebSocket URL,如果未配置则使用默认值
|
||||||
String wsUrl = sysParamsService.getValue(Constant.SERVER_WEBSOCKET, true);
|
String wsUrl = sysParamsService.getValue(Constant.SERVER_WEBSOCKET, true);
|
||||||
|
websocket.setToken("");
|
||||||
if (StringUtils.isBlank(wsUrl) || wsUrl.equals("null")) {
|
if (StringUtils.isBlank(wsUrl) || wsUrl.equals("null")) {
|
||||||
log.error("WebSocket地址未配置,请登录智控台,在参数管理找到【server.websocket】配置");
|
log.error("WebSocket地址未配置,请登录智控台,在参数管理找到【server.websocket】配置");
|
||||||
wsUrl = "ws://xiaozhi.server.com:8000/xiaozhi/v1/";
|
wsUrl = "ws://xiaozhi.server.com:8000/xiaozhi/v1/";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,159 @@
|
||||||
|
package xiaozhi.modules.knowledge.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import xiaozhi.common.exception.ErrorCode;
|
||||||
|
import xiaozhi.common.exception.RenException;
|
||||||
|
import xiaozhi.common.page.PageData;
|
||||||
|
import xiaozhi.common.utils.Result;
|
||||||
|
import xiaozhi.modules.knowledge.dto.KnowledgeBaseDTO;
|
||||||
|
import xiaozhi.modules.knowledge.service.KnowledgeBaseService;
|
||||||
|
import xiaozhi.modules.security.user.SecurityUser;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/datasets")
|
||||||
|
@Tag(name = "知识库管理")
|
||||||
|
public class KnowledgeBaseController {
|
||||||
|
|
||||||
|
private final KnowledgeBaseService knowledgeBaseService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Operation(summary = "分页查询知识库列表")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<PageData<KnowledgeBaseDTO>> getPageList(
|
||||||
|
@RequestParam(required = false) String name,
|
||||||
|
@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(required = false, defaultValue = "10") Integer page_size) {
|
||||||
|
// 获取当前登录用户ID
|
||||||
|
Long currentUserId = SecurityUser.getUserId();
|
||||||
|
|
||||||
|
KnowledgeBaseDTO knowledgeBaseDTO = new KnowledgeBaseDTO();
|
||||||
|
knowledgeBaseDTO.setName(name);
|
||||||
|
knowledgeBaseDTO.setCreator(currentUserId); // 设置创建者ID,用于权限过滤
|
||||||
|
|
||||||
|
PageData<KnowledgeBaseDTO> pageData = knowledgeBaseService.getPageList(knowledgeBaseDTO, page, page_size);
|
||||||
|
return new Result<PageData<KnowledgeBaseDTO>>().ok(pageData);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{dataset_id}")
|
||||||
|
@Operation(summary = "根据知识库ID获取知识库详情")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<KnowledgeBaseDTO> getByDatasetId(@PathVariable("dataset_id") String datasetId) {
|
||||||
|
// 获取当前登录用户ID
|
||||||
|
Long currentUserId = SecurityUser.getUserId();
|
||||||
|
|
||||||
|
KnowledgeBaseDTO knowledgeBaseDTO = knowledgeBaseService.getByDatasetId(datasetId);
|
||||||
|
|
||||||
|
// 检查权限:用户只能查看自己创建的知识库
|
||||||
|
if (knowledgeBaseDTO.getCreator() == null || !knowledgeBaseDTO.getCreator().equals(currentUserId)) {
|
||||||
|
throw new RenException(ErrorCode.NO_PERMISSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Result<KnowledgeBaseDTO>().ok(knowledgeBaseDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Operation(summary = "创建知识库")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<KnowledgeBaseDTO> save(@RequestBody @Validated KnowledgeBaseDTO knowledgeBaseDTO) {
|
||||||
|
KnowledgeBaseDTO resp = knowledgeBaseService.save(knowledgeBaseDTO);
|
||||||
|
return new Result<KnowledgeBaseDTO>().ok(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{dataset_id}")
|
||||||
|
@Operation(summary = "更新知识库")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<KnowledgeBaseDTO> update(@PathVariable("dataset_id") String datasetId,
|
||||||
|
@RequestBody @Validated KnowledgeBaseDTO knowledgeBaseDTO) {
|
||||||
|
// 获取当前登录用户ID
|
||||||
|
Long currentUserId = SecurityUser.getUserId();
|
||||||
|
|
||||||
|
// 先获取现有知识库信息以检查权限
|
||||||
|
KnowledgeBaseDTO existingKnowledgeBase = knowledgeBaseService.getByDatasetId(datasetId);
|
||||||
|
|
||||||
|
// 检查权限:用户只能更新自己创建的知识库
|
||||||
|
if (existingKnowledgeBase.getCreator() == null || !existingKnowledgeBase.getCreator().equals(currentUserId)) {
|
||||||
|
throw new RenException(ErrorCode.NO_PERMISSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
knowledgeBaseDTO.setDatasetId(datasetId);
|
||||||
|
KnowledgeBaseDTO resp = knowledgeBaseService.update(knowledgeBaseDTO);
|
||||||
|
return new Result<KnowledgeBaseDTO>().ok(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{dataset_id}")
|
||||||
|
@Operation(summary = "删除单个知识库")
|
||||||
|
@Parameter(name = "dataset_id", description = "知识库ID", required = true)
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<Void> delete(@PathVariable("dataset_id") String datasetId) {
|
||||||
|
// 获取当前登录用户ID
|
||||||
|
Long currentUserId = SecurityUser.getUserId();
|
||||||
|
|
||||||
|
// 先获取现有知识库信息以检查权限
|
||||||
|
KnowledgeBaseDTO existingKnowledgeBase = knowledgeBaseService.getByDatasetId(datasetId);
|
||||||
|
|
||||||
|
// 检查权限:用户只能删除自己创建的知识库
|
||||||
|
if (existingKnowledgeBase.getCreator() == null || !existingKnowledgeBase.getCreator().equals(currentUserId)) {
|
||||||
|
throw new RenException(ErrorCode.NO_PERMISSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
knowledgeBaseService.deleteByDatasetId(datasetId);
|
||||||
|
return new Result<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
@Operation(summary = "批量删除知识库")
|
||||||
|
@Parameter(name = "ids", description = "知识库ID列表,用逗号分隔", required = true)
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<Void> deleteBatch(@RequestParam("ids") String ids) {
|
||||||
|
if (StringUtils.isBlank(ids)) {
|
||||||
|
throw new RenException(ErrorCode.PARAMS_GET_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前登录用户ID
|
||||||
|
Long currentUserId = SecurityUser.getUserId();
|
||||||
|
String[] idArray = ids.split(",");
|
||||||
|
for (String datasetId : idArray) {
|
||||||
|
if (StringUtils.isNotBlank(datasetId)) {
|
||||||
|
// 先获取现有知识库信息以检查权限
|
||||||
|
KnowledgeBaseDTO existingKnowledgeBase = knowledgeBaseService.getByDatasetId(datasetId.trim());
|
||||||
|
|
||||||
|
// 检查权限:用户只能删除自己创建的知识库
|
||||||
|
if (existingKnowledgeBase.getCreator() == null
|
||||||
|
|| !existingKnowledgeBase.getCreator().equals(currentUserId)) {
|
||||||
|
throw new RenException(ErrorCode.NO_PERMISSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
knowledgeBaseService.deleteByDatasetId(datasetId.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Result<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/rag-models")
|
||||||
|
@Operation(summary = "获取RAG模型列表")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<List<Map<String, Object>>> getRAGModels() {
|
||||||
|
List<Map<String, Object>> result = knowledgeBaseService.getRAGModels();
|
||||||
|
return new Result<List<Map<String, Object>>>().ok(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,224 @@
|
||||||
|
package xiaozhi.modules.knowledge.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import xiaozhi.common.exception.ErrorCode;
|
||||||
|
import xiaozhi.common.exception.RenException;
|
||||||
|
import xiaozhi.common.page.PageData;
|
||||||
|
import xiaozhi.common.utils.Result;
|
||||||
|
import xiaozhi.modules.knowledge.dto.KnowledgeBaseDTO;
|
||||||
|
import xiaozhi.modules.knowledge.dto.KnowledgeFilesDTO;
|
||||||
|
import xiaozhi.modules.knowledge.service.KnowledgeBaseService;
|
||||||
|
import xiaozhi.modules.knowledge.service.KnowledgeFilesService;
|
||||||
|
import xiaozhi.modules.security.user.SecurityUser;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/datasets/{dataset_id}")
|
||||||
|
@Tag(name = "知识库文档管理")
|
||||||
|
public class KnowledgeFilesController {
|
||||||
|
|
||||||
|
private final KnowledgeFilesService knowledgeFilesService;
|
||||||
|
private final KnowledgeBaseService knowledgeBaseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证当前用户是否有权限操作指定知识库
|
||||||
|
*
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
*/
|
||||||
|
private void validateKnowledgeBasePermission(String datasetId) {
|
||||||
|
// 获取当前登录用户ID
|
||||||
|
Long currentUserId = SecurityUser.getUserId();
|
||||||
|
|
||||||
|
// 获取知识库信息
|
||||||
|
KnowledgeBaseDTO knowledgeBase = knowledgeBaseService.getByDatasetId(datasetId);
|
||||||
|
|
||||||
|
// 检查权限:用户只能操作自己创建的知识库
|
||||||
|
if (knowledgeBase.getCreator() == null || !knowledgeBase.getCreator().equals(currentUserId)) {
|
||||||
|
throw new RenException(ErrorCode.NO_PERMISSION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/documents")
|
||||||
|
@Operation(summary = "分页查询文档列表")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<PageData<KnowledgeFilesDTO>> getPageList(
|
||||||
|
@PathVariable("dataset_id") String datasetId,
|
||||||
|
@RequestParam(required = false) String name,
|
||||||
|
@RequestParam(required = false) Integer status,
|
||||||
|
@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(required = false, defaultValue = "10") Integer page_size) {
|
||||||
|
// 验证知识库权限
|
||||||
|
validateKnowledgeBasePermission(datasetId);
|
||||||
|
|
||||||
|
// 如果指定了状态参数,使用状态查询接口
|
||||||
|
if (status != null) {
|
||||||
|
PageData<KnowledgeFilesDTO> pageData = knowledgeFilesService.getPageListByStatus(datasetId, status, page, page_size);
|
||||||
|
return new Result<PageData<KnowledgeFilesDTO>>().ok(pageData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 否则使用通用查询接口
|
||||||
|
KnowledgeFilesDTO knowledgeFilesDTO = new KnowledgeFilesDTO();
|
||||||
|
knowledgeFilesDTO.setDatasetId(datasetId);
|
||||||
|
knowledgeFilesDTO.setName(name);
|
||||||
|
PageData<KnowledgeFilesDTO> pageData = knowledgeFilesService.getPageList(knowledgeFilesDTO, page, page_size);
|
||||||
|
return new Result<PageData<KnowledgeFilesDTO>>().ok(pageData);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/documents/status/{status}")
|
||||||
|
@Operation(summary = "根据状态分页查询文档列表")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<PageData<KnowledgeFilesDTO>> getPageListByStatus(
|
||||||
|
@PathVariable("dataset_id") String datasetId,
|
||||||
|
@PathVariable("status") Integer status,
|
||||||
|
@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(required = false, defaultValue = "10") Integer page_size) {
|
||||||
|
// 验证知识库权限
|
||||||
|
validateKnowledgeBasePermission(datasetId);
|
||||||
|
|
||||||
|
PageData<KnowledgeFilesDTO> pageData = knowledgeFilesService.getPageListByStatus(datasetId, status, page, page_size);
|
||||||
|
return new Result<PageData<KnowledgeFilesDTO>>().ok(pageData);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/documents")
|
||||||
|
@Operation(summary = "上传文档到知识库")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<KnowledgeFilesDTO> uploadDocument(
|
||||||
|
@PathVariable("dataset_id") String datasetId,
|
||||||
|
@RequestParam("file") MultipartFile file,
|
||||||
|
@RequestParam(required = false) String name,
|
||||||
|
@RequestParam(required = false) String chunkMethod,
|
||||||
|
@RequestParam(required = false) String metaFields,
|
||||||
|
@RequestParam(required = false) String parserConfig) {
|
||||||
|
|
||||||
|
// 验证知识库权限
|
||||||
|
validateKnowledgeBasePermission(datasetId);
|
||||||
|
|
||||||
|
KnowledgeFilesDTO resp = knowledgeFilesService.uploadDocument(datasetId, file, name,
|
||||||
|
metaFields != null ? parseJsonMap(metaFields) : null,
|
||||||
|
chunkMethod,
|
||||||
|
parserConfig != null ? parseJsonMap(parserConfig) : null);
|
||||||
|
return new Result<KnowledgeFilesDTO>().ok(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/documents/{document_id}")
|
||||||
|
@Operation(summary = "删除单个文档")
|
||||||
|
@Parameter(name = "document_id", description = "文档ID", required = true)
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<Void> delete(@PathVariable("dataset_id") String datasetId,
|
||||||
|
@PathVariable("document_id") String documentId) {
|
||||||
|
// 验证知识库权限
|
||||||
|
validateKnowledgeBasePermission(datasetId);
|
||||||
|
|
||||||
|
knowledgeFilesService.deleteByDocumentId(documentId, datasetId);
|
||||||
|
return new Result<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/chunks")
|
||||||
|
@Operation(summary = "解析文档(切块)")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<Void> parseDocuments(@PathVariable("dataset_id") String datasetId,
|
||||||
|
@RequestBody Map<String, List<String>> requestBody) {
|
||||||
|
// 验证知识库权限
|
||||||
|
validateKnowledgeBasePermission(datasetId);
|
||||||
|
|
||||||
|
List<String> documentIds = requestBody.get("document_ids");
|
||||||
|
if (documentIds == null || documentIds.isEmpty()) {
|
||||||
|
return new Result<Void>().error("document_ids参数不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean success = knowledgeFilesService.parseDocuments(datasetId, documentIds);
|
||||||
|
if (success) {
|
||||||
|
return new Result<Void>();
|
||||||
|
} else {
|
||||||
|
return new Result<Void>().error("文档解析失败,文档可能正在处理中");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/documents/{document_id}/chunks")
|
||||||
|
@Operation(summary = "列出指定文档的切片")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<Map<String, Object>> listChunks(@PathVariable("dataset_id") String datasetId,
|
||||||
|
@PathVariable("document_id") String documentId,
|
||||||
|
@RequestParam(required = false) String keywords,
|
||||||
|
@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(required = false, defaultValue = "1024") Integer page_size,
|
||||||
|
@RequestParam(required = false) String id) {
|
||||||
|
// 验证知识库权限
|
||||||
|
validateKnowledgeBasePermission(datasetId);
|
||||||
|
|
||||||
|
Map<String, Object> result = knowledgeFilesService.listChunks(datasetId, documentId, keywords, page, page_size,
|
||||||
|
id);
|
||||||
|
return new Result<Map<String, Object>>().ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 召回测试
|
||||||
|
*/
|
||||||
|
@PostMapping("/retrieval-test")
|
||||||
|
@Operation(summary = "召回测试")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<Map<String, Object>> retrievalTest(@PathVariable("dataset_id") String datasetId,
|
||||||
|
@RequestBody Map<String, Object> params) {
|
||||||
|
// 验证知识库权限
|
||||||
|
validateKnowledgeBasePermission(datasetId);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 提取参数
|
||||||
|
String question = (String) params.get("question");
|
||||||
|
if (question == null || question.trim().isEmpty()) {
|
||||||
|
return new Result<Map<String, Object>>().error("问题不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> datasetIds = (List<String>) params.get("dataset_ids");
|
||||||
|
List<String> documentIds = (List<String>) params.get("document_ids");
|
||||||
|
Integer page = (Integer) params.get("page");
|
||||||
|
Integer pageSize = (Integer) params.get("page_size");
|
||||||
|
Float similarityThreshold = (Float) params.get("similarity_threshold");
|
||||||
|
Float vectorSimilarityWeight = (Float) params.get("vector_similarity_weight");
|
||||||
|
Integer topK = (Integer) params.get("top_k");
|
||||||
|
String rerankId = (String) params.get("rerank_id");
|
||||||
|
Boolean keyword = (Boolean) params.get("keyword");
|
||||||
|
Boolean highlight = (Boolean) params.get("highlight");
|
||||||
|
List<String> crossLanguages = (List<String>) params.get("cross_languages");
|
||||||
|
Map<String, Object> metadataCondition = (Map<String, Object>) params.get("metadata_condition");
|
||||||
|
|
||||||
|
// 如果未指定数据集ID,使用当前数据集
|
||||||
|
if (datasetIds == null || datasetIds.isEmpty()) {
|
||||||
|
datasetIds = java.util.Arrays.asList(datasetId);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> result = knowledgeFilesService.retrievalTest(
|
||||||
|
question, datasetIds, documentIds, page, pageSize, similarityThreshold,
|
||||||
|
vectorSimilarityWeight, topK, rerankId, keyword, highlight, crossLanguages, metadataCondition);
|
||||||
|
|
||||||
|
return new Result<Map<String, Object>>().ok(result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new Result<Map<String, Object>>().error("召回测试失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 解析JSON字符串为Map对象
|
||||||
|
*/
|
||||||
|
private Map<String, Object> parseJsonMap(String jsonString) {
|
||||||
|
try {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
return objectMapper.readValue(jsonString, new TypeReference<Map<String, Object>>() {
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("解析JSON字符串失败: " + jsonString, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package xiaozhi.modules.knowledge.dao;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import xiaozhi.common.dao.BaseDao;
|
||||||
|
import xiaozhi.modules.knowledge.entity.KnowledgeBaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 知识库知识库
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KnowledgeBaseDao extends BaseDao<KnowledgeBaseEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据知识库ID删除相关的插件映射记录
|
||||||
|
*
|
||||||
|
* @param knowledgeBaseId 知识库ID
|
||||||
|
*/
|
||||||
|
void deletePluginMappingByKnowledgeBaseId(@Param("knowledgeBaseId") String knowledgeBaseId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package xiaozhi.modules.knowledge.dto;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "知识库知识库")
|
||||||
|
public class KnowledgeBaseDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "唯一标识")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "知识库ID")
|
||||||
|
private String datasetId;
|
||||||
|
|
||||||
|
@Schema(description = "RAG模型配置ID")
|
||||||
|
private String ragModelId;
|
||||||
|
|
||||||
|
@Schema(description = "知识库名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "知识库描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "状态(0:禁用 1:启用)")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "创建者")
|
||||||
|
private Long creator;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新者")
|
||||||
|
private Long updater;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "文档数量")
|
||||||
|
private Integer documentCount;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
package xiaozhi.modules.knowledge.dto;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "知识库文档")
|
||||||
|
public class KnowledgeFilesDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Schema(description = "唯一标识")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "文档ID")
|
||||||
|
private String documentId;
|
||||||
|
|
||||||
|
@Schema(description = "知识库ID")
|
||||||
|
private String datasetId;
|
||||||
|
|
||||||
|
@Schema(description = "文档名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "文档类型")
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
@Schema(description = "文件大小(字节)")
|
||||||
|
private Long fileSize;
|
||||||
|
|
||||||
|
@Schema(description = "文件路径")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
@Schema(description = "元数据字段")
|
||||||
|
private Map<String, Object> metaFields;
|
||||||
|
|
||||||
|
@Schema(description = "分块方法")
|
||||||
|
private String chunkMethod;
|
||||||
|
|
||||||
|
@Schema(description = "解析器配置")
|
||||||
|
private Map<String, Object> parserConfig;
|
||||||
|
|
||||||
|
@Schema(description = "状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "文档解析状态")
|
||||||
|
private String run;
|
||||||
|
|
||||||
|
@Schema(description = "创建者")
|
||||||
|
private Long creator;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新者")
|
||||||
|
private Long updater;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
// 文档解析状态常量定义
|
||||||
|
private static final Integer STATUS_UNSTART = 0;
|
||||||
|
private static final Integer STATUS_RUNNING = 1;
|
||||||
|
private static final Integer STATUS_CANCEL = 2;
|
||||||
|
private static final Integer STATUS_DONE = 3;
|
||||||
|
private static final Integer STATUS_FAIL = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文档解析状态码(基于run字段转换)
|
||||||
|
*/
|
||||||
|
public Integer getParseStatusCode() {
|
||||||
|
if (run == null) {
|
||||||
|
return STATUS_UNSTART;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据run字段的值直接映射到对应的状态码
|
||||||
|
switch (run.toUpperCase()) {
|
||||||
|
case "RUNNING":
|
||||||
|
return STATUS_RUNNING;
|
||||||
|
case "CANCEL":
|
||||||
|
return STATUS_CANCEL;
|
||||||
|
case "DONE":
|
||||||
|
return STATUS_DONE;
|
||||||
|
case "FAIL":
|
||||||
|
return STATUS_FAIL;
|
||||||
|
case "UNSTART":
|
||||||
|
default:
|
||||||
|
return STATUS_UNSTART;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
package xiaozhi.modules.knowledge.entity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName(value = "ai_rag_dataset", autoResultMap = true)
|
||||||
|
@Schema(description = "知识库知识库表")
|
||||||
|
public class KnowledgeBaseEntity {
|
||||||
|
|
||||||
|
@TableId(type = IdType.ASSIGN_UUID)
|
||||||
|
@Schema(description = "唯一标识")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "知识库ID")
|
||||||
|
private String datasetId;
|
||||||
|
|
||||||
|
@Schema(description = "RAG模型配置ID")
|
||||||
|
private String ragModelId;
|
||||||
|
|
||||||
|
@Schema(description = "知识库名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "知识库描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "状态(0:禁用 1:启用)")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "创建者")
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Long creator;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新者")
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
|
private Long updater;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
|
private Date updatedAt;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
package xiaozhi.modules.knowledge.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import xiaozhi.common.page.PageData;
|
||||||
|
import xiaozhi.common.service.BaseService;
|
||||||
|
import xiaozhi.modules.knowledge.dto.KnowledgeBaseDTO;
|
||||||
|
import xiaozhi.modules.knowledge.entity.KnowledgeBaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 知识库知识库服务接口
|
||||||
|
*/
|
||||||
|
public interface KnowledgeBaseService extends BaseService<KnowledgeBaseEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询知识库列表
|
||||||
|
*
|
||||||
|
* @param knowledgeBaseDTO 查询条件
|
||||||
|
* @param page 页码
|
||||||
|
* @param limit 每页数量
|
||||||
|
* @return 分页数据
|
||||||
|
*/
|
||||||
|
PageData<KnowledgeBaseDTO> getPageList(KnowledgeBaseDTO knowledgeBaseDTO, Integer page, Integer limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取知识库详情
|
||||||
|
*
|
||||||
|
* @param id 知识库ID
|
||||||
|
* @return 知识库详情
|
||||||
|
*/
|
||||||
|
KnowledgeBaseDTO getById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增知识库
|
||||||
|
*
|
||||||
|
* @param knowledgeBaseDTO 知识库信息
|
||||||
|
* @return 新增的知识库
|
||||||
|
*/
|
||||||
|
KnowledgeBaseDTO save(KnowledgeBaseDTO knowledgeBaseDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新知识库
|
||||||
|
*
|
||||||
|
* @param knowledgeBaseDTO 知识库信息
|
||||||
|
* @return 更新的知识库
|
||||||
|
*/
|
||||||
|
KnowledgeBaseDTO update(KnowledgeBaseDTO knowledgeBaseDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据知识库ID查询知识库
|
||||||
|
*
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
* @return 知识库详情
|
||||||
|
*/
|
||||||
|
KnowledgeBaseDTO getByDatasetId(String datasetId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据知识库ID删除知识库
|
||||||
|
*
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
*/
|
||||||
|
void deleteByDatasetId(String datasetId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取RAG配置信息
|
||||||
|
*
|
||||||
|
* @param ragModelId RAG模型配置ID
|
||||||
|
* @return RAG配置信息
|
||||||
|
*/
|
||||||
|
Map<String, Object> getRAGConfig(String ragModelId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据知识库ID获取对应的RAG配置
|
||||||
|
*
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
* @return RAG配置
|
||||||
|
*/
|
||||||
|
Map<String, Object> getRAGConfigByDatasetId(String datasetId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取RAG模型列表
|
||||||
|
*
|
||||||
|
* @return RAG模型列表
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getRAGModels();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
package xiaozhi.modules.knowledge.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import xiaozhi.common.page.PageData;
|
||||||
|
import xiaozhi.modules.knowledge.dto.KnowledgeFilesDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 知识库文档服务接口
|
||||||
|
*/
|
||||||
|
public interface KnowledgeFilesService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询文档列表
|
||||||
|
*
|
||||||
|
* @param knowledgeFilesDTO 查询条件
|
||||||
|
* @param page 页码
|
||||||
|
* @param limit 每页数量
|
||||||
|
* @return 分页数据
|
||||||
|
*/
|
||||||
|
PageData<KnowledgeFilesDTO> getPageList(KnowledgeFilesDTO knowledgeFilesDTO, Integer page, Integer limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文档ID和知识库ID获取文档详情
|
||||||
|
*
|
||||||
|
* @param documentId 文档ID
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
* @return 文档详情
|
||||||
|
*/
|
||||||
|
KnowledgeFilesDTO getByDocumentId(String documentId, String datasetId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文档到知识库
|
||||||
|
*
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
* @param file 上传的文件
|
||||||
|
* @param name 文档名称
|
||||||
|
* @param metaFields 元数据字段
|
||||||
|
* @param chunkMethod 分块方法
|
||||||
|
* @param parserConfig 解析器配置
|
||||||
|
* @return 上传的文档信息
|
||||||
|
*/
|
||||||
|
KnowledgeFilesDTO uploadDocument(String datasetId, MultipartFile file, String name,
|
||||||
|
Map<String, Object> metaFields, String chunkMethod,
|
||||||
|
Map<String, Object> parserConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据状态分页查询文档列表
|
||||||
|
*
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
* @param status 文档解析状态(0-未开始,1-进行中,2-已取消,3-已完成,4-失败)
|
||||||
|
* @param page 页码
|
||||||
|
* @param limit 每页数量
|
||||||
|
* @return 分页数据
|
||||||
|
*/
|
||||||
|
PageData<KnowledgeFilesDTO> getPageListByStatus(String datasetId, Integer status, Integer page, Integer limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文档ID和知识库ID删除文档
|
||||||
|
*
|
||||||
|
* @param documentId 文档ID
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
*/
|
||||||
|
void deleteByDocumentId(String documentId, String datasetId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取RAG配置信息
|
||||||
|
*
|
||||||
|
* @param ragModelId RAG模型配置ID
|
||||||
|
* @return RAG配置信息
|
||||||
|
*/
|
||||||
|
Map<String, Object> getRAGConfig(String ragModelId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析文档(切块)
|
||||||
|
*
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
* @param documentIds 文档ID列表
|
||||||
|
* @return 解析结果
|
||||||
|
*/
|
||||||
|
boolean parseDocuments(String datasetId, List<String> documentIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列出指定文档的切片
|
||||||
|
*
|
||||||
|
* @param datasetId 知识库ID
|
||||||
|
* @param documentId 文档ID
|
||||||
|
* @param keywords 关键词过滤
|
||||||
|
* @param page 页码
|
||||||
|
* @param pageSize 每页数量
|
||||||
|
* @param chunkId 切片ID
|
||||||
|
* @return 切片列表信息
|
||||||
|
*/
|
||||||
|
Map<String, Object> listChunks(String datasetId, String documentId, String keywords,
|
||||||
|
Integer page, Integer pageSize, String chunkId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 召回测试 - 从指定数据集或文档中检索相关切片
|
||||||
|
*
|
||||||
|
* @param question 用户查询或查询关键词
|
||||||
|
* @param datasetIds 数据集ID列表
|
||||||
|
* @param documentIds 文档ID列表
|
||||||
|
* @param page 页码
|
||||||
|
* @param pageSize 每页数量
|
||||||
|
* @param similarityThreshold 最小相似度阈值
|
||||||
|
* @param vectorSimilarityWeight 向量相似度权重
|
||||||
|
* @param topK 参与向量余弦计算的切片数量
|
||||||
|
* @param rerankId 重排模型ID
|
||||||
|
* @param keyword 是否启用关键词匹配
|
||||||
|
* @param highlight 是否启用高亮显示
|
||||||
|
* @param crossLanguages 跨语言翻译列表
|
||||||
|
* @param metadataCondition 元数据过滤条件
|
||||||
|
* @return 召回测试结果
|
||||||
|
*/
|
||||||
|
Map<String, Object> retrievalTest(String question, List<String> datasetIds, List<String> documentIds,
|
||||||
|
Integer page, Integer pageSize, Float similarityThreshold,
|
||||||
|
Float vectorSimilarityWeight, Integer topK, String rerankId,
|
||||||
|
Boolean keyword, Boolean highlight, List<String> crossLanguages,
|
||||||
|
Map<String, Object> metadataCondition);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,851 @@
|
||||||
|
package xiaozhi.modules.knowledge.service.impl;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import xiaozhi.common.constant.Constant;
|
||||||
|
import xiaozhi.common.exception.ErrorCode;
|
||||||
|
import xiaozhi.common.exception.RenException;
|
||||||
|
import xiaozhi.common.page.PageData;
|
||||||
|
import xiaozhi.common.redis.RedisKeys;
|
||||||
|
import xiaozhi.common.redis.RedisUtils;
|
||||||
|
import xiaozhi.common.service.impl.BaseServiceImpl;
|
||||||
|
import xiaozhi.common.utils.ConvertUtils;
|
||||||
|
import xiaozhi.common.utils.MessageUtils;
|
||||||
|
import xiaozhi.modules.knowledge.dao.KnowledgeBaseDao;
|
||||||
|
import xiaozhi.modules.knowledge.dto.KnowledgeBaseDTO;
|
||||||
|
import xiaozhi.modules.knowledge.entity.KnowledgeBaseEntity;
|
||||||
|
import xiaozhi.modules.knowledge.service.KnowledgeBaseService;
|
||||||
|
import xiaozhi.modules.model.dao.ModelConfigDao;
|
||||||
|
import xiaozhi.modules.model.entity.ModelConfigEntity;
|
||||||
|
import xiaozhi.modules.model.service.ModelConfigService;
|
||||||
|
import xiaozhi.modules.security.user.SecurityUser;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao, KnowledgeBaseEntity>
|
||||||
|
implements KnowledgeBaseService {
|
||||||
|
|
||||||
|
private final KnowledgeBaseDao knowledgeBaseDao;
|
||||||
|
private final ModelConfigService modelConfigService;
|
||||||
|
private final ModelConfigDao modelConfigDao;
|
||||||
|
private final RedisUtils redisUtils;
|
||||||
|
private RestTemplate restTemplate = new RestTemplate();
|
||||||
|
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KnowledgeBaseEntity selectById(Serializable datasetId) {
|
||||||
|
if (datasetId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先从Redis获取缓存
|
||||||
|
String key = RedisKeys.getKnowledgeBaseCacheKey(datasetId.toString());
|
||||||
|
KnowledgeBaseEntity cachedEntity = (KnowledgeBaseEntity) redisUtils.get(key);
|
||||||
|
if (cachedEntity != null) {
|
||||||
|
return cachedEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果缓存中没有,则从数据库获取
|
||||||
|
KnowledgeBaseEntity entity = knowledgeBaseDao.selectById(datasetId);
|
||||||
|
if (entity == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 存入Redis缓存
|
||||||
|
redisUtils.set(key, entity);
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageData<KnowledgeBaseDTO> getPageList(KnowledgeBaseDTO knowledgeBaseDTO, Integer page, Integer limit) {
|
||||||
|
long curPage = page;
|
||||||
|
long pageSize = limit;
|
||||||
|
Page<KnowledgeBaseEntity> pageInfo = new Page<>(curPage, pageSize);
|
||||||
|
|
||||||
|
QueryWrapper<KnowledgeBaseEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
// 添加查询条件
|
||||||
|
if (knowledgeBaseDTO != null) {
|
||||||
|
queryWrapper.like(StringUtils.isNotBlank(knowledgeBaseDTO.getName()), "name", knowledgeBaseDTO.getName());
|
||||||
|
queryWrapper.eq(knowledgeBaseDTO.getStatus() != null, "status", knowledgeBaseDTO.getStatus());
|
||||||
|
queryWrapper.eq("creator", knowledgeBaseDTO.getCreator());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加排序规则:按创建时间降序
|
||||||
|
queryWrapper.orderByDesc("created_at");
|
||||||
|
|
||||||
|
IPage<KnowledgeBaseEntity> knowledgeBaseEntityIPage = knowledgeBaseDao.selectPage(pageInfo, queryWrapper);
|
||||||
|
|
||||||
|
// 获取分页数据
|
||||||
|
PageData<KnowledgeBaseDTO> pageData = getPageData(knowledgeBaseEntityIPage, KnowledgeBaseDTO.class);
|
||||||
|
|
||||||
|
// 为每个知识库获取文档数量
|
||||||
|
if (pageData != null && pageData.getList() != null) {
|
||||||
|
for (KnowledgeBaseDTO knowledgeBase : pageData.getList()) {
|
||||||
|
try {
|
||||||
|
Integer documentCount = getDocumentCountFromRAGFlow(knowledgeBase.getDatasetId(),
|
||||||
|
knowledgeBase.getRagModelId());
|
||||||
|
knowledgeBase.setDocumentCount(documentCount);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 构建详细的错误信息,包含异常类型和消息
|
||||||
|
String baseErrorMessage = e.getClass().getSimpleName() + " - 获取知识库文档数量失败";
|
||||||
|
String errorMessage = baseErrorMessage + (e.getMessage() != null ? ": " + e.getMessage() : "");
|
||||||
|
log.warn("知识库 {} {}", knowledgeBase.getDatasetId(), errorMessage);
|
||||||
|
knowledgeBase.setDocumentCount(0); // 设置默认值
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KnowledgeBaseDTO getById(String id) {
|
||||||
|
if (StringUtils.isBlank(id)) {
|
||||||
|
throw new RenException(ErrorCode.IDENTIFIER_NOT_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
KnowledgeBaseEntity entity = knowledgeBaseDao.selectById(id);
|
||||||
|
if (entity == null) {
|
||||||
|
throw new RenException(ErrorCode.Knowledge_Base_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConvertUtils.sourceToTarget(entity, KnowledgeBaseDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KnowledgeBaseDTO save(KnowledgeBaseDTO knowledgeBaseDTO) {
|
||||||
|
if (knowledgeBaseDTO == null) {
|
||||||
|
throw new RenException(ErrorCode.PARAMS_GET_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否存在同名知识库
|
||||||
|
checkDuplicateKnowledgeBaseName(knowledgeBaseDTO, null);
|
||||||
|
|
||||||
|
String datasetId = null;
|
||||||
|
// 调用RAGFlow API创建数据集
|
||||||
|
try {
|
||||||
|
Map<String, Object> ragConfig = getValidatedRAGConfig(knowledgeBaseDTO.getRagModelId());
|
||||||
|
datasetId = createDatasetInRAGFlow(
|
||||||
|
knowledgeBaseDTO.getName(),
|
||||||
|
knowledgeBaseDTO.getDescription(),
|
||||||
|
ragConfig);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 如果RAG API调用失败,直接抛出异常
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证数据集ID是否已存在
|
||||||
|
KnowledgeBaseEntity existingEntity = knowledgeBaseDao.selectOne(
|
||||||
|
new QueryWrapper<KnowledgeBaseEntity>().eq("dataset_id", datasetId));
|
||||||
|
if (existingEntity != null) {
|
||||||
|
// 如果datasetId已存在,删除RAGFlow中的数据集并抛出异常
|
||||||
|
try {
|
||||||
|
Map<String, Object> ragConfig = getValidatedRAGConfig(knowledgeBaseDTO.getRagModelId());
|
||||||
|
deleteDatasetInRAGFlow(datasetId, ragConfig);
|
||||||
|
} catch (Exception deleteException) {
|
||||||
|
// 提供更详细的错误信息,包括异常类型和消息
|
||||||
|
String errorMessage = "删除重复datasetId的RAGFlow数据集失败: " + deleteException.getClass().getSimpleName();
|
||||||
|
if (deleteException.getMessage() != null) {
|
||||||
|
errorMessage += " - " + deleteException.getMessage();
|
||||||
|
}
|
||||||
|
log.warn(errorMessage, deleteException);
|
||||||
|
}
|
||||||
|
throw new RenException(ErrorCode.DB_RECORD_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建本地实体并保存
|
||||||
|
KnowledgeBaseEntity entity = ConvertUtils.sourceToTarget(knowledgeBaseDTO, KnowledgeBaseEntity.class);
|
||||||
|
entity.setDatasetId(datasetId);
|
||||||
|
knowledgeBaseDao.insert(entity);
|
||||||
|
|
||||||
|
return ConvertUtils.sourceToTarget(entity, KnowledgeBaseDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KnowledgeBaseDTO update(KnowledgeBaseDTO knowledgeBaseDTO) {
|
||||||
|
if (knowledgeBaseDTO == null || StringUtils.isBlank(knowledgeBaseDTO.getId())) {
|
||||||
|
throw new RenException(ErrorCode.IDENTIFIER_NOT_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查记录是否存在
|
||||||
|
KnowledgeBaseEntity existingEntity = knowledgeBaseDao.selectById(knowledgeBaseDTO.getId());
|
||||||
|
if (existingEntity == null) {
|
||||||
|
throw new RenException(ErrorCode.Knowledge_Base_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否存在同名知识库(排除当前记录)
|
||||||
|
checkDuplicateKnowledgeBaseName(knowledgeBaseDTO, knowledgeBaseDTO.getId());
|
||||||
|
|
||||||
|
// 验证数据集ID是否与其他记录冲突
|
||||||
|
if (StringUtils.isNotBlank(knowledgeBaseDTO.getDatasetId())) {
|
||||||
|
KnowledgeBaseEntity conflictEntity = knowledgeBaseDao.selectOne(
|
||||||
|
new QueryWrapper<KnowledgeBaseEntity>()
|
||||||
|
.eq("dataset_id", knowledgeBaseDTO.getDatasetId())
|
||||||
|
.ne("id", knowledgeBaseDTO.getId()));
|
||||||
|
if (conflictEntity != null) {
|
||||||
|
throw new RenException(ErrorCode.DB_RECORD_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean needRagValidation = StringUtils.isNotBlank(knowledgeBaseDTO.getDatasetId())
|
||||||
|
&& StringUtils.isNotBlank(knowledgeBaseDTO.getRagModelId());
|
||||||
|
|
||||||
|
if (needRagValidation) {
|
||||||
|
try {
|
||||||
|
// 先校验RAG配置
|
||||||
|
Map<String, Object> ragConfig = getValidatedRAGConfig(knowledgeBaseDTO.getRagModelId());
|
||||||
|
|
||||||
|
// 调用RAGFlow API更新数据集
|
||||||
|
updateDatasetInRAGFlow(
|
||||||
|
knowledgeBaseDTO.getDatasetId(),
|
||||||
|
knowledgeBaseDTO.getName(),
|
||||||
|
knowledgeBaseDTO.getDescription(),
|
||||||
|
ragConfig);
|
||||||
|
|
||||||
|
log.info("RAGFlow API更新成功,datasetId: {}", knowledgeBaseDTO.getDatasetId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 提供更详细的错误信息,包括异常类型和消息
|
||||||
|
String errorMessage = "更新RAGFlow数据集失败: " + e.getClass().getSimpleName();
|
||||||
|
if (e.getMessage() != null) {
|
||||||
|
errorMessage += " - " + e.getMessage();
|
||||||
|
}
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.warn("datasetId或ragModelId为空,跳过RAGFlow更新");
|
||||||
|
}
|
||||||
|
|
||||||
|
KnowledgeBaseEntity entity = ConvertUtils.sourceToTarget(knowledgeBaseDTO, KnowledgeBaseEntity.class);
|
||||||
|
knowledgeBaseDao.updateById(entity);
|
||||||
|
|
||||||
|
// 删除缓存
|
||||||
|
if (entity.getDatasetId() != null) {
|
||||||
|
redisUtils.delete(RedisKeys.getKnowledgeBaseCacheKey(entity.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConvertUtils.sourceToTarget(entity, KnowledgeBaseDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KnowledgeBaseDTO getByDatasetId(String datasetId) {
|
||||||
|
if (StringUtils.isBlank(datasetId)) {
|
||||||
|
throw new RenException(ErrorCode.PARAMS_GET_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
KnowledgeBaseEntity entity = knowledgeBaseDao.selectOne(
|
||||||
|
new QueryWrapper<KnowledgeBaseEntity>().eq("dataset_id", datasetId));
|
||||||
|
|
||||||
|
if (entity == null) {
|
||||||
|
throw new RenException(ErrorCode.Knowledge_Base_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConvertUtils.sourceToTarget(entity, KnowledgeBaseDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteByDatasetId(String datasetId) {
|
||||||
|
if (StringUtils.isBlank(datasetId)) {
|
||||||
|
throw new RenException(ErrorCode.PARAMS_GET_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("=== 开始通过datasetId删除操作 ===");
|
||||||
|
log.info("删除datasetId: {}", datasetId);
|
||||||
|
|
||||||
|
KnowledgeBaseEntity entity = knowledgeBaseDao.selectOne(
|
||||||
|
new QueryWrapper<KnowledgeBaseEntity>().eq("dataset_id", datasetId));
|
||||||
|
|
||||||
|
if (entity == null) {
|
||||||
|
log.warn("记录不存在,datasetId: {}", datasetId);
|
||||||
|
throw new RenException(ErrorCode.Knowledge_Base_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
redisUtils.delete(RedisKeys.getKnowledgeBaseCacheKey(entity.getId()));
|
||||||
|
|
||||||
|
log.info("找到记录: ID={}, datasetId={}, ragModelId={}",
|
||||||
|
entity.getId(), entity.getDatasetId(), entity.getRagModelId());
|
||||||
|
|
||||||
|
// 先调用RAGFlow API删除数据集
|
||||||
|
boolean apiDeleteSuccess = false;
|
||||||
|
if (StringUtils.isNotBlank(entity.getDatasetId()) && StringUtils.isNotBlank(entity.getRagModelId())) {
|
||||||
|
try {
|
||||||
|
log.info("开始调用RAGFlow API删除数据集");
|
||||||
|
// 在删除前进行RAG配置校验
|
||||||
|
Map<String, Object> ragConfig = getValidatedRAGConfig(entity.getRagModelId());
|
||||||
|
deleteDatasetInRAGFlow(entity.getDatasetId(), ragConfig);
|
||||||
|
log.info("RAGFlow API删除调用完成");
|
||||||
|
apiDeleteSuccess = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 提供更详细的错误信息,包括异常类型和消息
|
||||||
|
String errorMessage = "删除RAGFlow数据集失败: " + e.getClass().getSimpleName();
|
||||||
|
if (e.getMessage() != null) {
|
||||||
|
errorMessage += " - " + e.getMessage();
|
||||||
|
}
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.warn("datasetId或ragModelId为空,跳过RAGFlow删除");
|
||||||
|
apiDeleteSuccess = true; // 没有RAG数据集,视为成功
|
||||||
|
}
|
||||||
|
|
||||||
|
// API删除成功后再删除本地记录
|
||||||
|
if (apiDeleteSuccess) {
|
||||||
|
log.info("开始删除ai_agent_plugin_mapping表中与知识库ID '{}' 相关的映射记录", entity.getId());
|
||||||
|
|
||||||
|
// 先删除相关的插件映射记录
|
||||||
|
knowledgeBaseDao.deletePluginMappingByKnowledgeBaseId(entity.getId());
|
||||||
|
log.info("插件映射记录删除完成");
|
||||||
|
|
||||||
|
int deleteCount = knowledgeBaseDao.deleteById(entity.getId());
|
||||||
|
log.info("本地数据库删除结果: {}", deleteCount > 0 ? "成功" : "失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("=== 通过datasetId删除操作结束 ===");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getRAGConfig(String ragModelId) {
|
||||||
|
if (StringUtils.isBlank(ragModelId)) {
|
||||||
|
throw new RenException(ErrorCode.PARAMS_GET_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从缓存获取模型配置
|
||||||
|
ModelConfigEntity modelConfig = modelConfigService.getModelByIdFromCache(ragModelId);
|
||||||
|
if (modelConfig == null || modelConfig.getConfigJson() == null) {
|
||||||
|
throw new RenException(ErrorCode.RAG_CONFIG_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证是否为RAG类型配置
|
||||||
|
if (!Constant.RAG_CONFIG_TYPE.equals(modelConfig.getModelType().toUpperCase())) {
|
||||||
|
throw new RenException(ErrorCode.RAG_CONFIG_TYPE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> config = modelConfig.getConfigJson();
|
||||||
|
|
||||||
|
// 验证必要的配置参数
|
||||||
|
validateRagConfig(config);
|
||||||
|
|
||||||
|
// 返回配置信息
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getRAGConfigByDatasetId(String datasetId) {
|
||||||
|
if (StringUtils.isBlank(datasetId)) {
|
||||||
|
throw new RenException(ErrorCode.PARAMS_GET_ERROR, "datasetId不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据datasetId查询知识库信息
|
||||||
|
KnowledgeBaseDTO knowledgeBase = getByDatasetId(datasetId);
|
||||||
|
if (knowledgeBase == null) {
|
||||||
|
log.warn("未找到datasetId为{}的知识库", datasetId);
|
||||||
|
throw new RenException(ErrorCode.Knowledge_Base_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果知识库指定了ragModelId,使用该配置
|
||||||
|
String ragModelId = knowledgeBase.getRagModelId();
|
||||||
|
if (StringUtils.isBlank(ragModelId)) {
|
||||||
|
log.warn("知识库datasetId为{}未配置ragModelId", datasetId);
|
||||||
|
throw new RenException(ErrorCode.RAG_CONFIG_NOT_FOUND, "知识库未配置RAG模型");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取并返回RAG配置
|
||||||
|
return getRAGConfig(ragModelId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getRAGModels() {
|
||||||
|
// 查询RAG类型的模型配置
|
||||||
|
QueryWrapper<ModelConfigEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("model_type", Constant.RAG_CONFIG_TYPE)
|
||||||
|
.eq("is_enabled", 1)
|
||||||
|
.orderByDesc("is_default")
|
||||||
|
.orderByDesc("create_date");
|
||||||
|
|
||||||
|
List<ModelConfigEntity> modelConfigs = modelConfigDao.selectList(queryWrapper);
|
||||||
|
|
||||||
|
List<Map<String, Object>> modelList = new ArrayList<>();
|
||||||
|
for (ModelConfigEntity modelConfig : modelConfigs) {
|
||||||
|
Map<String, Object> modelInfo = new HashMap<>();
|
||||||
|
modelInfo.put("id", modelConfig.getId());
|
||||||
|
modelInfo.put("modelName", modelConfig.getModelName());
|
||||||
|
modelList.add(modelInfo);
|
||||||
|
}
|
||||||
|
return modelList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证RAG配置中是否包含必要的参数
|
||||||
|
*/
|
||||||
|
private void validateRagConfig(Map<String, Object> config) {
|
||||||
|
if (config == null) {
|
||||||
|
throw new RenException(ErrorCode.RAG_CONFIG_NOT_FOUND, "RAG配置为空,请检查配置");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从配置中提取必要的参数
|
||||||
|
String baseUrl = (String) config.get("base_url");
|
||||||
|
String apiKey = (String) config.get("api_key");
|
||||||
|
|
||||||
|
// 验证base_url是否存在且非空
|
||||||
|
if (StringUtils.isBlank(baseUrl)) {
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR_URL_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证api_key是否存在且非空
|
||||||
|
if (StringUtils.isBlank(apiKey)) {
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR_API_KEY_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查api_key是否包含占位符
|
||||||
|
if (apiKey.contains("你")) {
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR_API_KEY_INVALID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证base_url格式
|
||||||
|
if (!baseUrl.startsWith("http://") && !baseUrl.startsWith("https://")) {
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR_URL_INVALID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用RAGFlow API创建数据集
|
||||||
|
*/
|
||||||
|
private String createDatasetInRAGFlow(String name, String description, Map<String, Object> ragConfig) {
|
||||||
|
String datasetId = null;
|
||||||
|
String baseUrl = (String) ragConfig.get("base_url");
|
||||||
|
String apiKey = (String) ragConfig.get("api_key");
|
||||||
|
|
||||||
|
log.info("开始调用RAGFlow API创建数据集, name: {}", name);
|
||||||
|
log.debug("RAGFlow配置 - baseUrl: {}, apiKey: {}", baseUrl, StringUtils.isBlank(apiKey) ? "未配置" : "已配置");
|
||||||
|
|
||||||
|
// 构建请求URL
|
||||||
|
String url = baseUrl + "/api/v1/datasets";
|
||||||
|
log.debug("请求URL: {}", url);
|
||||||
|
|
||||||
|
// 构建请求体
|
||||||
|
Map<String, Object> requestBody = new HashMap<>();
|
||||||
|
String username = SecurityUser.getUser().getUsername();
|
||||||
|
requestBody.put("name", username + "_" + name);
|
||||||
|
if (StringUtils.isNotBlank(description)) {
|
||||||
|
requestBody.put("description", description);
|
||||||
|
}
|
||||||
|
log.debug("请求体: {}", requestBody);
|
||||||
|
|
||||||
|
// 设置请求头
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.set("Authorization", "Bearer " + apiKey);
|
||||||
|
|
||||||
|
HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(requestBody, headers);
|
||||||
|
|
||||||
|
// 发送POST请求
|
||||||
|
log.info("发送POST请求到RAGFlow API...");
|
||||||
|
ResponseEntity<String> response;
|
||||||
|
try {
|
||||||
|
response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String errorMessage = url + e.getMessage();
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("RAGFlow API响应状态码: {}", response.getStatusCode());
|
||||||
|
log.debug("RAGFlow API响应内容: {}", response.getBody());
|
||||||
|
|
||||||
|
if (!response.getStatusCode().is2xxSuccessful()) {
|
||||||
|
String errorMessage = response.getStatusCode() + ", 响应内容: " + response.getBody();
|
||||||
|
log.error(errorMessage);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析响应体,提取datasetId
|
||||||
|
String responseBody = response.getBody();
|
||||||
|
if (StringUtils.isNotBlank(responseBody)) {
|
||||||
|
try {
|
||||||
|
// 解析RAGFlow API响应,支持多种可能的字段名
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
Map<String, Object> responseMap = objectMapper.readValue(responseBody, Map.class);
|
||||||
|
|
||||||
|
log.debug("RAGFlow API响应解析结果: {}", responseMap);
|
||||||
|
|
||||||
|
// 首先检查响应码
|
||||||
|
Integer code = (Integer) responseMap.get("code");
|
||||||
|
String message = (String) responseMap.get("message");
|
||||||
|
if (code != null && code == 0) {
|
||||||
|
// 响应码为0表示成功,从data字段中获取datasetId
|
||||||
|
Object dataObj = responseMap.get("data");
|
||||||
|
if (dataObj instanceof Map) {
|
||||||
|
Map<String, Object> dataMap = (Map<String, Object>) dataObj;
|
||||||
|
datasetId = (String) dataMap.get("id");
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(datasetId)) {
|
||||||
|
// 如果id字段为空,尝试其他可能的字段名
|
||||||
|
datasetId = (String) dataMap.get("dataset_id");
|
||||||
|
datasetId = (String) dataMap.get("datasetId");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果响应码不为0,说明API调用失败
|
||||||
|
String errorMessage = "RAGFlow API调用失败,响应码: " + code + ", 消息: "
|
||||||
|
+ (message != null ? message : "未知错误");
|
||||||
|
log.error(errorMessage);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("从RAGFlow API响应中解析出datasetId: {}", datasetId);
|
||||||
|
log.debug("完整响应内容: {}", responseBody);
|
||||||
|
} catch (IOException e) {
|
||||||
|
// 构建详细的错误信息,包含异常类型和消息
|
||||||
|
String baseErrorMessage = e.getClass().getSimpleName() + " - 解析RAGFlow API响应时发生IO异常";
|
||||||
|
String errorMessage = baseErrorMessage + (e.getMessage() != null ? ": " + e.getMessage() : "");
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, "RAGFlow API响应解析失败: " + errorMessage);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 构建详细的错误信息,包含异常类型和消息
|
||||||
|
String baseErrorMessage = e.getClass().getSimpleName() + " - 解析RAGFlow API响应失败";
|
||||||
|
String errorMessage = baseErrorMessage + (e.getMessage() != null ? ": " + e.getMessage() : "");
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
// 如果解析失败,但响应体不为空,尝试直接使用响应体作为错误信息
|
||||||
|
String finalErrorMessage = responseBody;
|
||||||
|
if (e.getMessage() != null) {
|
||||||
|
finalErrorMessage += ",解析错误: " + errorMessage;
|
||||||
|
}
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, finalErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(datasetId)) {
|
||||||
|
log.error("无法从RAGFlow API响应中获取datasetId,响应内容: {}", responseBody);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, "RAGFlow API响应中未包含datasetId");
|
||||||
|
}
|
||||||
|
log.info("RAGFlow数据集创建成功,datasetId: {}", datasetId);
|
||||||
|
|
||||||
|
return datasetId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用RAGFlow API更新数据集
|
||||||
|
*/
|
||||||
|
private void updateDatasetInRAGFlow(String datasetId, String name, String description,
|
||||||
|
Map<String, Object> ragConfig) {
|
||||||
|
String baseUrl = (String) ragConfig.get("base_url");
|
||||||
|
String apiKey = (String) ragConfig.get("api_key");
|
||||||
|
|
||||||
|
log.info("开始调用RAGFlow API更新数据集,datasetId: {}, name: {}", datasetId, name);
|
||||||
|
log.debug("RAGFlow配置 - baseUrl: {}, apiKey: {}", baseUrl, StringUtils.isBlank(apiKey) ? "未配置" : "已配置");
|
||||||
|
|
||||||
|
// 构建请求URL
|
||||||
|
String url = baseUrl + "/api/v1/datasets/" + datasetId;
|
||||||
|
log.debug("请求URL: {}", url);
|
||||||
|
// 构建请求体
|
||||||
|
Map<String, Object> requestBody = new HashMap<>();
|
||||||
|
requestBody.put("dataset_id", datasetId);
|
||||||
|
String username = SecurityUser.getUser().getUsername();
|
||||||
|
requestBody.put("name", username + "_" + name);
|
||||||
|
if (StringUtils.isNotBlank(description)) {
|
||||||
|
requestBody.put("description", description);
|
||||||
|
}
|
||||||
|
log.debug("请求体: {}", requestBody);
|
||||||
|
|
||||||
|
// 设置请求头
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.set("Authorization", "Bearer " + apiKey);
|
||||||
|
|
||||||
|
HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(requestBody, headers);
|
||||||
|
|
||||||
|
// 发送PUT请求
|
||||||
|
log.info("发送PUT请求到RAGFlow API...");
|
||||||
|
ResponseEntity<String> response;
|
||||||
|
try {
|
||||||
|
response = restTemplate.exchange(url, HttpMethod.PUT, requestEntity, String.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String errorMessage = url + e.getMessage();
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("RAGFlow API响应状态码: {}", response.getStatusCode());
|
||||||
|
log.debug("RAGFlow API响应内容: {}", response.getBody());
|
||||||
|
|
||||||
|
if (!response.getStatusCode().is2xxSuccessful()) {
|
||||||
|
String errorMessage = response.getStatusCode() + ", 响应内容: " + response.getBody();
|
||||||
|
log.error(errorMessage);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析响应体,验证操作是否真正成功
|
||||||
|
String responseBody = response.getBody();
|
||||||
|
if (responseBody != null) {
|
||||||
|
try {
|
||||||
|
Map<String, Object> responseMap = objectMapper.readValue(responseBody, Map.class);
|
||||||
|
Integer code = (Integer) responseMap.get("code");
|
||||||
|
String message = (String) responseMap.get("message");
|
||||||
|
|
||||||
|
if (code != null && code != 0) {
|
||||||
|
String errorMessage = "RAGFlow API调用失败,响应码: " + code + ", 消息: "
|
||||||
|
+ (message != null ? message : "未知错误");
|
||||||
|
log.error(errorMessage);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, errorMessage);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// 构建详细的错误信息,包含异常类型和消息
|
||||||
|
String baseErrorMessage = e.getClass().getSimpleName() + " - 解析RAGFlow API响应时发生IO异常";
|
||||||
|
String errorMessage = baseErrorMessage + (e.getMessage() != null ? ": " + e.getMessage() : "");
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, "RAGFlow API响应解析失败: " + errorMessage);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 构建详细的错误信息,包含异常类型和消息
|
||||||
|
String baseErrorMessage = e.getClass().getSimpleName() + " - 解析RAGFlow API响应失败";
|
||||||
|
String errorMessage = baseErrorMessage + (e.getMessage() != null ? ": " + e.getMessage() : "");
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
// 如果解析失败,但响应体不为空,尝试直接使用响应体作为错误信息
|
||||||
|
String finalErrorMessage = responseBody;
|
||||||
|
if (e.getMessage() != null) {
|
||||||
|
finalErrorMessage += ",解析错误: " + errorMessage;
|
||||||
|
}
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, finalErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("RAGFlow数据集更新成功,datasetId: {}", datasetId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用RAGFlow API删除数据集
|
||||||
|
*/
|
||||||
|
private void deleteDatasetInRAGFlow(String datasetId, Map<String, Object> ragConfig) {
|
||||||
|
String baseUrl = (String) ragConfig.get("base_url");
|
||||||
|
String apiKey = (String) ragConfig.get("api_key");
|
||||||
|
|
||||||
|
log.info("开始调用RAGFlow API删除数据集,datasetId: {}", datasetId);
|
||||||
|
log.debug("RAGFlow配置 - baseUrl: {}, apiKey: {}", baseUrl, StringUtils.isBlank(apiKey) ? "未配置" : "已配置");
|
||||||
|
|
||||||
|
// 构建请求URL
|
||||||
|
String url = baseUrl + "/api/v1/datasets";
|
||||||
|
log.debug("请求URL: {}", url);
|
||||||
|
|
||||||
|
// 构建请求体
|
||||||
|
Map<String, Object> requestBody = new HashMap<>();
|
||||||
|
requestBody.put("ids", List.of(datasetId));
|
||||||
|
log.debug("请求体: {}", requestBody);
|
||||||
|
|
||||||
|
// 设置请求头
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.set("Authorization", "Bearer " + apiKey);
|
||||||
|
|
||||||
|
HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(requestBody, headers);
|
||||||
|
|
||||||
|
// 发送DELETE请求
|
||||||
|
log.info("发送DELETE请求到RAGFlow API...");
|
||||||
|
ResponseEntity<String> response;
|
||||||
|
try {
|
||||||
|
response = restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, String.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String errorMessage = url + e.getMessage();
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("RAGFlow API响应状态码: {}", response.getStatusCode());
|
||||||
|
log.debug("RAGFlow API响应内容: {}", response.getBody());
|
||||||
|
|
||||||
|
if (!response.getStatusCode().is2xxSuccessful()) {
|
||||||
|
String errorMessage = response.getStatusCode() + ", 响应内容: " + response.getBody();
|
||||||
|
log.error(errorMessage);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析响应体,验证操作是否真正成功
|
||||||
|
String responseBody = response.getBody();
|
||||||
|
if (responseBody != null) {
|
||||||
|
try {
|
||||||
|
Map<String, Object> responseMap = objectMapper.readValue(responseBody, Map.class);
|
||||||
|
Integer code = (Integer) responseMap.get("code");
|
||||||
|
String message = (String) responseMap.get("message");
|
||||||
|
|
||||||
|
if (code != null && code != 0) {
|
||||||
|
String errorMessage = "RAGFlow API调用失败,响应码: " + code + ", 消息: "
|
||||||
|
+ (message != null ? message : "未知错误");
|
||||||
|
log.error(errorMessage);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, errorMessage);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// 构建详细的错误信息,包含异常类型和消息
|
||||||
|
String baseErrorMessage = e.getClass().getSimpleName() + " - 解析RAGFlow API响应时发生IO异常";
|
||||||
|
String errorMessage = baseErrorMessage + (e.getMessage() != null ? ": " + e.getMessage() : "");
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, "RAGFlow API响应解析失败: " + errorMessage);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 构建详细的错误信息,包含异常类型和消息
|
||||||
|
String baseErrorMessage = e.getClass().getSimpleName() + " - 解析RAGFlow API响应失败";
|
||||||
|
String errorMessage = baseErrorMessage + (e.getMessage() != null ? ": " + e.getMessage() : "");
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
// 如果解析失败,但响应体不为空,尝试直接使用响应体作为错误信息
|
||||||
|
String finalErrorMessage = responseBody;
|
||||||
|
if (e.getMessage() != null) {
|
||||||
|
finalErrorMessage += ",解析错误: " + errorMessage;
|
||||||
|
}
|
||||||
|
throw new RenException(ErrorCode.RAG_API_ERROR, finalErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("RAGFlow数据集删除成功,datasetId: {}", datasetId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取RAG配置并验证
|
||||||
|
*/
|
||||||
|
private Map<String, Object> getValidatedRAGConfig(String ragModelId) {
|
||||||
|
if (StringUtils.isBlank(ragModelId)) {
|
||||||
|
throw new RenException(ErrorCode.PARAMS_GET_ERROR, "ragModelId不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> ragConfig = getRAGConfig(ragModelId);
|
||||||
|
|
||||||
|
// 验证RAG配置参数
|
||||||
|
validateRagConfig(ragConfig);
|
||||||
|
|
||||||
|
return ragConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否存在同名知识库
|
||||||
|
*
|
||||||
|
* @param knowledgeBaseDTO 知识库DTO
|
||||||
|
* @param excludeId 排除的ID(更新时使用)
|
||||||
|
*/
|
||||||
|
private void checkDuplicateKnowledgeBaseName(KnowledgeBaseDTO knowledgeBaseDTO, String excludeId) {
|
||||||
|
if (StringUtils.isNotBlank(knowledgeBaseDTO.getName())) {
|
||||||
|
Long currentUserId = SecurityUser.getUserId();
|
||||||
|
QueryWrapper<KnowledgeBaseEntity> queryWrapper = new QueryWrapper<KnowledgeBaseEntity>()
|
||||||
|
.eq("name", knowledgeBaseDTO.getName())
|
||||||
|
.eq("creator", currentUserId);
|
||||||
|
|
||||||
|
// 如果提供了排除ID,则排除该记录
|
||||||
|
if (StringUtils.isNotBlank(excludeId)) {
|
||||||
|
queryWrapper.ne("id", excludeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
long count = knowledgeBaseDao.selectCount(queryWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new RenException(ErrorCode.KNOWLEDGE_BASE_NAME_EXISTS,
|
||||||
|
MessageUtils.getMessage(ErrorCode.KNOWLEDGE_BASE_NAME_EXISTS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从RAGFlow API获取知识库的文档数量
|
||||||
|
*/
|
||||||
|
private Integer getDocumentCountFromRAGFlow(String datasetId, String ragModelId) {
|
||||||
|
if (StringUtils.isBlank(datasetId) || StringUtils.isBlank(ragModelId)) {
|
||||||
|
log.warn("datasetId或ragModelId为空,无法获取文档数量");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("开始获取知识库 {} 的文档数量", datasetId);
|
||||||
|
|
||||||
|
// 获取RAG配置
|
||||||
|
Map<String, Object> ragConfig = getValidatedRAGConfig(ragModelId);
|
||||||
|
String baseUrl = (String) ragConfig.get("base_url");
|
||||||
|
String apiKey = (String) ragConfig.get("api_key");
|
||||||
|
|
||||||
|
// 构建请求URL - 调用RAGFlow API获取文档列表,但不返回文档详情,只获取总数
|
||||||
|
String url = baseUrl + "/api/v1/datasets/" + datasetId + "/documents?page=1&size=1";
|
||||||
|
log.debug("请求URL: {}", url);
|
||||||
|
|
||||||
|
// 设置请求头
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.set("Authorization", "Bearer " + apiKey);
|
||||||
|
|
||||||
|
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
|
||||||
|
|
||||||
|
// 发送GET请求
|
||||||
|
log.info("发送GET请求到RAGFlow API获取文档数量...");
|
||||||
|
ResponseEntity<String> response;
|
||||||
|
try {
|
||||||
|
response = restTemplate.exchange(url, HttpMethod.GET, requestEntity, String.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String errorMessage = url + e.getMessage();
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("RAGFlow API响应状态码: {}", response.getStatusCode());
|
||||||
|
|
||||||
|
if (!response.getStatusCode().is2xxSuccessful()) {
|
||||||
|
log.error("RAGFlow API调用失败,状态码: {}, 响应内容: {}", response.getStatusCode(), response.getBody());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
String responseBody = response.getBody();
|
||||||
|
log.debug("RAGFlow API响应内容: {}", responseBody);
|
||||||
|
|
||||||
|
// 解析响应
|
||||||
|
try {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
Map<String, Object> responseMap = objectMapper.readValue(responseBody, Map.class);
|
||||||
|
Integer code = (Integer) responseMap.get("code");
|
||||||
|
|
||||||
|
if (code != null && code == 0) {
|
||||||
|
Object dataObj = responseMap.get("data");
|
||||||
|
if (dataObj instanceof Map) {
|
||||||
|
Map<String, Object> dataMap = (Map<String, Object>) dataObj;
|
||||||
|
Object totalObj = dataMap.get("total");
|
||||||
|
if (totalObj instanceof Integer) {
|
||||||
|
Integer documentCount = (Integer) totalObj;
|
||||||
|
log.info("获取知识库 {} 的文档数量成功: {}", datasetId, documentCount);
|
||||||
|
return documentCount;
|
||||||
|
} else if (totalObj instanceof Long) {
|
||||||
|
Long documentCount = (Long) totalObj;
|
||||||
|
log.info("获取知识库 {} 的文档数量成功: {}", datasetId, documentCount);
|
||||||
|
return documentCount.intValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("RAGFlow API调用失败,响应码: {}, 响应内容: {}", code, responseBody);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// 构建详细的错误信息,包含异常类型和消息
|
||||||
|
String baseErrorMessage = e.getClass().getSimpleName() + " - 解析RAGFlow API响应时发生IO异常";
|
||||||
|
String errorMessage = baseErrorMessage + (e.getMessage() != null ? ": " + e.getMessage() : "");
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 构建详细的错误信息,包含异常类型和消息
|
||||||
|
String baseErrorMessage = e.getClass().getSimpleName() + " - 解析RAGFlow API响应失败";
|
||||||
|
String errorMessage = baseErrorMessage + (e.getMessage() != null ? ": " + e.getMessage() : "");
|
||||||
|
log.error(errorMessage, e);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,12 @@ import xiaozhi.common.utils.ConvertUtils;
|
||||||
import xiaozhi.common.utils.Result;
|
import xiaozhi.common.utils.Result;
|
||||||
import xiaozhi.modules.agent.service.AgentTemplateService;
|
import xiaozhi.modules.agent.service.AgentTemplateService;
|
||||||
import xiaozhi.modules.config.service.ConfigService;
|
import xiaozhi.modules.config.service.ConfigService;
|
||||||
import xiaozhi.modules.model.dto.*;
|
import xiaozhi.modules.model.dto.LlmModelBasicInfoDTO;
|
||||||
|
import xiaozhi.modules.model.dto.ModelBasicInfoDTO;
|
||||||
|
import xiaozhi.modules.model.dto.ModelConfigBodyDTO;
|
||||||
|
import xiaozhi.modules.model.dto.ModelConfigDTO;
|
||||||
|
import xiaozhi.modules.model.dto.ModelProviderDTO;
|
||||||
|
import xiaozhi.modules.model.dto.VoiceDTO;
|
||||||
import xiaozhi.modules.model.entity.ModelConfigEntity;
|
import xiaozhi.modules.model.entity.ModelConfigEntity;
|
||||||
import xiaozhi.modules.model.service.ModelConfigService;
|
import xiaozhi.modules.model.service.ModelConfigService;
|
||||||
import xiaozhi.modules.model.service.ModelProviderService;
|
import xiaozhi.modules.model.service.ModelProviderService;
|
||||||
|
|
@ -124,6 +129,8 @@ public class ModelController {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return new Result<Void>().error("模型配置不存在");
|
return new Result<Void>().error("模型配置不存在");
|
||||||
}
|
}
|
||||||
|
// 不更新ConfigJson字段
|
||||||
|
entity.setConfigJson(null);
|
||||||
entity.setIsEnabled(status);
|
entity.setIsEnabled(status);
|
||||||
modelConfigService.updateById(entity);
|
modelConfigService.updateById(entity);
|
||||||
return new Result<Void>();
|
return new Result<Void>();
|
||||||
|
|
@ -141,6 +148,8 @@ public class ModelController {
|
||||||
modelConfigService.setDefaultModel(entity.getModelType(), 0);
|
modelConfigService.setDefaultModel(entity.getModelType(), 0);
|
||||||
entity.setIsEnabled(1);
|
entity.setIsEnabled(1);
|
||||||
entity.setIsDefault(1);
|
entity.setIsDefault(1);
|
||||||
|
// 不更新ConfigJson字段
|
||||||
|
entity.setConfigJson(null);
|
||||||
modelConfigService.updateById(entity);
|
modelConfigService.updateById(entity);
|
||||||
|
|
||||||
// 更新模板表中对应的模型ID
|
// 更新模板表中对应的模型ID
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ public class ModelConfigBodyDTO {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
// @Schema(description = "模型类型(Memory/ASR/VAD/LLM/TTS)")
|
@Schema(description = "模型ID,未填写将自动生成")
|
||||||
// private String modelType;
|
private String id;
|
||||||
//
|
|
||||||
@Schema(description = "模型编码(如AliLLM、DoubaoTTS)")
|
@Schema(description = "模型编码(如AliLLM、DoubaoTTS)")
|
||||||
private String modelCode;
|
private String modelCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@ package xiaozhi.modules.model.entity;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
|
|
||||||
|
|
@ -18,7 +16,6 @@ import lombok.Data;
|
||||||
@Schema(description = "模型配置表")
|
@Schema(description = "模型配置表")
|
||||||
public class ModelConfigEntity {
|
public class ModelConfigEntity {
|
||||||
|
|
||||||
@TableId(type = IdType.ASSIGN_UUID)
|
|
||||||
@Schema(description = "主键")
|
@Schema(description = "主键")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
@ -252,6 +253,12 @@ public class ModelConfigServiceImpl extends BaseServiceImpl<ModelConfigDao, Mode
|
||||||
if (modelConfigBodyDTO == null) {
|
if (modelConfigBodyDTO == null) {
|
||||||
throw new RenException(ErrorCode.PARAMS_GET_ERROR);
|
throw new RenException(ErrorCode.PARAMS_GET_ERROR);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isBlank(modelConfigBodyDTO.getId())) {
|
||||||
|
// 参照 MP @TableId AutoUUID 策略使用
|
||||||
|
// com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator(UUID.replace("-",""))
|
||||||
|
// 进行分配默认模型ID
|
||||||
|
modelConfigBodyDTO.setId(DefaultIdentifierGenerator.getInstance().nextUUID(ModelConfigEntity.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ import xiaozhi.common.page.PageData;
|
||||||
import xiaozhi.common.service.impl.BaseServiceImpl;
|
import xiaozhi.common.service.impl.BaseServiceImpl;
|
||||||
import xiaozhi.common.user.UserDetail;
|
import xiaozhi.common.user.UserDetail;
|
||||||
import xiaozhi.common.utils.ConvertUtils;
|
import xiaozhi.common.utils.ConvertUtils;
|
||||||
|
import xiaozhi.modules.knowledge.dao.KnowledgeBaseDao;
|
||||||
|
import xiaozhi.modules.knowledge.entity.KnowledgeBaseEntity;
|
||||||
import xiaozhi.modules.model.dao.ModelProviderDao;
|
import xiaozhi.modules.model.dao.ModelProviderDao;
|
||||||
import xiaozhi.modules.model.dto.ModelProviderDTO;
|
import xiaozhi.modules.model.dto.ModelProviderDTO;
|
||||||
import xiaozhi.modules.model.entity.ModelProviderEntity;
|
import xiaozhi.modules.model.entity.ModelProviderEntity;
|
||||||
|
|
@ -34,13 +36,43 @@ public class ModelProviderServiceImpl extends BaseServiceImpl<ModelProviderDao,
|
||||||
implements ModelProviderService {
|
implements ModelProviderService {
|
||||||
|
|
||||||
private final ModelProviderDao modelProviderDao;
|
private final ModelProviderDao modelProviderDao;
|
||||||
|
private final KnowledgeBaseDao knowledgeBaseDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ModelProviderDTO> getPluginList() {
|
public List<ModelProviderDTO> getPluginList() {
|
||||||
|
// 1. 获取插件列表
|
||||||
LambdaQueryWrapper<ModelProviderEntity> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ModelProviderEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(ModelProviderEntity::getModelType, "Plugin");
|
queryWrapper.eq(ModelProviderEntity::getModelType, "Plugin");
|
||||||
List<ModelProviderEntity> providerEntities = modelProviderDao.selectList(queryWrapper);
|
List<ModelProviderEntity> providerEntities = modelProviderDao.selectList(queryWrapper);
|
||||||
return ConvertUtils.sourceToTarget(providerEntities, ModelProviderDTO.class);
|
List<ModelProviderDTO> resultList = ConvertUtils.sourceToTarget(providerEntities, ModelProviderDTO.class);
|
||||||
|
|
||||||
|
// 2. 获取当前用户的知识库列表并追加到结果中
|
||||||
|
UserDetail userDetail = SecurityUser.getUser();
|
||||||
|
if (userDetail != null && userDetail.getId() != null) {
|
||||||
|
// 查询当前用户的知识库
|
||||||
|
LambdaQueryWrapper<KnowledgeBaseEntity> kbQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
kbQueryWrapper.eq(KnowledgeBaseEntity::getCreator, userDetail.getId());
|
||||||
|
kbQueryWrapper.eq(KnowledgeBaseEntity::getStatus, 1); // 只获取启用状态的知识库
|
||||||
|
List<KnowledgeBaseEntity> knowledgeBases = knowledgeBaseDao.selectList(kbQueryWrapper);
|
||||||
|
|
||||||
|
// 将知识库转换为ModelProviderDTO格式并添加到结果列表
|
||||||
|
for (KnowledgeBaseEntity kb : knowledgeBases) {
|
||||||
|
ModelProviderDTO dto = new ModelProviderDTO();
|
||||||
|
dto.setId(kb.getId());
|
||||||
|
dto.setModelType("Rag");
|
||||||
|
dto.setName("[知识库]" + kb.getName());
|
||||||
|
dto.setProviderCode("ragflow"); // 假设所有RAG都使用ragflow
|
||||||
|
dto.setFields("[]");
|
||||||
|
dto.setSort(0);
|
||||||
|
dto.setCreateDate(kb.getCreatedAt());
|
||||||
|
dto.setUpdateDate(kb.getUpdatedAt());
|
||||||
|
dto.setCreator(0L);
|
||||||
|
dto.setUpdater(0L);
|
||||||
|
resultList.add(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -64,4 +64,13 @@ public interface TimbreService extends BaseService<TimbreEntity> {
|
||||||
* @return 音色名称
|
* @return 音色名称
|
||||||
*/
|
*/
|
||||||
String getTimbreNameById(String id);
|
String getTimbreNameById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据音色编码获取音色信息
|
||||||
|
*
|
||||||
|
* @param ttsModelId 音色模型ID
|
||||||
|
* @param voiceCode 音色编码
|
||||||
|
* @return 音色信息
|
||||||
|
*/
|
||||||
|
VoiceDTO getByVoiceCode(String ttsModelId, String voiceCode);
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
package xiaozhi.modules.timbre.service.impl;
|
package xiaozhi.modules.timbre.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -15,18 +17,23 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import xiaozhi.common.constant.Constant;
|
import xiaozhi.common.constant.Constant;
|
||||||
|
import xiaozhi.common.exception.ErrorCode;
|
||||||
import xiaozhi.common.page.PageData;
|
import xiaozhi.common.page.PageData;
|
||||||
import xiaozhi.common.redis.RedisKeys;
|
import xiaozhi.common.redis.RedisKeys;
|
||||||
import xiaozhi.common.redis.RedisUtils;
|
import xiaozhi.common.redis.RedisUtils;
|
||||||
import xiaozhi.common.service.impl.BaseServiceImpl;
|
import xiaozhi.common.service.impl.BaseServiceImpl;
|
||||||
import xiaozhi.common.utils.ConvertUtils;
|
import xiaozhi.common.utils.ConvertUtils;
|
||||||
|
import xiaozhi.common.utils.MessageUtils;
|
||||||
import xiaozhi.modules.model.dto.VoiceDTO;
|
import xiaozhi.modules.model.dto.VoiceDTO;
|
||||||
|
import xiaozhi.modules.security.user.SecurityUser;
|
||||||
import xiaozhi.modules.timbre.dao.TimbreDao;
|
import xiaozhi.modules.timbre.dao.TimbreDao;
|
||||||
import xiaozhi.modules.timbre.dto.TimbreDataDTO;
|
import xiaozhi.modules.timbre.dto.TimbreDataDTO;
|
||||||
import xiaozhi.modules.timbre.dto.TimbrePageDTO;
|
import xiaozhi.modules.timbre.dto.TimbrePageDTO;
|
||||||
import xiaozhi.modules.timbre.entity.TimbreEntity;
|
import xiaozhi.modules.timbre.entity.TimbreEntity;
|
||||||
import xiaozhi.modules.timbre.service.TimbreService;
|
import xiaozhi.modules.timbre.service.TimbreService;
|
||||||
import xiaozhi.modules.timbre.vo.TimbreDetailsVO;
|
import xiaozhi.modules.timbre.vo.TimbreDetailsVO;
|
||||||
|
import xiaozhi.modules.voiceclone.dao.VoiceCloneDao;
|
||||||
|
import xiaozhi.modules.voiceclone.entity.VoiceCloneEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 音色的业务层的实现
|
* 音色的业务层的实现
|
||||||
|
|
@ -39,6 +46,7 @@ import xiaozhi.modules.timbre.vo.TimbreDetailsVO;
|
||||||
public class TimbreServiceImpl extends BaseServiceImpl<TimbreDao, TimbreEntity> implements TimbreService {
|
public class TimbreServiceImpl extends BaseServiceImpl<TimbreDao, TimbreEntity> implements TimbreService {
|
||||||
|
|
||||||
private final TimbreDao timbreDao;
|
private final TimbreDao timbreDao;
|
||||||
|
private final VoiceCloneDao voiceCloneDao;
|
||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -121,11 +129,30 @@ public class TimbreServiceImpl extends BaseServiceImpl<TimbreDao, TimbreEntity>
|
||||||
queryWrapper.like("name", voiceName);
|
queryWrapper.like("name", voiceName);
|
||||||
}
|
}
|
||||||
List<TimbreEntity> timbreEntities = timbreDao.selectList(queryWrapper);
|
List<TimbreEntity> timbreEntities = timbreDao.selectList(queryWrapper);
|
||||||
if (CollectionUtil.isEmpty(timbreEntities)) {
|
if (timbreEntities == null) {
|
||||||
return null;
|
timbreEntities = new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<VoiceDTO> voiceDTOs = timbreEntities.stream()
|
||||||
|
.map(entity -> new VoiceDTO(entity.getId(), entity.getName()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 获取当前登录用户ID
|
||||||
|
Long currentUserId = SecurityUser.getUser().getId();
|
||||||
|
if (currentUserId != null) {
|
||||||
|
// 查询用户的所有克隆音色记录
|
||||||
|
List<VoiceDTO> cloneEntities = voiceCloneDao.getTrainSuccess(ttsModelId, currentUserId);
|
||||||
|
for (VoiceDTO entity : cloneEntities) {
|
||||||
|
// 只添加训练成功的克隆音色,且模型ID匹配
|
||||||
|
VoiceDTO voiceDTO = new VoiceDTO();
|
||||||
|
voiceDTO.setId(entity.getId());
|
||||||
|
voiceDTO.setName(MessageUtils.getMessage(ErrorCode.VOICE_CLONE_PREFIX) + entity.getName());
|
||||||
|
redisUtils.set(RedisKeys.getTimbreNameById(voiceDTO.getId()), voiceDTO.getName(),
|
||||||
|
RedisUtils.NOT_EXPIRE);
|
||||||
|
voiceDTOs.add(0, voiceDTO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConvertUtils.sourceToTarget(timbreEntities, VoiceDTO.class);
|
return CollectionUtil.isEmpty(voiceDTOs) ? null : voiceDTOs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -154,8 +181,30 @@ public class TimbreServiceImpl extends BaseServiceImpl<TimbreDao, TimbreEntity>
|
||||||
redisUtils.set(RedisKeys.getTimbreNameById(id), name);
|
redisUtils.set(RedisKeys.getTimbreNameById(id), name);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
} else {
|
||||||
|
VoiceCloneEntity cloneEntity = voiceCloneDao.selectById(id);
|
||||||
|
if (cloneEntity != null) {
|
||||||
|
String name = MessageUtils.getMessage(ErrorCode.VOICE_CLONE_PREFIX) + cloneEntity.getName();
|
||||||
|
redisUtils.set(RedisKeys.getTimbreNameById(id), name);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoiceDTO getByVoiceCode(String ttsModelId, String voiceCode) {
|
||||||
|
if (StringUtils.isBlank(voiceCode)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
QueryWrapper<TimbreEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("tts_model_id", ttsModelId);
|
||||||
|
queryWrapper.eq("tts_voice", voiceCode);
|
||||||
|
List<TimbreEntity> list = timbreDao.selectList(queryWrapper);
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new VoiceDTO(list.get(0).getId(), list.get(0).getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -116,6 +116,7 @@ public class VoiceCloneController {
|
||||||
checkPermission(id);
|
checkPermission(id);
|
||||||
|
|
||||||
voiceCloneService.updateName(id, name);
|
voiceCloneService.updateName(id, name);
|
||||||
|
redisUtils.delete(RedisKeys.getTimbreNameById(id));
|
||||||
return new Result<String>();
|
return new Result<String>();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new Result<String>().error(ErrorCode.UPDATE_DATA_FAILED, "更新失败: " + e.getMessage());
|
return new Result<String>().error(ErrorCode.UPDATE_DATA_FAILED, "更新失败: " + e.getMessage());
|
||||||
|
|
@ -175,6 +176,8 @@ public class VoiceCloneController {
|
||||||
public Result<String> cloneAudio(@RequestBody Map<String, String> params) {
|
public Result<String> cloneAudio(@RequestBody Map<String, String> params) {
|
||||||
String cloneId = params.get("cloneId");
|
String cloneId = params.get("cloneId");
|
||||||
checkPermission(cloneId);
|
checkPermission(cloneId);
|
||||||
|
// 调用服务层进行语音克隆训练
|
||||||
|
voiceCloneService.cloneAudio(cloneId);
|
||||||
return new Result<String>();
|
return new Result<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,8 @@ public class VoiceResourceController {
|
||||||
try {
|
try {
|
||||||
voiceCloneService.save(dto);
|
voiceCloneService.save(dto);
|
||||||
return new Result<Void>();
|
return new Result<Void>();
|
||||||
|
} catch (xiaozhi.common.exception.RenException e) {
|
||||||
|
return new Result<Void>().error(e.getCode(), e.getMsg());
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
return new Result<Void>().error(ErrorCode.ADD_DATA_FAILED, e.getMessage());
|
return new Result<Void>().error(ErrorCode.ADD_DATA_FAILED, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
package xiaozhi.modules.voiceclone.dao;
|
package xiaozhi.modules.voiceclone.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import xiaozhi.modules.model.dto.VoiceDTO;
|
||||||
import xiaozhi.modules.voiceclone.entity.VoiceCloneEntity;
|
import xiaozhi.modules.voiceclone.entity.VoiceCloneEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -11,5 +14,13 @@ import xiaozhi.modules.voiceclone.entity.VoiceCloneEntity;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface VoiceCloneDao extends BaseMapper<VoiceCloneEntity> {
|
public interface VoiceCloneDao extends BaseMapper<VoiceCloneEntity> {
|
||||||
|
/**
|
||||||
|
* 获取用户训练成功的音色列表
|
||||||
|
*
|
||||||
|
* @param modelId 模型ID
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 训练成功的音色列表
|
||||||
|
*/
|
||||||
|
List<VoiceDTO> getTrainSuccess(String modelId, Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ public interface VoiceCloneService extends BaseService<VoiceCloneEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询声音克隆列表
|
* 根据用户ID查询声音克隆列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 声音克隆列表
|
||||||
*/
|
*/
|
||||||
List<VoiceCloneEntity> getByUserId(Long userId);
|
List<VoiceCloneEntity> getByUserId(Long userId);
|
||||||
|
|
||||||
|
|
@ -65,4 +68,11 @@ public interface VoiceCloneService extends BaseService<VoiceCloneEntity> {
|
||||||
* 获取音频数据
|
* 获取音频数据
|
||||||
*/
|
*/
|
||||||
byte[] getVoiceData(String id);
|
byte[] getVoiceData(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 克隆音频,调用火山引擎进行语音复刻训练
|
||||||
|
*
|
||||||
|
* @param cloneId 语音克隆记录ID
|
||||||
|
*/
|
||||||
|
void cloneAudio(String cloneId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
package xiaozhi.modules.voiceclone.service.impl;
|
package xiaozhi.modules.voiceclone.service.impl;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -12,14 +18,19 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import xiaozhi.common.constant.Constant;
|
||||||
|
import xiaozhi.common.exception.ErrorCode;
|
||||||
|
import xiaozhi.common.exception.RenException;
|
||||||
import xiaozhi.common.page.PageData;
|
import xiaozhi.common.page.PageData;
|
||||||
import xiaozhi.common.service.impl.BaseServiceImpl;
|
import xiaozhi.common.service.impl.BaseServiceImpl;
|
||||||
import xiaozhi.common.utils.ConvertUtils;
|
import xiaozhi.common.utils.ConvertUtils;
|
||||||
import xiaozhi.common.utils.DateUtils;
|
import xiaozhi.common.utils.DateUtils;
|
||||||
import xiaozhi.common.exception.ErrorCode;
|
import xiaozhi.modules.model.entity.ModelConfigEntity;
|
||||||
import xiaozhi.common.exception.RenException;
|
|
||||||
import xiaozhi.modules.model.service.ModelConfigService;
|
import xiaozhi.modules.model.service.ModelConfigService;
|
||||||
import xiaozhi.modules.sys.service.SysUserService;
|
import xiaozhi.modules.sys.service.SysUserService;
|
||||||
import xiaozhi.modules.voiceclone.dao.VoiceCloneDao;
|
import xiaozhi.modules.voiceclone.dao.VoiceCloneDao;
|
||||||
|
|
@ -28,6 +39,7 @@ import xiaozhi.modules.voiceclone.dto.VoiceCloneResponseDTO;
|
||||||
import xiaozhi.modules.voiceclone.entity.VoiceCloneEntity;
|
import xiaozhi.modules.voiceclone.entity.VoiceCloneEntity;
|
||||||
import xiaozhi.modules.voiceclone.service.VoiceCloneService;
|
import xiaozhi.modules.voiceclone.service.VoiceCloneService;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class VoiceCloneServiceImpl extends BaseServiceImpl<VoiceCloneDao, VoiceCloneEntity>
|
public class VoiceCloneServiceImpl extends BaseServiceImpl<VoiceCloneDao, VoiceCloneEntity>
|
||||||
|
|
@ -35,6 +47,7 @@ public class VoiceCloneServiceImpl extends BaseServiceImpl<VoiceCloneDao, VoiceC
|
||||||
|
|
||||||
private final ModelConfigService modelConfigService;
|
private final ModelConfigService modelConfigService;
|
||||||
private final SysUserService sysUserService;
|
private final SysUserService sysUserService;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<VoiceCloneEntity> page(Map<String, Object> params) {
|
public PageData<VoiceCloneEntity> page(Map<String, Object> params) {
|
||||||
|
|
@ -61,6 +74,36 @@ public class VoiceCloneServiceImpl extends BaseServiceImpl<VoiceCloneDao, VoiceC
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void save(VoiceCloneDTO dto) {
|
public void save(VoiceCloneDTO dto) {
|
||||||
|
ModelConfigEntity modelConfig = modelConfigService.getModelByIdFromCache(dto.getModelId());
|
||||||
|
if (modelConfig == null || modelConfig.getConfigJson() == null) {
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_MODEL_CONFIG_NOT_FOUND);
|
||||||
|
}
|
||||||
|
Map<String, Object> config = modelConfig.getConfigJson();
|
||||||
|
String type = (String) config.get("type");
|
||||||
|
if (StringUtils.isBlank(type)) {
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_MODEL_TYPE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查Voice ID是否已经被使用
|
||||||
|
for (String voiceId : dto.getVoiceIds()) {
|
||||||
|
if (StringUtils.isBlank(voiceId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (Constant.VOICE_CLONE_HUOSHAN_DOUBLE_STREAM.equals(type)) {
|
||||||
|
if (voiceId.indexOf("S_") == -1) {
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_HUOSHAN_VOICE_ID_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryWrapper<VoiceCloneEntity> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("voice_id", voiceId);
|
||||||
|
wrapper.eq("model_id", dto.getModelId());
|
||||||
|
Long count = baseDao.selectCount(wrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new RenException(ErrorCode.VOICE_ID_ALREADY_EXISTS, "音色ID " + voiceId + " 已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 遍历选择的音色ID,为每个音色ID创建一条记录
|
// 遍历选择的音色ID,为每个音色ID创建一条记录
|
||||||
int index = 0;
|
int index = 0;
|
||||||
String namePrefix = DateUtils.format(new java.util.Date(), "MMddHHmm");
|
String namePrefix = DateUtils.format(new java.util.Date(), "MMddHHmm");
|
||||||
|
|
@ -207,4 +250,125 @@ public class VoiceCloneServiceImpl extends BaseServiceImpl<VoiceCloneDao, VoiceC
|
||||||
}
|
}
|
||||||
return entity.getVoice();
|
return entity.getVoice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
|
public void cloneAudio(String cloneId) {
|
||||||
|
VoiceCloneEntity entity = baseDao.selectById(cloneId);
|
||||||
|
if (entity == null) {
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_RECORD_NOT_EXIST);
|
||||||
|
}
|
||||||
|
if (entity.getVoice() == null || entity.getVoice().length == 0) {
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_AUDIO_NOT_UPLOADED);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
ModelConfigEntity modelConfig = modelConfigService.getModelByIdFromCache(entity.getModelId());
|
||||||
|
if (modelConfig == null || modelConfig.getConfigJson() == null) {
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_MODEL_CONFIG_NOT_FOUND);
|
||||||
|
}
|
||||||
|
Map<String, Object> config = modelConfig.getConfigJson();
|
||||||
|
String type = (String) config.get("type");
|
||||||
|
if (StringUtils.isBlank(type)) {
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_MODEL_TYPE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
if (Constant.VOICE_CLONE_HUOSHAN_DOUBLE_STREAM.equals(type)) {
|
||||||
|
huoshanClone(config, entity);
|
||||||
|
}
|
||||||
|
} catch (RenException re) {
|
||||||
|
entity.setTrainStatus(3);
|
||||||
|
entity.setTrainError(re.getMsg());
|
||||||
|
baseDao.updateById(entity);
|
||||||
|
throw re;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
entity.setTrainStatus(3);
|
||||||
|
entity.setTrainError(e.getMessage());
|
||||||
|
baseDao.updateById(entity);
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_TRAINING_FAILED, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用火山引擎进行语音复刻训练
|
||||||
|
*
|
||||||
|
* @param config 模型配置
|
||||||
|
* @param entity 语音克隆记录实体
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void huoshanClone(Map<String, Object> config, VoiceCloneEntity entity) throws Exception {
|
||||||
|
String appid = (String) config.get("appid");
|
||||||
|
String accessToken = (String) config.get("access_token");
|
||||||
|
|
||||||
|
if (StringUtils.isAnyBlank(appid, accessToken)) {
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_HUOSHAN_CONFIG_MISSING);
|
||||||
|
}
|
||||||
|
|
||||||
|
String audioBase64 = Base64.getEncoder().encodeToString(entity.getVoice());
|
||||||
|
Map<String, Object> reqBody = new HashMap<>();
|
||||||
|
reqBody.put("appid", appid);
|
||||||
|
List<Map<String, String>> audios = new ArrayList<>();
|
||||||
|
Map<String, String> audioMap = new HashMap<>();
|
||||||
|
audioMap.put("audio_bytes", audioBase64);
|
||||||
|
audioMap.put("audio_format", "wav");
|
||||||
|
audios.add(audioMap);
|
||||||
|
reqBody.put("audios", audios);
|
||||||
|
reqBody.put("source", 2);
|
||||||
|
reqBody.put("language", 0);
|
||||||
|
reqBody.put("model_type", 1);
|
||||||
|
reqBody.put("speaker_id", entity.getVoiceId());
|
||||||
|
|
||||||
|
String apiUrl = "https://openspeech.bytedance.com/api/v1/mega_tts/audio/upload";
|
||||||
|
|
||||||
|
HttpClient client = HttpClient.newHttpClient();
|
||||||
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create(apiUrl))
|
||||||
|
.header("Content-Type", "application/json")
|
||||||
|
.header("Authorization", "Bearer;" + accessToken)
|
||||||
|
.header("Resource-Id", "seed-icl-1.0")
|
||||||
|
.POST(HttpRequest.BodyPublishers.ofString(objectMapper.writeValueAsString(reqBody)))
|
||||||
|
.build();
|
||||||
|
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
|
System.out.println(">>> HTTP status = " + response.statusCode());
|
||||||
|
System.out.println(">>> response body = " + response.body());
|
||||||
|
|
||||||
|
Map<String, Object> rsp = objectMapper.readValue(response.body(),
|
||||||
|
new TypeReference<Map<String, Object>>() {
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取BaseResp对象
|
||||||
|
Map<String, Object> baseResp = objectMapper.convertValue(rsp.get("BaseResp"),
|
||||||
|
new TypeReference<Map<String, Object>>() {
|
||||||
|
});
|
||||||
|
if (baseResp != null) {
|
||||||
|
Integer statusCode = objectMapper.convertValue(baseResp.get("StatusCode"), Integer.class);
|
||||||
|
String statusMessage = objectMapper.convertValue(baseResp.getOrDefault("StatusMessage", ""),
|
||||||
|
String.class);
|
||||||
|
|
||||||
|
// 获取speaker_id
|
||||||
|
String speakerId = objectMapper.convertValue(rsp.get("speaker_id"), String.class);
|
||||||
|
|
||||||
|
// StatusCode == 0 表示成功
|
||||||
|
if (statusCode != null && statusCode == 0 && StringUtils.isNotBlank(speakerId)) {
|
||||||
|
entity.setTrainStatus(2);
|
||||||
|
entity.setVoiceId(speakerId);
|
||||||
|
entity.setTrainError("");
|
||||||
|
baseDao.updateById(entity);
|
||||||
|
} else {
|
||||||
|
// 失败时使用StatusMessage作为错误信息
|
||||||
|
String errorMsg = StringUtils.isNotBlank(statusMessage) ? statusMessage : "训练失败";
|
||||||
|
throw new RenException(errorMsg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String errorMsg = objectMapper.convertValue(rsp.get("message"),
|
||||||
|
new TypeReference<String>() {
|
||||||
|
});
|
||||||
|
if (StringUtils.isNotBlank(errorMsg)) {
|
||||||
|
throw new RenException(errorMsg);
|
||||||
|
}
|
||||||
|
throw new RenException(ErrorCode.VOICE_CLONE_RESPONSE_FORMAT_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,9 @@ CREATE TABLE `ai_voice_clone` (
|
||||||
`train_error` VARCHAR(255) COMMENT '训练错误原因',
|
`train_error` VARCHAR(255) COMMENT '训练错误原因',
|
||||||
`creator` BIGINT COMMENT '创建者 ID',
|
`creator` BIGINT COMMENT '创建者 ID',
|
||||||
`create_date` DATETIME COMMENT '创建时间',
|
`create_date` DATETIME COMMENT '创建时间',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`),
|
||||||
|
INDEX idx_ai_voice_clone_user_id_model_id_train_status (model_id,user_id, train_status),
|
||||||
|
INDEX idx_ai_voice_clone_voice_id (voice_id),
|
||||||
|
INDEX idx_ai_voice_clone_user_id (user_id),
|
||||||
|
INDEX idx_ai_voice_clone_model_id_voice_id (model_id, voice_id)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='声音克隆表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='声音克隆表';
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
UPDATE `ai_model_config` SET model_code = 'XunfeiSparkLLM' WHERE id = 'LLM_XunfeiSparkLLM';
|
||||||
|
UPDATE `ai_model_config` SET model_code = 'XunfeiStreamASR' WHERE id = 'ASR_XunfeiStream';
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
-- 添加RAG模型供应器和配置
|
||||||
|
-- -------------------------------------------------------
|
||||||
|
|
||||||
|
-- 添加RAG模型供应器
|
||||||
|
delete from `ai_model_provider` where id = 'SYSTEM_RAG_ragflow';
|
||||||
|
INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES
|
||||||
|
('SYSTEM_RAG_ragflow', 'RAG', 'ragflow', 'RAGFlow', '[{"key": "base_url", "type": "string", "label": "服务地址"}, {"key": "api_key", "type": "string", "label": "API密钥"}]', 1, 1, NOW(), 1, NOW());
|
||||||
|
|
||||||
|
-- 添加RAG模型配置
|
||||||
|
delete from `ai_model_config` where id = 'RAG_RAGFlow';
|
||||||
|
INSERT INTO `ai_model_config` VALUES ('RAG_RAGFlow', 'RAG', 'ragflow', 'RAGFlow', 1, 1, '{"type": "ragflow", "base_url": "http://localhost", "api_key": "你的RAG密钥"}', 'https://github.com/infiniflow/ragflow/blob/main/README_zh.md', 'RAGFlow配置说明:
|
||||||
|
一、快速部署教程(docker部署)
|
||||||
|
1.$ sysctl vm.max_map_count
|
||||||
|
2.$ sysctl -w vm.max_map_count=262144
|
||||||
|
3.$ git clone https://github.com/infiniflow/ragflow.git
|
||||||
|
4.docker compose -f docker-compose.yml up -d
|
||||||
|
5.$ docker logs -f docker-ragflow-cpu-1
|
||||||
|
6.注冊登录后,点击右上角头像,获得RAGFlow的API KEY和API服务器地址。使用RAGFlow前请在Model Provider中添加模型和设置默认模型。
|
||||||
|
二、如果您希望关掉注册功能
|
||||||
|
1.停止服务 docker compose down
|
||||||
|
2. sed -i ''s/REGISTER_ENABLED=1/REGISTER_ENABLED=0/g'' .env
|
||||||
|
3.cat .env | grep -i register
|
||||||
|
4.看到REGISTER_ENABLED=0 重启服务即可。', 1, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
-- 知识库表
|
||||||
|
DROP TABLE IF EXISTS `ai_rag_dataset`;
|
||||||
|
CREATE TABLE `ai_rag_dataset` (
|
||||||
|
`id` VARCHAR(32) NOT NULL COMMENT '唯一标识',
|
||||||
|
`dataset_id` VARCHAR(64) NOT NULL COMMENT '知识库ID',
|
||||||
|
`rag_model_id` VARCHAR(64) COMMENT 'RAG模型配置ID',
|
||||||
|
`name` VARCHAR(100) NOT NULL COMMENT '知识库名称',
|
||||||
|
`description` TEXT COMMENT '知识库描述',
|
||||||
|
`status` TINYINT(1) DEFAULT 1 COMMENT '状态:0停用 1启用',
|
||||||
|
`creator` BIGINT COMMENT '创建者',
|
||||||
|
`created_at` DATETIME COMMENT '创建时间',
|
||||||
|
`updater` BIGINT COMMENT '更新者',
|
||||||
|
`updated_at` DATETIME COMMENT '更新时间',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_dataset_id` (`dataset_id`),
|
||||||
|
INDEX `idx_ai_rag_dataset_status` (`status`),
|
||||||
|
INDEX `idx_ai_rag_dataset_creator` (`creator`),
|
||||||
|
INDEX `idx_ai_rag_dataset_created_at` (`created_at`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='知识库表';
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
UPDATE `ai_model_config` SET
|
||||||
|
`doc_link` = 'https://github.com/infiniflow/ragflow/blob/main/README_zh.md',
|
||||||
|
`remark` = '详细部署教程参考:https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/ragflow-integration.md
|
||||||
|
部署成功,注冊登录后,点击右上角头像,获得RAGFlow的API KEY和API服务器地址。使用RAGFlow前请在Model Provider中添加模型和设置默认模型。' WHERE `id` = 'RAG_RAGFlow';
|
||||||
|
|
||||||
|
update `ai_model_config` set `model_name` = '外挂的大模型意图识别' where `id` = 'Intent_intent_llm';
|
||||||
|
update `ai_model_config` set `model_name` = '大模型自主函数调用' where `id` = 'Intent_function_call';
|
||||||
|
update `ai_model_config` set `model_name` = '百炼智能体应用' where `id` = 'LLM_AliAppLLM';
|
||||||
|
|
||||||
|
update `ai_model_provider` set `name` = '外挂的大模型意图识别' , `fields` = '[{"key":"llm","label":"引用的LLM模型","type":"string"}]' where id = 'SYSTEM_Intent_intent_llm';
|
||||||
|
update `ai_model_provider` set `name` = '大模型自主函数调用' where id = 'SYSTEM_Intent_function_call';
|
||||||
|
|
||||||
|
UPDATE ai_model_config set model_name = 'Linkerai(流式)' where id = 'TTS_LinkeraiTTS';
|
||||||
|
UPDATE ai_model_config set model_name = '火山引擎(流式)' where id = 'TTS_HuoshanDoubleStreamTTS';
|
||||||
|
UPDATE ai_model_config set model_name = '阿里百炼(流式)' where id = 'TTS_AliBLStreamTTS';
|
||||||
|
UPDATE ai_model_config set model_name = '科大讯飞(流式)' where id = 'TTS_XunFeiStreamTTS';
|
||||||
|
UPDATE ai_model_config set model_name = 'Minimax(流式)' where id = 'TTS_MinimaxStreamTTS';
|
||||||
|
UPDATE ai_model_config set model_name = '阿里云(流式)' where id = 'TTS_AliyunStreamTTS';
|
||||||
|
UPDATE ai_model_config set model_name = 'PaddleSpeech(流式)' where id = 'TTS_PaddleSpeechTTS';
|
||||||
|
UPDATE ai_model_config set model_name = 'IndexTTS(流式)' where id = 'TTS_IndexStreamTTS';
|
||||||
|
|
||||||
|
update ai_model_config SET sort = 2 where id = 'TTS_LinkeraiTTS';
|
||||||
|
update ai_model_config SET sort = 3 where id = 'TTS_HuoshanDoubleStreamTTS';
|
||||||
|
update ai_model_config SET sort = 4 where id = 'TTS_AliBLStreamTTS';
|
||||||
|
update ai_model_config SET sort = 5 where id = 'TTS_XunFeiStreamTTS';
|
||||||
|
update ai_model_config SET sort = 6 where id = 'TTS_MinimaxStreamTTS';
|
||||||
|
update ai_model_config SET sort = 7 where id = 'TTS_AliyunStreamTTS';
|
||||||
|
update ai_model_config SET sort = 8 where id = 'TTS_IndexStreamTTS';
|
||||||
|
update ai_model_config SET sort = 9 where id = 'TTS_PaddleSpeechTTS';
|
||||||
|
update ai_model_config SET sort = 10 where id = 'TTS_DoubaoTTS';
|
||||||
|
update ai_model_config SET sort = 11 where id = 'TTS_TencentTTS';
|
||||||
|
update ai_model_config SET sort = 12 where id = 'TTS_AliyunTTS';
|
||||||
|
update ai_model_config SET sort = 13 where id = 'TTS_OpenAITTS';
|
||||||
|
update ai_model_config SET sort = 14 where id = 'TTS_CosyVoiceSiliconflow';
|
||||||
|
update ai_model_config SET sort = 15 where id = 'TTS_CozeCnTTS';
|
||||||
|
update ai_model_config SET sort = 16 where id = 'TTS_FishSpeech';
|
||||||
|
update ai_model_config SET sort = 17 where id = 'TTS_GPT_SOVITS_V3';
|
||||||
|
update ai_model_config SET sort = 18 where id = 'TTS_GPT_SOVITS_V2';
|
||||||
|
update ai_model_config SET sort = 19 where id = 'TTS_TTS302AI';
|
||||||
|
update ai_model_config SET sort = 20 where id = 'TTS_GizwitsTTS';
|
||||||
|
update ai_model_config SET sort = 21 where id = 'TTS_VolcesAiGatewayTTS';
|
||||||
|
update ai_model_config SET sort = 22 where id = 'TTS_ACGNTTS';
|
||||||
|
update ai_model_config SET sort = 23 where id = 'TTS_CustomTTS';
|
||||||
|
|
||||||
|
UPDATE ai_model_config set model_name = '讯飞语音识别(流式)' where id = 'ASR_XunfeiStream';
|
||||||
|
UPDATE ai_model_config set model_name = 'Qwen3Flash语音识别' where id = 'ASR_Qwen3Flash';
|
||||||
|
|
||||||
|
update ai_model_config SET sort = 2 where id = 'ASR_FunASRServer';
|
||||||
|
update ai_model_config SET sort = 3 where id = 'ASR_XunfeiStream';
|
||||||
|
update ai_model_config SET sort = 4 where id = 'ASR_AliyunStreamASR';
|
||||||
|
update ai_model_config SET sort = 5 where id = 'ASR_DoubaoStreamASR';
|
||||||
|
update ai_model_config SET sort = 6 where id = 'ASR_TencentASR';
|
||||||
|
update ai_model_config SET sort = 7 where id = 'ASR_BaiduASR';
|
||||||
|
update ai_model_config SET sort = 8 where id = 'ASR_DoubaoASR';
|
||||||
|
update ai_model_config SET sort = 9 where id = 'ASR_AliyunASR';
|
||||||
|
update ai_model_config SET sort = 10 where id = 'ASR_SherpaASR';
|
||||||
|
update ai_model_config SET sort = 11 where id = 'ASR_OpenaiASR';
|
||||||
|
update ai_model_config SET sort = 12 where id = 'ASR_GroqASR';
|
||||||
|
update ai_model_config SET sort = 13 where id = 'ASR_VoskASR';
|
||||||
|
update ai_model_config SET sort = 14 where id = 'ASR_Qwen3Flash';
|
||||||
|
|
||||||
|
UPDATE ai_model_config SET config_json='{\"type\": \"openai\", \"base_url\": \"https://ark.cn-beijing.volces.com/api/v3\", \"model_name\": \"doubao-1-5-pro-32k-250115\", \"api_key\": \"你的api_key\"}' where id = 'LLM_DoubaoLLM' AND config_json LIKE '%你的api_key"%';
|
||||||
|
|
@ -389,9 +389,37 @@ databaseChangeLog:
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
path: classpath:db/changelog/202509220958.sql
|
path: classpath:db/changelog/202509220958.sql
|
||||||
- changeSet:
|
- changeSet:
|
||||||
id: 202510071521
|
id: 202510071522
|
||||||
author: hrz
|
author: hrz
|
||||||
changes:
|
changes:
|
||||||
- sqlFile:
|
- sqlFile:
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
path: classpath:db/changelog/202510071521.sql
|
path: classpath:db/changelog/202510071522.sql
|
||||||
|
- changeSet:
|
||||||
|
id: 202510191042
|
||||||
|
author: hrz
|
||||||
|
changes:
|
||||||
|
- sqlFile:
|
||||||
|
encoding: utf8
|
||||||
|
path: classpath:db/changelog/202510191042.sql
|
||||||
|
- changeSet:
|
||||||
|
id: 202510250956
|
||||||
|
author: rainv123
|
||||||
|
changes:
|
||||||
|
- sqlFile:
|
||||||
|
encoding: utf8
|
||||||
|
path: classpath:db/changelog/202510250956.sql
|
||||||
|
- changeSet:
|
||||||
|
id: 202510251150
|
||||||
|
author: rainv123
|
||||||
|
changes:
|
||||||
|
- sqlFile:
|
||||||
|
encoding: utf8
|
||||||
|
path: classpath:db/changelog/202510251150.sql
|
||||||
|
- changeSet:
|
||||||
|
id: 202511131023
|
||||||
|
author: hrz
|
||||||
|
changes:
|
||||||
|
- sqlFile:
|
||||||
|
encoding: utf8
|
||||||
|
path: classpath:db/changelog/202511131023.sql
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,9 @@
|
||||||
10124=\u60A8\u7684mqtt\u5BC6\u94A5\u957F\u5EA6\u4E0D\u5B89\u5168\uFF0Cmqtt\u5BC6\u94A5\u5FC5\u987B\u540C\u65F6\u5305\u542B\u5927\u5C0F\u5199\u5B57\u6BCD
|
10124=\u60A8\u7684mqtt\u5BC6\u94A5\u957F\u5EA6\u4E0D\u5B89\u5168\uFF0Cmqtt\u5BC6\u94A5\u5FC5\u987B\u540C\u65F6\u5305\u542B\u5927\u5C0F\u5199\u5B57\u6BCD
|
||||||
10125=\u60A8\u7684mqtt\u5BC6\u94A5\u5305\u542B\u5F31\u5BC6\u7801
|
10125=\u60A8\u7684mqtt\u5BC6\u94A5\u5305\u542B\u5F31\u5BC6\u7801
|
||||||
10128=\u5B57\u5178\u6807\u7B7E\u91CD\u590D
|
10128=\u5B57\u5178\u6807\u7B7E\u91CD\u590D
|
||||||
10129=modelType\u548CprovideCode\u4E0D\u80FD\u4E3A\u7A7A
|
10129=SM2\u5BC6\u94A5\u672A\u914D\u7F6E
|
||||||
|
10130=SM2\u89E3\u5BC6\u5931\u8D25
|
||||||
|
10131=modelType\u548CprovideCode\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
10132=\u6CA1\u6709\u6743\u9650\u67E5\u770B\u8BE5\u667A\u80FD\u4F53\u7684\u804A\u5929\u8BB0\u5F55
|
10132=\u6CA1\u6709\u6743\u9650\u67E5\u770B\u8BE5\u667A\u80FD\u4F53\u7684\u804A\u5929\u8BB0\u5F55
|
||||||
10133=\u4F1A\u8BDDID\u4E0D\u80FD\u4E3A\u7A7A
|
10133=\u4F1A\u8BDDID\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
10134=\u667A\u80FD\u4F53ID\u4E0D\u80FD\u4E3A\u7A7A
|
10134=\u667A\u80FD\u4F53ID\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
|
|
@ -155,3 +157,23 @@
|
||||||
10148=\u5F52\u5C5E\u8D26\u53F7\u4E0D\u80FD\u4E3A\u7A7A
|
10148=\u5F52\u5C5E\u8D26\u53F7\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
10149=\u5220\u9664\u7684\u97F3\u8272\u8D44\u6E90ID\u4E0D\u80FD\u4E3A\u7A7A
|
10149=\u5220\u9664\u7684\u97F3\u8272\u8D44\u6E90ID\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
10150=\u60A8\u6CA1\u6709\u6743\u9650\u64CD\u4F5C\u8BE5\u8BB0\u5F55
|
10150=\u60A8\u6CA1\u6709\u6743\u9650\u64CD\u4F5C\u8BE5\u8BB0\u5F55
|
||||||
|
10151=\u8BF7\u5148\u4E0A\u4F20\u97F3\u9891\u6587\u4EF6
|
||||||
|
10152=\u6A21\u578B\u914D\u7F6E\u672A\u627E\u5230
|
||||||
|
10153=\u6A21\u578B\u7C7B\u578B\u672A\u627E\u5230
|
||||||
|
10154=\u8BAD\u7EC3\u5931\u8D25
|
||||||
|
10155=\u706B\u5C71\u5F15\u64CE\u7F3A\u5C11\u914D\u7F6E
|
||||||
|
10156=\u54CD\u5E94\u683C\u5F0F\u9519\u8BEF\uFF0C\u7F3A\u5C11BaseResp\u5B57\u6BB5
|
||||||
|
10157=\u8BF7\u6C42\u5931\u8D25
|
||||||
|
10158=\u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801{0}
|
||||||
|
10159=\u97F3\u8272ID\u5DF2\u5B58\u5728
|
||||||
|
10160=\u706B\u5C71\u5F15\u64CE\u97F3\u8272ID\u683C\u5F0F\u9519\u8BEF\uFF0C\u5FC5\u987B\u4EE5S_\u5F00\u5934
|
||||||
|
10161=Mac\u5730\u5740\u5DF2\u5B58\u5728
|
||||||
|
10162=\u6A21\u578B\u4F9B\u5E94\u5668\u4E0D\u5B58\u5728
|
||||||
|
10163=\u77E5\u8BC6\u5E93\u8BB0\u5F55\u4E0D\u5B58\u5728
|
||||||
|
10164=RAG\u914D\u7F6E\u672A\u627E\u5230
|
||||||
|
10165=RAG\u914D\u7F6E\u7C7B\u578B\u9519\u8BEF
|
||||||
|
10166=\u9ED8\u8BA4RAG\u914D\u7F6E\u672A\u627E\u5230
|
||||||
|
10167=\u0052\u0041\u0047\u8c03\u7528\u5931\u8d25\uFF0C{0}
|
||||||
|
10168=\u4E0A\u4F20\u6587\u4EF6\u5931\u8D25
|
||||||
|
10169=\u60A8\u6CA1\u6709\u6743\u9650\u64CD\u4F5C\u8BE5\u8BB0\u5F55
|
||||||
|
10170=\u77E5\u8BC6\u5E93\u540D\u79F0\u91CD\u590D
|
||||||
|
|
@ -157,3 +157,27 @@
|
||||||
10148=Owner account cannot be empty
|
10148=Owner account cannot be empty
|
||||||
10149=Voice resource ID to delete cannot be empty
|
10149=Voice resource ID to delete cannot be empty
|
||||||
10150=You do not have permission to operate this record
|
10150=You do not have permission to operate this record
|
||||||
|
10151=Please upload audio file first
|
||||||
|
10152=Model configuration not found
|
||||||
|
10153=Model type not found
|
||||||
|
10154=Training failed: {0}
|
||||||
|
10155=Huoshan Engine configuration missing
|
||||||
|
10156=Response format error, missing BaseResp field
|
||||||
|
10157=Request failed
|
||||||
|
10158=Clone Voice:
|
||||||
|
10159=Voice ID already exists
|
||||||
|
10160=Huoshan Engine voice ID format error, must start with S_
|
||||||
|
10161=Mac address already exists
|
||||||
|
10162=Model provider does not exist
|
||||||
|
10163=Knowledge base record does not exist
|
||||||
|
10164=RAG configuration not found
|
||||||
|
10165=RAG configuration type error
|
||||||
|
10166=Default RAG configuration not found
|
||||||
|
10167=RAG API call failed: {0}
|
||||||
|
10168=Upload file failed
|
||||||
|
10169=No permission to operate this knowledge base
|
||||||
|
10170=Knowledge base name already exists
|
||||||
|
10171=RAG configuration base_url cannot be empty
|
||||||
|
10172=RAG configuration api_key cannot be empty
|
||||||
|
10173=RAG configuration api_key cannot contain placeholder, please replace with actual API key
|
||||||
|
10174=RAG configuration base_url format error, must start with http or https
|
||||||
|
|
|
||||||
|
|
@ -157,3 +157,27 @@
|
||||||
10148=\u5F52\u5C5E\u8D26\u53F7\u4E0D\u80FD\u4E3A\u7A7A
|
10148=\u5F52\u5C5E\u8D26\u53F7\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
10149=\u5220\u9664\u7684\u97F3\u8272\u8D44\u6E90ID\u4E0D\u80FD\u4E3A\u7A7A
|
10149=\u5220\u9664\u7684\u97F3\u8272\u8D44\u6E90ID\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
10150=\u60A8\u6CA1\u6709\u6743\u9650\u64CD\u4F5C\u8BE5\u8BB0\u5F55
|
10150=\u60A8\u6CA1\u6709\u6743\u9650\u64CD\u4F5C\u8BE5\u8BB0\u5F55
|
||||||
|
10151=\u8BF7\u5148\u4E0A\u4F20\u97F3\u9891\u6587\u4EF6
|
||||||
|
10152=\u6A21\u578B\u914D\u7F6E\u672A\u627E\u5230
|
||||||
|
10153=\u6A21\u578B\u7C7B\u578B\u672A\u627E\u5230
|
||||||
|
10154=\u8BAD\u7EC3\u5931\u8D25
|
||||||
|
10155=\u706B\u5C71\u5F15\u64CE\u7F3A\u5C11\u914D\u7F6E
|
||||||
|
10156=\u54CD\u5E94\u683C\u5F0F\u9519\u8BEF\uFF0C\u7F3A\u5C11BaseResp\u5B57\u6BB5
|
||||||
|
10157=\u8BF7\u6C42\u5931\u8D25
|
||||||
|
10158=\u514B\u9686\u8272\u97F3:
|
||||||
|
10159=\u97F3\u8272ID\u5DF2\u5B58\u5728
|
||||||
|
10160=\u706B\u5C71\u5F15\u64CE\u97F3\u8272ID\u683C\u5F0F\u9519\u8BEF\uFF0C\u5FC5\u987B\u4EE5S_\u5F00\u5934
|
||||||
|
10161=Mac\u5730\u5740\u5DF2\u5B58\u5728
|
||||||
|
10162=\u6A21\u578B\u4F9B\u5E94\u5668\u4E0D\u5B58\u5728
|
||||||
|
10163=\u77E5\u8BC6\u5E93\u8BB0\u5F55\u4E0D\u5B58\u5728
|
||||||
|
10164=RAG\u914D\u7F6E\u672A\u627E\u5230
|
||||||
|
10165=RAG\u914D\u7F6E\u7C7B\u578B\u9519\u8BEF
|
||||||
|
10166=\u9ED8\u8BA4RAG\u914D\u7F6E\u672A\u627E\u5230
|
||||||
|
10167=\u0052\u0041\u0047\u8c03\u7528\u5931\u8d25\uFF0C{0}
|
||||||
|
10168=\u4E0A\u4F20\u6587\u4EF6\u5931\u8D25
|
||||||
|
10169=\u60A8\u6CA1\u6709\u6743\u9650\u64CD\u4F5C\u8BE5\u8BB0\u5F55
|
||||||
|
10170=\u77E5\u8BC6\u5E93\u540D\u79F0\u91CD\u590D
|
||||||
|
10171=\u0052\u0041\u0047\u914D\u7F6E\u4F53\u7684base_url\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
|
10172=\u0052\u0041\u0047\u914D\u7F6E\u4F53\u7684api_key\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
|
10173=\u0052\u0041\u0047\u914D\u7F6E\u4F53\u7684api_key\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u66F4\u6362\u4E3A\u5728\u53D6\u7684API\u53C2\u6570
|
||||||
|
10174=\u0052\u0041\u0047\u914D\u7F6E\u4F53\u7684base_url\u683C\u5F0F\u9519\u8BEF\uFF0C\u5FC5\u987B\u4EE5http\u6216https\u5F00\u5934
|
||||||
|
|
@ -157,3 +157,27 @@
|
||||||
10148=\u6B78\u5C6C\u5E33\u865F\u4E0D\u80FD\u70BA\u7A7A
|
10148=\u6B78\u5C6C\u5E33\u865F\u4E0D\u80FD\u70BA\u7A7A
|
||||||
10149=\u522A\u9664\u7684\u97F3\u8272\u8CC7\u6E90ID\u4E0D\u80FD\u70BA\u7A7A
|
10149=\u522A\u9664\u7684\u97F3\u8272\u8CC7\u6E90ID\u4E0D\u80FD\u70BA\u7A7A
|
||||||
10150=\u60A8\u6C92\u6709\u6B0A\u9650\u64CD\u4F5C\u8A72\u8A18\u9304
|
10150=\u60A8\u6C92\u6709\u6B0A\u9650\u64CD\u4F5C\u8A72\u8A18\u9304
|
||||||
|
10151=\u8ACB\u5148\u4E0A\u50B3\u97F3\u983B\u6587\u4EF6
|
||||||
|
10152=\u6A21\u578B\u914D\u7F6E\u672A\u627E\u5230
|
||||||
|
10153=\u6A21\u578B\u985E\u578B\u672A\u627E\u5230
|
||||||
|
10154=\u6A21\u578B\u8AB2\u7DF4\u5931\u6557: {0}
|
||||||
|
10155=\u706B\u5C71\u5F15\u64CE\u7F3A\u5C11appid\u6216access_token
|
||||||
|
10156=\u97FF\u61C9\u683C\u5F0F\u932F\u8AA4\uFF0C\u7F3A\u5C11BaseResp\u5B57\u6BB5
|
||||||
|
10157=\u8ACB\u6C42\u5931\u6557
|
||||||
|
10158=\u514B\u9686\u8A9E\u97F3:
|
||||||
|
10159=\u97F3\u8272ID\u5DF2\u5B58\u5728
|
||||||
|
10160=\u706B\u5C71\u5F15\u64CE\u97F3\u8272ID\u683C\u5F0F\u932F\u8AA4\uFF0C\u5FC5\u9808\u4EE5S_\u958B\u982D
|
||||||
|
10161=Mac\u5730\u5740\u5DF2\u5B58\u5728
|
||||||
|
10162=\u6A21\u578B\u63D0\u4F9B\u5546\u4E0D\u5B58\u5728
|
||||||
|
10163=\u77E5\u8B58\u5EAB\u8A18\u9304\u4E0D\u5B58\u5728
|
||||||
|
10164=RAG\u914D\u7F6E\u672A\u627E\u5230
|
||||||
|
10165=RAG\u914D\u7F6E\u985E\u578B\u932F\u8AA4
|
||||||
|
10166=\u9810\u8A2DRAG\u914D\u7F6E\u672A\u627E\u5230
|
||||||
|
10167=\u0052\u0041\u0047\u8abf\u7528\u5931\u6557\uFF0C{0}
|
||||||
|
10168=\u4E0A\u50B3\u6587\u4EF6\u5931\u6557
|
||||||
|
10169=\u60A8\u6C92\u6709\u6B0A\u9650\u64CD\u4F5C\u8A72\u8A18\u9304
|
||||||
|
10170=\u77E5\u8B58\u5EAB\u540D\u7A31\u91CD\u8907
|
||||||
|
10171=\u0052\u0041\u0047\u914D\u7F6E\u4F53\u7684base_url\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
|
10172=\u0052\u0041\u0047\u914D\u7F6E\u4F53\u7684api_key\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
|
10173=\u0052\u0041\u0047\u914D\u7F6E\u4F53\u7684api_key\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u66F4\u6362\u4E3A\u5728\u53D6\u7684API\u53C2\u6570
|
||||||
|
10174=\u0052\u0041\u0047\u914D\u7F6E\u4F53\u7684base_url\u683C\u5F0F\u9519\u8BEF\uFF0C\u5FC5\u987B\u4EE5http\u6216https\u5F00\u5934
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="xiaozhi.modules.knowledge.dao.KnowledgeBaseDao">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="xiaozhi.modules.knowledge.entity.KnowledgeBaseEntity">
|
||||||
|
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="datasetId" column="dataset_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="ragModelId" column="rag_model_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="description" column="description" jdbcType="VARCHAR"/>
|
||||||
|
<result property="status" column="status" jdbcType="TINYINT"/>
|
||||||
|
<result property="creator" column="creator" jdbcType="BIGINT"/>
|
||||||
|
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="updater" column="updater" jdbcType="BIGINT"/>
|
||||||
|
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 根据知识库ID删除相关的插件映射记录 -->
|
||||||
|
<delete id="deletePluginMappingByKnowledgeBaseId">
|
||||||
|
DELETE FROM ai_agent_plugin_mapping
|
||||||
|
WHERE plugin_id = #{knowledgeBaseId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="xiaozhi.modules.voiceclone.dao.VoiceCloneDao">
|
||||||
|
<select id="getTrainSuccess" resultType="xiaozhi.modules.model.dto.VoiceDTO">
|
||||||
|
select id, name
|
||||||
|
from ai_voice_clone
|
||||||
|
where model_id = #{modelId} and user_id = #{userId} and train_status = 2
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
@ -123,3 +123,21 @@ export function register(data: RegisterData) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 忘记密码数据类型
|
||||||
|
export interface ForgotPasswordData {
|
||||||
|
phone: string
|
||||||
|
code: string
|
||||||
|
password: string
|
||||||
|
captchaId: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 忘记密码(找回密码)
|
||||||
|
export function retrievePassword(data: ForgotPasswordData) {
|
||||||
|
return http.Put('/user/retrieve-password', data, {
|
||||||
|
meta: {
|
||||||
|
ignoreAuth: true,
|
||||||
|
toast: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@ export default {
|
||||||
'login.enterCaptcha': 'Please enter verification code',
|
'login.enterCaptcha': 'Please enter verification code',
|
||||||
'login.loginButton': 'Login',
|
'login.loginButton': 'Login',
|
||||||
'login.loggingIn': 'Logging in...',
|
'login.loggingIn': 'Logging in...',
|
||||||
'login.noAccount': 'did not have an account?',
|
'login.noAccount': 'Sign Up',
|
||||||
'login.registerNow': 'Register Now',
|
|
||||||
'login.enterPhone': 'Please enter phone number',
|
'login.enterPhone': 'Please enter phone number',
|
||||||
'login.selectCountry': 'Select Country/Region',
|
'login.selectCountry': 'Select Country/Region',
|
||||||
'login.confirm': 'Confirm',
|
'login.confirm': 'Confirm',
|
||||||
|
|
@ -30,6 +29,7 @@ export default {
|
||||||
'login.requiredCaptcha': 'Verification code cannot be empty',
|
'login.requiredCaptcha': 'Verification code cannot be empty',
|
||||||
'login.requiredMobile': 'Please enter a valid phone number',
|
'login.requiredMobile': 'Please enter a valid phone number',
|
||||||
'login.captchaError': 'Graphic verification code error',
|
'login.captchaError': 'Graphic verification code error',
|
||||||
|
'login.forgotPassword': 'Forgot Password',
|
||||||
|
|
||||||
// Register page
|
// Register page
|
||||||
'register.pageTitle': 'Register',
|
'register.pageTitle': 'Register',
|
||||||
|
|
@ -189,6 +189,27 @@ export default {
|
||||||
'common.unknownError': 'Unknown error',
|
'common.unknownError': 'Unknown error',
|
||||||
'common.networkError': 'Network error',
|
'common.networkError': 'Network error',
|
||||||
|
|
||||||
|
// Retrieve Password page
|
||||||
|
'retrievePassword.title': 'Reset Password',
|
||||||
|
'retrievePassword.subtitle': 'Recover your account password via mobile number',
|
||||||
|
'retrievePassword.mobileRequired': 'Please enter mobile number',
|
||||||
|
'retrievePassword.inputCorrectMobile': 'Please enter a valid mobile number',
|
||||||
|
'retrievePassword.captchaRequired': 'Please enter graphic verification code',
|
||||||
|
'retrievePassword.mobileCaptchaRequired': 'Please enter SMS verification code',
|
||||||
|
'retrievePassword.newPasswordRequired': 'Please enter new password',
|
||||||
|
'retrievePassword.confirmNewPasswordRequired': 'Please confirm new password',
|
||||||
|
'retrievePassword.passwordsNotMatch': 'Passwords do not match',
|
||||||
|
'retrievePassword.mobilePlaceholder': 'Please enter mobile number',
|
||||||
|
'retrievePassword.captchaPlaceholder': 'Please enter graphic verification code',
|
||||||
|
'retrievePassword.mobileCaptchaPlaceholder': 'Please enter SMS verification code',
|
||||||
|
'retrievePassword.newPasswordPlaceholder': 'Please enter new password',
|
||||||
|
'retrievePassword.confirmNewPasswordPlaceholder': 'Please confirm new password',
|
||||||
|
'retrievePassword.getMobileCaptcha': 'Get Code',
|
||||||
|
'retrievePassword.captchaSendSuccess': 'Verification code sent successfully',
|
||||||
|
'retrievePassword.passwordUpdateSuccess': 'Password reset successfully',
|
||||||
|
'retrievePassword.resetButton': 'Reset Password',
|
||||||
|
'retrievePassword.goToLogin': 'Back to Login',
|
||||||
|
|
||||||
// SM2 encryption related error messages
|
// SM2 encryption related error messages
|
||||||
'sm2.publicKeyNotConfigured': 'SM2 public key not configured, please contact administrator',
|
'sm2.publicKeyNotConfigured': 'SM2 public key not configured, please contact administrator',
|
||||||
'sm2.encryptionFailed': 'Password encryption failed',
|
'sm2.encryptionFailed': 'Password encryption failed',
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@ export default {
|
||||||
'login.enterCaptcha': '请输入验证码',
|
'login.enterCaptcha': '请输入验证码',
|
||||||
'login.loginButton': '登录',
|
'login.loginButton': '登录',
|
||||||
'login.loggingIn': '登录中...',
|
'login.loggingIn': '登录中...',
|
||||||
'login.noAccount': '还没有账户?',
|
'login.noAccount': '新用户注册',
|
||||||
'login.registerNow': '立即注册',
|
|
||||||
'login.enterPhone': '请输入手机号码',
|
'login.enterPhone': '请输入手机号码',
|
||||||
'login.selectCountry': '选择国家/地区',
|
'login.selectCountry': '选择国家/地区',
|
||||||
'login.confirm': '确认',
|
'login.confirm': '确认',
|
||||||
|
|
@ -30,6 +29,7 @@ export default {
|
||||||
'login.requiredCaptcha': '验证码不能为空',
|
'login.requiredCaptcha': '验证码不能为空',
|
||||||
'login.requiredMobile': '请输入正确的手机号码',
|
'login.requiredMobile': '请输入正确的手机号码',
|
||||||
'login.captchaError': '图形验证码错误',
|
'login.captchaError': '图形验证码错误',
|
||||||
|
'login.forgotPassword': '忘记密码',
|
||||||
|
|
||||||
// 注册页面
|
// 注册页面
|
||||||
'register.pageTitle': '注册',
|
'register.pageTitle': '注册',
|
||||||
|
|
@ -265,6 +265,27 @@ export default {
|
||||||
'settings.selectLanguage': '选择语言',
|
'settings.selectLanguage': '选择语言',
|
||||||
'settings.languageChanged': '语言切换成功',
|
'settings.languageChanged': '语言切换成功',
|
||||||
|
|
||||||
|
// 重置密码页面
|
||||||
|
'retrievePassword.title': '重置密码',
|
||||||
|
'retrievePassword.subtitle': '通过手机号找回您的账户密码',
|
||||||
|
'retrievePassword.mobileRequired': '请输入手机号码',
|
||||||
|
'retrievePassword.inputCorrectMobile': '请输入正确的手机号码',
|
||||||
|
'retrievePassword.captchaRequired': '请输入图形验证码',
|
||||||
|
'retrievePassword.mobileCaptchaRequired': '请输入短信验证码',
|
||||||
|
'retrievePassword.newPasswordRequired': '请输入新密码',
|
||||||
|
'retrievePassword.confirmNewPasswordRequired': '请确认新密码',
|
||||||
|
'retrievePassword.passwordsNotMatch': '两次输入的密码不一致',
|
||||||
|
'retrievePassword.mobilePlaceholder': '请输入手机号码',
|
||||||
|
'retrievePassword.captchaPlaceholder': '请输入图形验证码',
|
||||||
|
'retrievePassword.mobileCaptchaPlaceholder': '请输入短信验证码',
|
||||||
|
'retrievePassword.newPasswordPlaceholder': '请输入新密码',
|
||||||
|
'retrievePassword.confirmNewPasswordPlaceholder': '请确认新密码',
|
||||||
|
'retrievePassword.getMobileCaptcha': '获取验证码',
|
||||||
|
'retrievePassword.captchaSendSuccess': '验证码发送成功',
|
||||||
|
'retrievePassword.passwordUpdateSuccess': '密码重置成功',
|
||||||
|
'retrievePassword.resetButton': '重置密码',
|
||||||
|
'retrievePassword.goToLogin': '返回登录',
|
||||||
|
|
||||||
// 消息提示
|
// 消息提示
|
||||||
'message.loginSuccess': '登录成功!',
|
'message.loginSuccess': '登录成功!',
|
||||||
'message.loginFail': '登录失败',
|
'message.loginFail': '登录失败',
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@ export default {
|
||||||
'login.enterCaptcha': '請輸入驗證碼',
|
'login.enterCaptcha': '請輸入驗證碼',
|
||||||
'login.loginButton': '登錄',
|
'login.loginButton': '登錄',
|
||||||
'login.loggingIn': '登錄中...',
|
'login.loggingIn': '登錄中...',
|
||||||
'login.noAccount': '還沒有賬戶?',
|
'login.noAccount': '新用戶註冊',
|
||||||
'login.registerNow': '立即註冊',
|
|
||||||
'login.enterPhone': '請輸入手機號碼',
|
'login.enterPhone': '請輸入手機號碼',
|
||||||
'login.selectCountry': '選擇國家/地區',
|
'login.selectCountry': '選擇國家/地區',
|
||||||
'login.confirm': '確認',
|
'login.confirm': '確認',
|
||||||
|
|
@ -30,6 +29,32 @@ export default {
|
||||||
'login.requiredCaptcha': '驗證碼不能為空',
|
'login.requiredCaptcha': '驗證碼不能為空',
|
||||||
'login.requiredMobile': '請輸入正確的手機號碼',
|
'login.requiredMobile': '請輸入正確的手機號碼',
|
||||||
'login.captchaError': '圖形驗證碼錯誤',
|
'login.captchaError': '圖形驗證碼錯誤',
|
||||||
|
'login.forgotPassword': '忘記密碼',
|
||||||
|
|
||||||
|
// 忘記密碼頁面
|
||||||
|
'retrievePassword.title': '重置密碼',
|
||||||
|
'retrievePassword.subtitle': '請輸入您的手機號碼以重置密碼',
|
||||||
|
'retrievePassword.mobileRequired': '請輸入手機號碼',
|
||||||
|
'retrievePassword.inputCorrectMobile': '請輸入正確的手機號碼',
|
||||||
|
'retrievePassword.captchaRequired': '請輸入圖形驗證碼',
|
||||||
|
'retrievePassword.mobileCaptchaRequired': '請輸入手機驗證碼',
|
||||||
|
'retrievePassword.newPasswordRequired': '請輸入新密碼',
|
||||||
|
'retrievePassword.confirmNewPasswordRequired': '請確認新密碼',
|
||||||
|
'retrievePassword.passwordsNotMatch': '兩次輸入的密碼不一致',
|
||||||
|
'retrievePassword.mobilePlaceholder': '請輸入手機號碼',
|
||||||
|
'retrievePassword.captchaPlaceholder': '請輸入圖形驗證碼',
|
||||||
|
'retrievePassword.mobileCaptchaPlaceholder': '請輸入手機驗證碼',
|
||||||
|
'retrievePassword.newPasswordPlaceholder': '請輸入新密碼',
|
||||||
|
'retrievePassword.confirmNewPasswordPlaceholder': '請確認新密碼',
|
||||||
|
'retrievePassword.confirmPasswordPlaceholder': '請確認新密碼',
|
||||||
|
'retrievePassword.captchaSendSuccess': '驗證碼發送成功',
|
||||||
|
'retrievePassword.passwordUpdateSuccess': '密碼更新成功',
|
||||||
|
'retrievePassword.getCaptcha': '獲取驗證碼',
|
||||||
|
'retrievePassword.getMobileCaptcha': '獲取驗證碼',
|
||||||
|
'retrievePassword.resend': '重新發送',
|
||||||
|
'retrievePassword.resetPasswordButton': '重置密碼',
|
||||||
|
'retrievePassword.resetButton': '重置密碼',
|
||||||
|
'retrievePassword.goToLogin': '返回登錄',
|
||||||
|
|
||||||
// 註冊頁面
|
// 註冊頁面
|
||||||
'register.pageTitle': '註冊',
|
'register.pageTitle': '註冊',
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,15 @@
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/forgot-password/index",
|
||||||
|
"type": "page",
|
||||||
|
"layout": "default",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText": "ForgotPassword"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/index",
|
"path": "pages/login/index",
|
||||||
"type": "page",
|
"type": "page",
|
||||||
|
|
|
||||||
848
main/manager-mobile/src/pages/forgot-password/index.vue
Normal file
|
|
@ -0,0 +1,848 @@
|
||||||
|
<route lang="jsonc" type="page">
|
||||||
|
{
|
||||||
|
"layout": "default",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText": "ForgotPassword"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, onMounted, ref } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import { useConfigStore } from "@/store";
|
||||||
|
import { getEnvBaseUrl, sm2Encrypt } from "@/utils";
|
||||||
|
import { toast } from "@/utils/toast";
|
||||||
|
// 导入国际化相关功能
|
||||||
|
import { t, initI18n } from "@/i18n";
|
||||||
|
// 导入API接口
|
||||||
|
import { retrievePassword, sendSmsCode } from "@/api/auth";
|
||||||
|
|
||||||
|
// 获取屏幕边界到安全区域距离
|
||||||
|
let safeAreaInsets;
|
||||||
|
let systemInfo;
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
// 微信小程序使用新的API
|
||||||
|
systemInfo = uni.getWindowInfo();
|
||||||
|
safeAreaInsets = systemInfo.safeArea
|
||||||
|
? {
|
||||||
|
top: systemInfo.safeArea.top,
|
||||||
|
right: systemInfo.windowWidth - systemInfo.safeArea.right,
|
||||||
|
bottom: systemInfo.windowHeight - systemInfo.safeArea.bottom,
|
||||||
|
left: systemInfo.safeArea.left,
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef MP-WEIXIN
|
||||||
|
// 其他平台继续使用uni API
|
||||||
|
systemInfo = uni.getSystemInfoSync();
|
||||||
|
safeAreaInsets = systemInfo.safeAreaInsets;
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
interface ForgotPasswordData {
|
||||||
|
mobile: string;
|
||||||
|
captcha: string;
|
||||||
|
captchaId: string;
|
||||||
|
mobileCaptcha: string;
|
||||||
|
newPassword: string;
|
||||||
|
confirmPassword: string;
|
||||||
|
areaCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const formData = ref<ForgotPasswordData>({
|
||||||
|
mobile: "",
|
||||||
|
captcha: "",
|
||||||
|
captchaId: "",
|
||||||
|
mobileCaptcha: "",
|
||||||
|
newPassword: "",
|
||||||
|
confirmPassword: "",
|
||||||
|
areaCode: "+86",
|
||||||
|
});
|
||||||
|
|
||||||
|
// 验证码图片
|
||||||
|
const captchaImage = ref("");
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
// 获取配置store
|
||||||
|
const configStore = useConfigStore();
|
||||||
|
|
||||||
|
// State for area code action sheet
|
||||||
|
const showAreaCodeSheet = ref(false);
|
||||||
|
const selectedAreaCode = ref("+86");
|
||||||
|
const areaCodeList = computed(() =>
|
||||||
|
(configStore.config.mobileAreaList || []).map((item) => {
|
||||||
|
return {
|
||||||
|
value: item.key,
|
||||||
|
label: `${item.name} (${item.key})`,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const canSendMobileCaptcha = computed(() => {
|
||||||
|
const mobile = formData.value.mobile;
|
||||||
|
const phoneRegex = /^1[3-9]\d{9}$/;
|
||||||
|
return phoneRegex.test(mobile) && smsCountdown.value === 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// SM2公钥
|
||||||
|
const sm2PublicKey = computed(() => {
|
||||||
|
return configStore.config.sm2PublicKey;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 短信验证码倒计时
|
||||||
|
const smsCountdown = ref(0);
|
||||||
|
const smsLoading = ref(false);
|
||||||
|
|
||||||
|
// 打开区号选择弹窗
|
||||||
|
function openAreaCodeSheet() {
|
||||||
|
showAreaCodeSheet.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 选择区号
|
||||||
|
function selectAreaCode(item: { value: string; label: string }) {
|
||||||
|
selectedAreaCode.value = item.value;
|
||||||
|
formData.value.areaCode = item.value;
|
||||||
|
showAreaCodeSheet.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭区号选择弹窗
|
||||||
|
function closeAreaCodeSheet() {
|
||||||
|
showAreaCodeSheet.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成UUID
|
||||||
|
function generateUUID() {
|
||||||
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
||||||
|
const r = (Math.random() * 16) | 0;
|
||||||
|
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
||||||
|
return v.toString(16);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取图形验证码
|
||||||
|
async function refreshCaptcha() {
|
||||||
|
const uuid = generateUUID();
|
||||||
|
formData.value.captchaId = uuid;
|
||||||
|
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送短信验证码
|
||||||
|
async function handleSendSmsCode() {
|
||||||
|
// 手机号格式验证
|
||||||
|
const phoneRegex = /^1[3-9]\d{9}$/;
|
||||||
|
if (!phoneRegex.test(formData.value.mobile)) {
|
||||||
|
toast.warning(t("retrievePassword.inputCorrectMobile"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.value.captcha) {
|
||||||
|
toast.warning(t("retrievePassword.captchaRequired"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
smsLoading.value = true;
|
||||||
|
// 将手机号转换为国际格式
|
||||||
|
const internationalPhone = formData.value.areaCode + formData.value.mobile;
|
||||||
|
// 调用发送短信验证码API
|
||||||
|
await sendSmsCode({
|
||||||
|
phone: internationalPhone,
|
||||||
|
captcha: formData.value.captcha,
|
||||||
|
captchaId: formData.value.captchaId
|
||||||
|
})
|
||||||
|
|
||||||
|
toast.success(t("retrievePassword.captchaSendSuccess"));
|
||||||
|
|
||||||
|
// 开始倒计时
|
||||||
|
smsCountdown.value = 60;
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
smsCountdown.value--;
|
||||||
|
if (smsCountdown.value <= 0) {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
} catch (error: any) {
|
||||||
|
// 处理验证码错误
|
||||||
|
if (error.message.includes("请求错误[10067]")) {
|
||||||
|
toast.warning(t("login.captchaError"));
|
||||||
|
}
|
||||||
|
// 发送失败重新获取图形验证码
|
||||||
|
refreshCaptcha();
|
||||||
|
} finally {
|
||||||
|
smsLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置密码
|
||||||
|
async function handleResetPassword() {
|
||||||
|
// 表单验证
|
||||||
|
if (!formData.value.mobile) {
|
||||||
|
toast.warning(t("retrievePassword.mobileRequired"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手机号格式验证
|
||||||
|
const phoneRegex = /^1[3-9]\d{9}$/;
|
||||||
|
if (!phoneRegex.test(formData.value.mobile)) {
|
||||||
|
toast.warning(t("retrievePassword.inputCorrectMobile"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将手机号转换为国际格式
|
||||||
|
const internationalPhone = formData.value.areaCode + formData.value.mobile;
|
||||||
|
|
||||||
|
if (!formData.value.captcha) {
|
||||||
|
toast.warning(t("retrievePassword.captchaRequired"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.value.mobileCaptcha) {
|
||||||
|
toast.warning(t("retrievePassword.mobileCaptchaRequired"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.value.newPassword) {
|
||||||
|
toast.warning(t("retrievePassword.newPasswordRequired"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.value.confirmPassword) {
|
||||||
|
toast.warning(t("retrievePassword.confirmNewPasswordRequired"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formData.value.newPassword !== formData.value.confirmPassword) {
|
||||||
|
toast.warning(t("retrievePassword.passwordsNotMatch"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
|
||||||
|
// 检查SM2公钥是否配置
|
||||||
|
if (!sm2PublicKey.value) {
|
||||||
|
toast.warning(t("sm2.publicKeyNotConfigured"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加密密码
|
||||||
|
let encryptedPassword;
|
||||||
|
try {
|
||||||
|
// 拼接图形验证码和新密码进行加密
|
||||||
|
const captchaAndPassword = formData.value.captcha + formData.value.newPassword;
|
||||||
|
encryptedPassword = sm2Encrypt(sm2PublicKey.value, captchaAndPassword);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("密码加密失败:", error);
|
||||||
|
toast.warning(t("sm2.encryptionFailed"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用重置密码API
|
||||||
|
await retrievePassword({
|
||||||
|
phone: internationalPhone,
|
||||||
|
code: formData.value.mobileCaptcha,
|
||||||
|
password: encryptedPassword,
|
||||||
|
captchaId: formData.value.captchaId
|
||||||
|
})
|
||||||
|
|
||||||
|
toast.success(t("retrievePassword.passwordUpdateSuccess"));
|
||||||
|
|
||||||
|
// 跳转到登录页
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "/pages/login/index",
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
} catch (error: any) {
|
||||||
|
// 处理验证码错误
|
||||||
|
if (error.message.includes("请求错误[10067]")) {
|
||||||
|
toast.warning(t("login.captchaError"));
|
||||||
|
}
|
||||||
|
// 重置失败重新获取验证码
|
||||||
|
refreshCaptcha();
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回登录
|
||||||
|
function goBack() {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "/pages/login/index",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面加载时获取验证码
|
||||||
|
onLoad(() => {
|
||||||
|
refreshCaptcha();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 组件挂载时确保配置已加载
|
||||||
|
onMounted(async () => {
|
||||||
|
if (!configStore.config.name) {
|
||||||
|
try {
|
||||||
|
await configStore.fetchPublicConfig();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取配置失败:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 初始化国际化
|
||||||
|
initI18n();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view
|
||||||
|
class="app-container box-border h-screen w-full"
|
||||||
|
:style="{ paddingTop: `${safeAreaInsets?.top}px` }"
|
||||||
|
>
|
||||||
|
<view class="header">
|
||||||
|
<view class="back-button" @click="goBack">
|
||||||
|
<wd-icon name="arrow-left" custom-class="back-icon" />
|
||||||
|
</view>
|
||||||
|
<view class="logo-section">
|
||||||
|
<wd-img :width="80" :height="80" round src="/static/logo.png" class="logo" />
|
||||||
|
<text class="welcome-text">
|
||||||
|
{{ t("retrievePassword.title") }}
|
||||||
|
</text>
|
||||||
|
<text class="subtitle">
|
||||||
|
{{ t("retrievePassword.subtitle") }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="form-container">
|
||||||
|
<view class="form">
|
||||||
|
<!-- 手机号输入 -->
|
||||||
|
<view class="input-group">
|
||||||
|
<view class="input-wrapper mobile-wrapper">
|
||||||
|
<view class="area-code-selector" @click="openAreaCodeSheet">
|
||||||
|
<text class="area-code-text">
|
||||||
|
{{ selectedAreaCode }}
|
||||||
|
</text>
|
||||||
|
<wd-icon name="arrow-down" custom-class="area-code-arrow" />
|
||||||
|
</view>
|
||||||
|
<view class="mobile-input-wrapper">
|
||||||
|
<wd-input
|
||||||
|
v-model="formData.mobile"
|
||||||
|
custom-class="styled-input"
|
||||||
|
no-border
|
||||||
|
:placeholder="t('retrievePassword.mobilePlaceholder')"
|
||||||
|
type="number"
|
||||||
|
:maxlength="11"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 图形验证码 -->
|
||||||
|
<view class="input-group">
|
||||||
|
<view class="input-wrapper captcha-wrapper">
|
||||||
|
<wd-input
|
||||||
|
v-model="formData.captcha"
|
||||||
|
custom-class="styled-input"
|
||||||
|
no-border
|
||||||
|
:placeholder="t('retrievePassword.captchaPlaceholder')"
|
||||||
|
:maxlength="6"
|
||||||
|
/>
|
||||||
|
<view class="captcha-image" @click="refreshCaptcha">
|
||||||
|
<image :src="captchaImage" class="captcha-img" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 短信验证码 -->
|
||||||
|
<view class="input-group">
|
||||||
|
<view class="input-wrapper sms-wrapper">
|
||||||
|
<wd-input
|
||||||
|
v-model="formData.mobileCaptcha"
|
||||||
|
custom-class="styled-input"
|
||||||
|
no-border
|
||||||
|
:placeholder="t('retrievePassword.mobileCaptchaPlaceholder')"
|
||||||
|
:maxlength="6"
|
||||||
|
/>
|
||||||
|
<view class="sms-button" @click="handleSendSmsCode">
|
||||||
|
<text class="sms-text">
|
||||||
|
{{
|
||||||
|
smsCountdown > 0
|
||||||
|
? `${smsCountdown}s`
|
||||||
|
: t("retrievePassword.getMobileCaptcha")
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 新密码 -->
|
||||||
|
<view class="input-group">
|
||||||
|
<view class="input-wrapper">
|
||||||
|
<wd-input
|
||||||
|
v-model="formData.newPassword"
|
||||||
|
custom-class="styled-input"
|
||||||
|
no-border
|
||||||
|
:placeholder="t('retrievePassword.newPasswordPlaceholder')"
|
||||||
|
show-password
|
||||||
|
:maxlength="20"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 确认新密码 -->
|
||||||
|
<view class="input-group">
|
||||||
|
<view class="input-wrapper">
|
||||||
|
<wd-input
|
||||||
|
v-model="formData.confirmPassword"
|
||||||
|
custom-class="styled-input"
|
||||||
|
no-border
|
||||||
|
:placeholder="t('retrievePassword.confirmNewPasswordPlaceholder')"
|
||||||
|
show-password
|
||||||
|
:maxlength="20"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 重置密码按钮 -->
|
||||||
|
<view class="reset-btn" @click="handleResetPassword">
|
||||||
|
{{ loading ? t("common.loading") : t("retrievePassword.resetButton") }}
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 返回登录链接 -->
|
||||||
|
<view class="back-login-hint" @click="goBack">
|
||||||
|
<text class="hint-text">
|
||||||
|
{{ t("retrievePassword.goToLogin") }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 区号选择弹窗 -->
|
||||||
|
<wd-action-sheet
|
||||||
|
v-model="showAreaCodeSheet"
|
||||||
|
:title="t('login.selectCountry')"
|
||||||
|
:close-on-click-modal="true"
|
||||||
|
@close="closeAreaCodeSheet"
|
||||||
|
>
|
||||||
|
<view class="area-code-sheet">
|
||||||
|
<scroll-view scroll-y class="area-code-list">
|
||||||
|
<view
|
||||||
|
v-for="item in areaCodeList"
|
||||||
|
:key="item.value"
|
||||||
|
class="area-code-item"
|
||||||
|
:class="{ selected: selectedAreaCode === item.value }"
|
||||||
|
@click="selectAreaCode(item)"
|
||||||
|
>
|
||||||
|
<view class="area-info">
|
||||||
|
<text class="area-name">
|
||||||
|
{{ item.label }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<wd-icon
|
||||||
|
v-if="selectedAreaCode === item.value"
|
||||||
|
name="check"
|
||||||
|
custom-class="check-icon"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="sheet-footer">
|
||||||
|
<wd-button
|
||||||
|
type="primary"
|
||||||
|
custom-class="confirm-btn"
|
||||||
|
@click="closeAreaCodeSheet"
|
||||||
|
>
|
||||||
|
{{ t("login.confirm") }}
|
||||||
|
</wd-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</wd-action-sheet>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.app-container {
|
||||||
|
background: linear-gradient(145deg, #f5f8fd, #6baaff, #9ebbfc, #f5f8fd);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
min-height: 100vh;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: -50%;
|
||||||
|
left: -50%;
|
||||||
|
width: 200%;
|
||||||
|
height: 200%;
|
||||||
|
background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
|
||||||
|
animation: float 6s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes float {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
transform: translateY(0px) rotate(0deg);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: translateY(-20px) rotate(180deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
min-height: 280rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 15% 0 40rpx 0;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.back-button {
|
||||||
|
position: absolute;
|
||||||
|
left: 30rpx;
|
||||||
|
top: 50rpx;
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
backdrop-filter: blur(10rpx);
|
||||||
|
border: 1rpx solid rgba(255, 255, 255, 0.3);
|
||||||
|
|
||||||
|
.back-icon {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-section {
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-text {
|
||||||
|
display: block;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
display: block;
|
||||||
|
color: rgba(255, 255, 255, 0.8);
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container {
|
||||||
|
padding: 0 40rpx 40rpx 40rpx;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
|
||||||
|
.form {
|
||||||
|
width: 100%;
|
||||||
|
background: rgba(255, 255, 255, 0.95);
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 40rpx 30rpx 30rpx 30rpx;
|
||||||
|
backdrop-filter: blur(10rpx);
|
||||||
|
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.1);
|
||||||
|
border: 1rpx solid rgba(255, 255, 255, 0.2);
|
||||||
|
max-height: calc(100vh - 350rpx);
|
||||||
|
overflow-y: auto;
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
|
||||||
|
.input-wrapper {
|
||||||
|
position: relative;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 20rpx 16rpx;
|
||||||
|
border: 2rpx solid #e9ecef;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&:focus-within {
|
||||||
|
border-color: #667eea;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0 0 0 6rpx rgba(102, 126, 234, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.mobile-wrapper {
|
||||||
|
padding: 0;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
|
|
||||||
|
.area-code-selector {
|
||||||
|
flex: 0 0 160rpx;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 20rpx 16rpx;
|
||||||
|
border: 2rpx solid #e9ecef;
|
||||||
|
height: 45rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #667eea;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0 0 0 6rpx rgba(102, 126, 234, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.area-code-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.area-code-arrow) {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-input-wrapper {
|
||||||
|
flex: 1;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 20rpx 16rpx;
|
||||||
|
border: 2rpx solid #e9ecef;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:focus-within {
|
||||||
|
border-color: #667eea;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0 0 0 6rpx rgba(102, 126, 234, 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.captcha-wrapper {
|
||||||
|
.captcha-image {
|
||||||
|
margin-left: 20rpx;
|
||||||
|
width: 150rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #e9ecef;
|
||||||
|
border: 1rpx solid #ddd;
|
||||||
|
|
||||||
|
.captcha-img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.sms-wrapper {
|
||||||
|
.sms-button {
|
||||||
|
margin-left: 20rpx;
|
||||||
|
width: 180rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background: #667eea;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background: #5a6fd8;
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sms-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.styled-input) {
|
||||||
|
background: transparent !important;
|
||||||
|
border: none !important;
|
||||||
|
outline: none !important;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
color: #999999;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.reset-btn {
|
||||||
|
width: 100%;
|
||||||
|
height: 80rpx;
|
||||||
|
border: none;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #ffffff;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
box-shadow: 0 8rpx 24rpx rgba(102, 126, 234, 0.3);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
background-color: var(
|
||||||
|
--wot-button-primary-bg-color,
|
||||||
|
var(--wot-color-theme, #4d80f0)
|
||||||
|
);
|
||||||
|
text-align: center;
|
||||||
|
line-height: 80rpx;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
transform: translateY(2rpx);
|
||||||
|
box-shadow: 0 4rpx 12rpx rgba(102, 126, 234, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-login-hint {
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.hint-text {
|
||||||
|
color: #667eea;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 区号选择弹窗样式
|
||||||
|
.area-code-sheet {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 24rpx 24rpx 0 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.sheet-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 40rpx 40rpx 20rpx 40rpx;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
|
||||||
|
.sheet-title {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.close-icon) {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999999;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 10rpx;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.area-code-list {
|
||||||
|
max-height: 60vh;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
|
||||||
|
.area-code-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 32rpx 0;
|
||||||
|
border-bottom: 1rpx solid #f8f9fa;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.selected {
|
||||||
|
background-color: rgba(102, 126, 234, 0.05);
|
||||||
|
|
||||||
|
.area-name {
|
||||||
|
color: #667eea;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.area-code {
|
||||||
|
color: #667eea;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.area-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8rpx;
|
||||||
|
|
||||||
|
.area-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.area-code {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.check-icon) {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #667eea;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-footer {
|
||||||
|
padding: 30rpx 40rpx 40rpx 40rpx;
|
||||||
|
border-top: 1rpx solid #f0f0f0;
|
||||||
|
|
||||||
|
:deep(.confirm-btn) {
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -9,15 +9,15 @@
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { LoginData } from '@/api/auth'
|
import type { LoginData } from '@/api/auth';
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { login } from '@/api/auth'
|
import { login } from '@/api/auth';
|
||||||
import { useConfigStore } from '@/store'
|
import { useConfigStore } from '@/store';
|
||||||
import { getEnvBaseUrl } from '@/utils'
|
import { getEnvBaseUrl } from '@/utils';
|
||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast';
|
||||||
// 导入国际化相关功能
|
// 导入国际化相关功能
|
||||||
import { t, changeLanguage, getSupportedLanguages, initI18n } from '@/i18n'
|
import { t, changeLanguage, getSupportedLanguages, initI18n } from '@/i18n';
|
||||||
import type { Language } from '@/store/lang'
|
import type { Language } from '@/store/lang';
|
||||||
// 导入SM2加密工具
|
// 导入SM2加密工具
|
||||||
import { sm2Encrypt } from '@/utils'
|
import { sm2Encrypt } from '@/utils'
|
||||||
|
|
||||||
|
|
@ -116,6 +116,13 @@ function goToRegister() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 跳转到忘记密码页面
|
||||||
|
function goToForgotPassword() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/forgot-password/index',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 生成UUID
|
// 生成UUID
|
||||||
function generateUUID() {
|
function generateUUID() {
|
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||||
|
|
@ -136,9 +143,9 @@ function goToServerSetting() {
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
async function refreshCaptcha() {
|
async function refreshCaptcha() {
|
||||||
const uuid = generateUUID()
|
const uuid = generateUUID();
|
||||||
formData.value.captchaId = uuid
|
formData.value.captchaId = uuid;
|
||||||
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`
|
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
|
|
@ -369,13 +376,18 @@ onMounted(async () => {
|
||||||
{{ loading ? t('login.loggingIn') : t('login.loginButton') }}
|
{{ loading ? t('login.loggingIn') : t('login.loginButton') }}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="register-hint">
|
<view class="hint-row">
|
||||||
<text class="hint-text">
|
<view class="register-hint">
|
||||||
{{ t('login.noAccount') }}
|
<text class="register-link" @click="goToRegister">
|
||||||
</text>
|
{{ t('login.noAccount') }}
|
||||||
<text class="register-link" @click="goToRegister">
|
</text>
|
||||||
{{ t('login.registerNow') }}
|
</view>
|
||||||
</text>
|
|
||||||
|
<view class="forgot-password">
|
||||||
|
<text class="forgot-text" @click="goToForgotPassword">
|
||||||
|
{{ t('login.forgotPassword') }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 登录方式切换 -->
|
<!-- 登录方式切换 -->
|
||||||
|
|
@ -665,10 +677,14 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.forgot-password {
|
.hint-row {
|
||||||
text-align: right;
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.forgot-password {
|
||||||
.forgot-text {
|
.forgot-text {
|
||||||
color: #667eea;
|
color: #667eea;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
|
|
@ -706,14 +722,6 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.register-hint {
|
.register-hint {
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
.hint-text {
|
|
||||||
color: #666666;
|
|
||||||
font-size: 26rpx;
|
|
||||||
margin-right: 8rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.register-link {
|
.register-link {
|
||||||
color: #667eea;
|
color: #667eea;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,15 @@
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { register, sendSmsCode } from '@/api/auth'
|
import { register, sendSmsCode } from '@/api/auth';
|
||||||
import { useConfigStore } from '@/store'
|
import { useConfigStore } from '@/store';
|
||||||
import { getEnvBaseUrl } from '@/utils'
|
import { getEnvBaseUrl } from '@/utils';
|
||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast';
|
||||||
// 导入国际化相关功能
|
// 导入国际化相关功能
|
||||||
import { t, initI18n } from '@/i18n'
|
import { t, initI18n } from '@/i18n';
|
||||||
// 导入SM2加密工具
|
// 导入SM2加密工具
|
||||||
import { sm2Encrypt } from '@/utils'
|
import { sm2Encrypt } from '@/utils';
|
||||||
|
|
||||||
// 获取屏幕边界到安全区域距离
|
// 获取屏幕边界到安全区域距离
|
||||||
let safeAreaInsets
|
let safeAreaInsets
|
||||||
|
|
@ -135,9 +135,9 @@ function generateUUID() {
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
async function refreshCaptcha() {
|
async function refreshCaptcha() {
|
||||||
const uuid = generateUUID()
|
const uuid = generateUUID();
|
||||||
formData.value.captchaId = uuid
|
formData.value.captchaId = uuid;
|
||||||
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`
|
captchaImage.value = `${getEnvBaseUrl()}/user/captcha?uuid=${uuid}&t=${Date.now()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送短信验证码
|
// 发送短信验证码
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@
|
||||||
}</route>
|
}</route>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { changeLanguage, getCurrentLanguage, getSupportedLanguages, t } from '@/i18n'
|
||||||
|
import type { Language } from '@/store/lang'
|
||||||
import { clearServerBaseUrlOverride, getEnvBaseUrl, getServerBaseUrlOverride, setServerBaseUrlOverride } from '@/utils'
|
import { clearServerBaseUrlOverride, getEnvBaseUrl, getServerBaseUrlOverride, setServerBaseUrlOverride } from '@/utils'
|
||||||
import { isMp } from '@/utils/platform'
|
import { isMp } from '@/utils/platform'
|
||||||
import { computed, onMounted, reactive, ref } from 'vue'
|
import { computed, onMounted, reactive, ref } from 'vue'
|
||||||
import { useToast } from 'wot-design-uni'
|
import { useToast } from 'wot-design-uni'
|
||||||
import { t, changeLanguage, getSupportedLanguages, getCurrentLanguage } from '@/i18n'
|
|
||||||
import type { Language } from '@/store/lang'
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'SettingsPage',
|
name: 'SettingsPage',
|
||||||
|
|
@ -235,7 +235,7 @@ function showAbout() {
|
||||||
title: t('settings.aboutApp', { appName: import.meta.env.VITE_APP_TITLE }),
|
title: t('settings.aboutApp', { appName: import.meta.env.VITE_APP_TITLE }),
|
||||||
content: t('settings.aboutContent', {
|
content: t('settings.aboutContent', {
|
||||||
appName: import.meta.env.VITE_APP_TITLE,
|
appName: import.meta.env.VITE_APP_TITLE,
|
||||||
version: '0.8.4'
|
version: '0.8.8'
|
||||||
}),
|
}),
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
confirmText: t('common.confirm'),
|
confirmText: t('common.confirm'),
|
||||||
|
|
@ -283,9 +283,9 @@ onMounted(async () => {
|
||||||
<view class="mb-[24rpx]">
|
<view class="mb-[24rpx]">
|
||||||
<view class="w-full rounded-[16rpx] border border-[#eeeeee] bg-[#f5f7fb] overflow-hidden">
|
<view class="w-full rounded-[16rpx] border border-[#eeeeee] bg-[#f5f7fb] overflow-hidden">
|
||||||
<wd-input v-model="baseUrlInput" type="text" clearable :maxlength="200"
|
<wd-input v-model="baseUrlInput" type="text" clearable :maxlength="200"
|
||||||
:placeholder="t('settings.enterServerUrl')"
|
:placeholder="t('settings.enterServerUrl')"
|
||||||
custom-class="!border-none !bg-transparent h-[64rpx] px-[24rpx] items-center"
|
custom-class="!border-none !bg-transparent h-[64rpx] px-[24rpx] items-center"
|
||||||
input-class="text-[28rpx] text-[#232338]" @input="validateUrl" @blur="validateUrl" />
|
input-class="text-[28rpx] text-[#232338]" @input="validateUrl" @blur="validateUrl" />
|
||||||
</view>
|
</view>
|
||||||
<text v-if="urlError" class="mt-[8rpx] block text-[24rpx] text-[#ff4d4f]">
|
<text v-if="urlError" class="mt-[8rpx] block text-[24rpx] text-[#ff4d4f]">
|
||||||
{{ urlError }}
|
{{ urlError }}
|
||||||
|
|
@ -323,11 +323,11 @@ onMounted(async () => {
|
||||||
class="flex items-center justify-between border border-[#eeeeee] rounded-[16rpx] bg-[#f5f7fb] p-[24rpx] transition-all active:bg-[#eef3ff]">
|
class="flex items-center justify-between border border-[#eeeeee] rounded-[16rpx] bg-[#f5f7fb] p-[24rpx] transition-all active:bg-[#eef3ff]">
|
||||||
<view>
|
<view>
|
||||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||||
{{ t('settings.totalCacheSize') }}
|
{{ t('settings.totalCacheSize') }}
|
||||||
</text>
|
</text>
|
||||||
<text class="mt-[4rpx] block text-[24rpx] text-[#9d9ea3]">
|
<text class="mt-[4rpx] block text-[24rpx] text-[#9d9ea3]">
|
||||||
{{ t('settings.appDataSize') }}
|
{{ t('settings.appDataSize') }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="text-[28rpx] text-[#65686f] font-semibold">
|
<text class="text-[28rpx] text-[#65686f] font-semibold">
|
||||||
{{ cacheInfo.storageSize }}
|
{{ cacheInfo.storageSize }}
|
||||||
|
|
@ -339,11 +339,11 @@ onMounted(async () => {
|
||||||
class="flex items-center justify-between border border-[#eeeeee] rounded-[16rpx] bg-[#f5f7fb] p-[24rpx]">
|
class="flex items-center justify-between border border-[#eeeeee] rounded-[16rpx] bg-[#f5f7fb] p-[24rpx]">
|
||||||
<view>
|
<view>
|
||||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||||
{{ t('settings.cacheClear') }}
|
{{ t('settings.cacheClear') }}
|
||||||
</text>
|
</text>
|
||||||
<text class="mt-[4rpx] block text-[24rpx] text-[#9d9ea3]">
|
<text class="mt-[4rpx] block text-[24rpx] text-[#9d9ea3]">
|
||||||
{{ t('settings.clearAllCache') }}
|
{{ t('settings.clearAllCache') }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="cursor-pointer rounded-[24rpx] bg-[rgba(255,107,107,0.1)] px-[28rpx] py-[16rpx] text-[24rpx] text-[#ff6b6b] font-semibold transition-all duration-300 active:scale-95 active:bg-[#ff6b6b] active:text-white"
|
class="cursor-pointer rounded-[24rpx] bg-[rgba(255,107,107,0.1)] px-[28rpx] py-[16rpx] text-[24rpx] text-[#ff6b6b] font-semibold transition-all duration-300 active:scale-95 active:bg-[#ff6b6b] active:text-white"
|
||||||
|
|
@ -359,8 +359,8 @@ onMounted(async () => {
|
||||||
<view class="mb-[32rpx]">
|
<view class="mb-[32rpx]">
|
||||||
<view class="mb-[24rpx] flex items-center">
|
<view class="mb-[24rpx] flex items-center">
|
||||||
<text class="text-[32rpx] text-[#232338] font-bold">
|
<text class="text-[32rpx] text-[#232338] font-bold">
|
||||||
{{ t('settings.appInfo') }}
|
{{ t('settings.appInfo') }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="border border-[#eeeeee] rounded-[24rpx] bg-[#fbfbfb] p-[32rpx]"
|
<view class="border border-[#eeeeee] rounded-[24rpx] bg-[#fbfbfb] p-[32rpx]"
|
||||||
|
|
@ -370,11 +370,11 @@ onMounted(async () => {
|
||||||
@click="showAbout">
|
@click="showAbout">
|
||||||
<view>
|
<view>
|
||||||
<text class="text-[28rpx] text-[#232338] font-medium">
|
<text class="text-[28rpx] text-[#232338] font-medium">
|
||||||
{{ t('settings.aboutUs') }}
|
{{ t('settings.aboutUs') }}
|
||||||
</text>
|
</text>
|
||||||
<text class="mt-[4rpx] block text-[24rpx] text-[#9d9ea3]">
|
<text class="mt-[4rpx] block text-[24rpx] text-[#9d9ea3]">
|
||||||
{{ t('settings.appVersion') }}
|
{{ t('settings.appVersion') }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<wd-icon name="arrow-right" custom-class="text-[32rpx] text-[#9d9ea3]" />
|
<wd-icon name="arrow-right" custom-class="text-[32rpx] text-[#9d9ea3]" />
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -385,24 +385,26 @@ onMounted(async () => {
|
||||||
<view class="mb-[32rpx]">
|
<view class="mb-[32rpx]">
|
||||||
<view class="mb-[24rpx] flex items-center">
|
<view class="mb-[24rpx] flex items-center">
|
||||||
<text class="text-[32rpx] text-[#232338] font-bold">
|
<text class="text-[32rpx] text-[#232338] font-bold">
|
||||||
{{ t('settings.languageSettings') }}
|
{{ t('settings.languageSettings') }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="border border-[#eeeeee] rounded-[24rpx] bg-[#fbfbfb] p-[32rpx]"
|
<view class="border border-[#eeeeee] rounded-[24rpx] bg-[#fbfbfb] p-[32rpx]"
|
||||||
style="box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);">
|
style="box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);">
|
||||||
<view class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[16rpx] bg-[#f5f7fb] p-[24rpx] transition-all active:bg-[#eef3ff]" @click="showLanguageSheet = true">
|
<view
|
||||||
|
class="flex cursor-pointer items-center justify-between border border-[#eeeeee] rounded-[16rpx] bg-[#f5f7fb] p-[24rpx] transition-all active:bg-[#eef3ff]"
|
||||||
|
@click="showLanguageSheet = true">
|
||||||
<view>
|
<view>
|
||||||
<text class="text-[32rpx] text-[#232338] font-medium">
|
<text class="text-[32rpx] text-[#232338] font-medium">
|
||||||
{{ t('settings.language') }}
|
{{ t('settings.language') }}
|
||||||
</text>
|
</text>
|
||||||
<text class="mt-[4rpx] block text-[24rpx] text-[#9d9ea3]">
|
<text class="mt-[4rpx] block text-[24rpx] text-[#9d9ea3]">
|
||||||
{{ t('settings.selectLanguage') }}
|
{{ t('settings.selectLanguage') }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<text class="text-[32rpx] text-[#9d9ea3] font-semibold mr-[16rpx]">
|
<text class="text-[32rpx] text-[#9d9ea3] font-semibold mr-[16rpx]">
|
||||||
{{ supportedLanguages.find(lang => lang.code === currentLanguage)?.name }}
|
{{supportedLanguages.find(lang => lang.code === currentLanguage)?.name}}
|
||||||
</text>
|
</text>
|
||||||
<wd-icon name="arrow-right" custom-class="text-[32rpx] text-[#9d9ea3]" />
|
<wd-icon name="arrow-right" custom-class="text-[32rpx] text-[#9d9ea3]" />
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -411,19 +413,11 @@ onMounted(async () => {
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 语言选择弹窗 -->
|
<!-- 语言选择弹窗 -->
|
||||||
<wd-action-sheet
|
<wd-action-sheet v-model="showLanguageSheet" :title="t('settings.selectLanguage')" :close-on-click-modal="true">
|
||||||
v-model="showLanguageSheet"
|
|
||||||
:title="t('settings.selectLanguage')"
|
|
||||||
:close-on-click-modal="true"
|
|
||||||
>
|
|
||||||
<view class="language-sheet">
|
<view class="language-sheet">
|
||||||
<scroll-view scroll-y class="language-list">
|
<scroll-view scroll-y class="language-list">
|
||||||
<view
|
<view v-for="lang in supportedLanguages" :key="lang.code" class="language-item"
|
||||||
v-for="lang in supportedLanguages"
|
@click="handleLanguageChange(lang.code)">
|
||||||
:key="lang.code"
|
|
||||||
class="language-item"
|
|
||||||
@click="handleLanguageChange(lang.code)"
|
|
||||||
>
|
|
||||||
<text class="language-name">
|
<text class="language-name">
|
||||||
{{ lang.name }}
|
{{ lang.name }}
|
||||||
</text>
|
</text>
|
||||||
|
|
@ -446,17 +440,21 @@ onMounted(async () => {
|
||||||
.language-sheet {
|
.language-sheet {
|
||||||
.language-list {
|
.language-list {
|
||||||
max-height: 50vh;
|
max-height: 50vh;
|
||||||
|
|
||||||
.language-item {
|
.language-item {
|
||||||
padding: 30rpx 0;
|
padding: 30rpx 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-bottom: 1rpx solid #f0f0f0;
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
|
||||||
.language-name {
|
.language-name {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background-color: #f5f7fb;
|
background-color: #f5f7fb;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
main/manager-web/package-lock.json
generated
|
|
@ -10168,7 +10168,7 @@
|
||||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"uuid": "dist/bin/uuid"
|
"uuid": "bin/uuid"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/source-list-map": {
|
"node_modules/source-list-map": {
|
||||||
|
|
@ -11096,15 +11096,6 @@
|
||||||
"node": ">= 0.4.0"
|
"node": ">= 0.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/uuid": {
|
|
||||||
"version": "3.4.0",
|
|
||||||
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz",
|
|
||||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
|
||||||
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
|
|
||||||
"bin": {
|
|
||||||
"uuid": "bin/uuid"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/validate-npm-package-license": {
|
"node_modules/validate-npm-package-license": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmmirror.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
"resolved": "https://registry.npmmirror.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import timbre from "./module/timbre.js"
|
||||||
import user from './module/user.js'
|
import user from './module/user.js'
|
||||||
import voiceClone from './module/voiceClone.js'
|
import voiceClone from './module/voiceClone.js'
|
||||||
import voiceResource from './module/voiceResource.js'
|
import voiceResource from './module/voiceResource.js'
|
||||||
|
import knowledgeBase from './module/knowledgeBase.js'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -39,5 +40,6 @@ export default {
|
||||||
ota,
|
ota,
|
||||||
dict,
|
dict,
|
||||||
voiceResource,
|
voiceResource,
|
||||||
voiceClone
|
voiceClone,
|
||||||
}
|
knowledgeBase
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,21 +102,4 @@ export default {
|
||||||
});
|
});
|
||||||
}).send();
|
}).send();
|
||||||
},
|
},
|
||||||
// 发送设备指令
|
|
||||||
sendDeviceCommand(deviceId, mcpData, callback) {
|
|
||||||
RequestService.sendRequest()
|
|
||||||
.url(`${getServiceUrl()}/device/commands/${deviceId}`)
|
|
||||||
.method('POST')
|
|
||||||
.data(mcpData)
|
|
||||||
.success((res) => {
|
|
||||||
RequestService.clearRequestTime();
|
|
||||||
callback(res);
|
|
||||||
})
|
|
||||||
.networkFail((err) => {
|
|
||||||
console.error('发送设备指令失败:', err);
|
|
||||||
RequestService.reAjaxFun(() => {
|
|
||||||
this.sendDeviceCommand(deviceId, mcpData, callback);
|
|
||||||
});
|
|
||||||
}).send();
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
318
main/manager-web/src/apis/module/knowledgeBase.js
Normal file
|
|
@ -0,0 +1,318 @@
|
||||||
|
import { getServiceUrl } from '../api';
|
||||||
|
import RequestService from '../httpRequest';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取认证token
|
||||||
|
*/
|
||||||
|
function getAuthToken() {
|
||||||
|
return localStorage.getItem('token') || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用API请求包装器
|
||||||
|
* @param {Object} config - 请求配置
|
||||||
|
* @param {string} config.url - 请求URL
|
||||||
|
* @param {string} config.method - 请求方法
|
||||||
|
* @param {Object} [config.data] - 请求数据
|
||||||
|
* @param {Object} [config.headers] - 额外请求头
|
||||||
|
* @param {Function} config.callback - 成功回调
|
||||||
|
* @param {Function} [config.errorCallback] - 错误回调
|
||||||
|
* @param {string} [config.errorMessage] - 错误消息
|
||||||
|
* @param {Function} [config.retryFunction] - 重试函数
|
||||||
|
*/
|
||||||
|
function makeApiRequest(config) {
|
||||||
|
const token = getAuthToken();
|
||||||
|
const { url, method, data, headers, callback, errorCallback, errorMessage, retryFunction } = config;
|
||||||
|
|
||||||
|
const requestBuilder = RequestService.sendRequest()
|
||||||
|
.url(url)
|
||||||
|
.method(method)
|
||||||
|
.header({
|
||||||
|
'Authorization': `Bearer ${token}`,
|
||||||
|
...headers
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
requestBuilder.data(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
requestBuilder
|
||||||
|
.success((res) => {
|
||||||
|
RequestService.clearRequestTime();
|
||||||
|
callback(res);
|
||||||
|
})
|
||||||
|
.fail((err) => {
|
||||||
|
console.error(errorMessage || '操作失败', err);
|
||||||
|
if (errorCallback) {
|
||||||
|
errorCallback(err);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.networkFail(() => {
|
||||||
|
if (retryFunction) {
|
||||||
|
RequestService.reAjaxFun(() => {
|
||||||
|
retryFunction();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 知识库管理相关API
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
/**
|
||||||
|
* 获取知识库列表
|
||||||
|
* @param {Object} params - 查询参数
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
getKnowledgeBaseList(params, callback, errorCallback) {
|
||||||
|
const queryParams = new URLSearchParams({
|
||||||
|
page: params.page,
|
||||||
|
page_size: params.page_size,
|
||||||
|
name: params.name || ''
|
||||||
|
}).toString();
|
||||||
|
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets?${queryParams}`,
|
||||||
|
method: 'GET',
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '获取知识库列表失败',
|
||||||
|
retryFunction: () => this.getKnowledgeBaseList(params, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建知识库
|
||||||
|
* @param {Object} data - 知识库数据
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
createKnowledgeBase(data, callback, errorCallback) {
|
||||||
|
console.log('createKnowledgeBase called with data:', data);
|
||||||
|
console.log('API URL:', `${getServiceUrl()}/datasets`);
|
||||||
|
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets`,
|
||||||
|
method: 'POST',
|
||||||
|
data: data,
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
callback: (res) => {
|
||||||
|
console.log('createKnowledgeBase success response:', res);
|
||||||
|
callback(res);
|
||||||
|
},
|
||||||
|
errorCallback: (err) => {
|
||||||
|
console.error('创建知识库失败:', err);
|
||||||
|
if (err.response) {
|
||||||
|
console.error('Error response data:', err.response.data);
|
||||||
|
console.error('Error response status:', err.response.status);
|
||||||
|
}
|
||||||
|
if (errorCallback) {
|
||||||
|
errorCallback(err);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
errorMessage: '创建知识库失败',
|
||||||
|
retryFunction: () => this.createKnowledgeBase(data, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新知识库
|
||||||
|
* @param {string} datasetId - 知识库ID
|
||||||
|
* @param {Object} data - 更新数据
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
updateKnowledgeBase(datasetId, data, callback, errorCallback) {
|
||||||
|
console.log('updateKnowledgeBase called with datasetId:', datasetId, 'data:', data);
|
||||||
|
console.log('API URL:', `${getServiceUrl()}/datasets/${datasetId}`);
|
||||||
|
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets/${datasetId}`,
|
||||||
|
method: 'PUT',
|
||||||
|
data: data,
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '更新知识库失败',
|
||||||
|
retryFunction: () => this.updateKnowledgeBase(datasetId, data, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个知识库
|
||||||
|
* @param {string} datasetId - 知识库ID
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
deleteKnowledgeBase(datasetId, callback, errorCallback) {
|
||||||
|
console.log('deleteKnowledgeBase called with datasetId:', datasetId);
|
||||||
|
console.log('API URL:', `${getServiceUrl()}/datasets/${datasetId}`);
|
||||||
|
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets/${datasetId}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '删除知识库失败',
|
||||||
|
retryFunction: () => this.deleteKnowledgeBase(datasetId, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除知识库
|
||||||
|
* @param {string|Array} ids - 知识库ID字符串或数组
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
deleteKnowledgeBases(ids, callback, errorCallback) {
|
||||||
|
// 确保ids是正确格式的字符串
|
||||||
|
const idsStr = Array.isArray(ids) ? ids.join(',') : ids;
|
||||||
|
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets/batch?ids=${idsStr}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '批量删除知识库失败',
|
||||||
|
retryFunction: () => this.deleteKnowledgeBases(ids, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文档列表
|
||||||
|
* @param {string} datasetId - 知识库ID
|
||||||
|
* @param {Object} params - 查询参数
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
getDocumentList(datasetId, params, callback, errorCallback) {
|
||||||
|
const queryParams = new URLSearchParams({
|
||||||
|
page: params.page,
|
||||||
|
page_size: params.page_size,
|
||||||
|
name: params.name || ''
|
||||||
|
}).toString();
|
||||||
|
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets/${datasetId}/documents?${queryParams}`,
|
||||||
|
method: 'GET',
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '获取文档列表失败',
|
||||||
|
retryFunction: () => this.getDocumentList(datasetId, params, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文档
|
||||||
|
* @param {string} datasetId - 知识库ID
|
||||||
|
* @param {Object} formData - 表单数据
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
uploadDocument(datasetId, formData, callback, errorCallback) {
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets/${datasetId}/documents`,
|
||||||
|
method: 'POST',
|
||||||
|
data: formData,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '上传文档失败',
|
||||||
|
retryFunction: () => this.uploadDocument(datasetId, formData, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析文档
|
||||||
|
* @param {string} datasetId - 知识库ID
|
||||||
|
* @param {string} documentId - 文档ID
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
parseDocument(datasetId, documentId, callback, errorCallback) {
|
||||||
|
const requestBody = {
|
||||||
|
document_ids: [documentId]
|
||||||
|
};
|
||||||
|
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets/${datasetId}/chunks`,
|
||||||
|
method: 'POST',
|
||||||
|
data: requestBody,
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '解析文档失败',
|
||||||
|
retryFunction: () => this.parseDocument(datasetId, documentId, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文档
|
||||||
|
* @param {string} datasetId - 知识库ID
|
||||||
|
* @param {string} documentId - 文档ID
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
deleteDocument(datasetId, documentId, callback, errorCallback) {
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets/${datasetId}/documents/${documentId}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '删除文档失败',
|
||||||
|
retryFunction: () => this.deleteDocument(datasetId, documentId, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文档切片列表
|
||||||
|
* @param {string} datasetId - 知识库ID
|
||||||
|
* @param {string} documentId - 文档ID
|
||||||
|
* @param {Object} params - 查询参数
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
listChunks(datasetId, documentId, params, callback, errorCallback) {
|
||||||
|
let queryParams = new URLSearchParams({
|
||||||
|
page: params.page || 1,
|
||||||
|
page_size: params.page_size || 10
|
||||||
|
}).toString();
|
||||||
|
|
||||||
|
// 添加关键词搜索参数
|
||||||
|
if (params.keywords) {
|
||||||
|
queryParams += `&keywords=${encodeURIComponent(params.keywords)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets/${datasetId}/documents/${documentId}/chunks?${queryParams}`,
|
||||||
|
method: 'GET',
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '获取切片列表失败',
|
||||||
|
retryFunction: () => this.listChunks(datasetId, documentId, params, callback, errorCallback)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 召回测试
|
||||||
|
* @param {string} datasetId - 知识库ID
|
||||||
|
* @param {Object} data - 召回测试参数
|
||||||
|
* @param {Function} callback - 回调函数
|
||||||
|
* @param {Function} errorCallback - 错误回调
|
||||||
|
*/
|
||||||
|
retrievalTest(datasetId, data, callback, errorCallback) {
|
||||||
|
makeApiRequest({
|
||||||
|
url: `${getServiceUrl()}/datasets/${datasetId}/retrieval-test`,
|
||||||
|
method: 'POST',
|
||||||
|
data: data,
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
callback: callback,
|
||||||
|
errorCallback: errorCallback,
|
||||||
|
errorMessage: '召回测试失败',
|
||||||
|
retryFunction: () => this.retrievalTest(datasetId, data, callback, errorCallback)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
@ -47,6 +47,7 @@ export default {
|
||||||
addModel(params, callback) {
|
addModel(params, callback) {
|
||||||
const { modelType, provideCode, formData } = params;
|
const { modelType, provideCode, formData } = params;
|
||||||
const postData = {
|
const postData = {
|
||||||
|
id: formData.id,
|
||||||
modelCode: formData.modelCode,
|
modelCode: formData.modelCode,
|
||||||
modelName: formData.modelName,
|
modelName: formData.modelName,
|
||||||
isDefault: formData.isDefault ? 1 : 0,
|
isDefault: formData.isDefault ? 1 : 0,
|
||||||
|
|
@ -336,5 +337,23 @@ export default {
|
||||||
this.getPluginFunctionList(params, callback)
|
this.getPluginFunctionList(params, callback)
|
||||||
})
|
})
|
||||||
}).send()
|
}).send()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取RAG模型列表
|
||||||
|
getRAGModels(callback) {
|
||||||
|
RequestService.sendRequest()
|
||||||
|
.url(`${getServiceUrl()}/datasets/rag-models`)
|
||||||
|
.method('GET')
|
||||||
|
.success((res) => {
|
||||||
|
RequestService.clearRequestTime()
|
||||||
|
callback(res)
|
||||||
|
})
|
||||||
|
.networkFail((err) => {
|
||||||
|
console.error('获取RAG模型列表失败:', err)
|
||||||
|
this.$message.error(err.msg || '获取RAG模型列表失败')
|
||||||
|
RequestService.reAjaxFun(() => {
|
||||||
|
this.getRAGModels(callback)
|
||||||
|
})
|
||||||
|
}).send()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 复刻音频
|
// 复刻音频
|
||||||
cloneAudio(params, callback) {
|
cloneAudio(params, callback, errorCallback) {
|
||||||
RequestService.sendRequest()
|
RequestService.sendRequest()
|
||||||
.url(`${getServiceUrl()}/voiceClone/cloneAudio`)
|
.url(`${getServiceUrl()}/voiceClone/cloneAudio`)
|
||||||
.method('POST')
|
.method('POST')
|
||||||
|
|
@ -88,10 +88,19 @@ export default {
|
||||||
RequestService.clearRequestTime();
|
RequestService.clearRequestTime();
|
||||||
callback(res);
|
callback(res);
|
||||||
})
|
})
|
||||||
|
.fail((res) => {
|
||||||
|
// 业务失败回调
|
||||||
|
RequestService.clearRequestTime();
|
||||||
|
if (errorCallback) {
|
||||||
|
errorCallback(res);
|
||||||
|
} else {
|
||||||
|
callback(res);
|
||||||
|
}
|
||||||
|
})
|
||||||
.networkFail((err) => {
|
.networkFail((err) => {
|
||||||
console.error('上传失败:', err);
|
console.error('上传失败:', err);
|
||||||
RequestService.reAjaxFun(() => {
|
RequestService.reAjaxFun(() => {
|
||||||
this.cloneAudio(params, callback);
|
this.cloneAudio(params, callback, errorCallback);
|
||||||
});
|
});
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
main/manager-web/src/assets/header/knowledge_base.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
|
@ -27,6 +27,12 @@
|
||||||
|
|
||||||
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px;"></div>
|
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px;"></div>
|
||||||
<el-form :model="formData" label-width="100px" label-position="left" class="custom-form">
|
<el-form :model="formData" label-width="100px" label-position="left" class="custom-form">
|
||||||
|
<div style="display: flex; gap: 20px; margin-bottom: 0;">
|
||||||
|
<el-form-item :label="$t('modelConfigDialog.modelId')" prop="id" style="flex: 1;">
|
||||||
|
<el-input v-model="formData.id" :placeholder="$t('modelConfigDialog.enterModelId')" class="custom-input-bg"
|
||||||
|
maxlength="32"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
<div style="display: flex; gap: 20px; margin-bottom: 0;">
|
<div style="display: flex; gap: 20px; margin-bottom: 0;">
|
||||||
<el-form-item :label="$t('modelConfigDialog.modelName')" prop="modelName" style="flex: 1;">
|
<el-form-item :label="$t('modelConfigDialog.modelName')" prop="modelName" style="flex: 1;">
|
||||||
<el-input v-model="formData.modelName" :placeholder="$t('modelConfigDialog.enterModelName')"
|
<el-input v-model="formData.modelName" :placeholder="$t('modelConfigDialog.enterModelName')"
|
||||||
|
|
@ -69,16 +75,14 @@
|
||||||
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px;"></div>
|
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px;"></div>
|
||||||
|
|
||||||
<el-form :model="formData.configJson" label-width="auto" label-position="left" class="custom-form">
|
<el-form :model="formData.configJson" label-width="auto" label-position="left" class="custom-form">
|
||||||
<template v-for="(row, rowIndex) in chunkedCallInfoFields">
|
<div v-for="(row, rowIndex) in chunkedCallInfoFields" :key="rowIndex"
|
||||||
<div :key="rowIndex" style="display: flex; gap: 20px; margin-bottom: 0;">
|
style="display: flex; gap: 20px; margin-bottom: 0;">
|
||||||
<el-form-item v-for="field in row" :key="field.prop" :label="field.label" :prop="field.prop"
|
<el-form-item v-for="field in row" :key="field.prop" :label="field.label" :prop="field.prop" style="flex: 1;">
|
||||||
style="flex: 1;">
|
<el-input v-model="formData.configJson[field.prop]" :placeholder="field.placeholder"
|
||||||
<el-input v-model="formData.configJson[field.prop]" :placeholder="field.placeholder"
|
:type="field.type || 'text'" class="custom-input-bg" :show-password="field.type === 'password'">
|
||||||
:type="field.type || 'text'" class="custom-input-bg" :show-password="field.type === 'password'">
|
</el-input>
|
||||||
</el-input>
|
</el-form-item>
|
||||||
</el-form-item>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -107,6 +111,7 @@ export default {
|
||||||
providerFields: [],
|
providerFields: [],
|
||||||
currentProvider: null,
|
currentProvider: null,
|
||||||
formData: {
|
formData: {
|
||||||
|
id: '',
|
||||||
modelName: '',
|
modelName: '',
|
||||||
modelCode: '',
|
modelCode: '',
|
||||||
supplier: '',
|
supplier: '',
|
||||||
|
|
@ -202,6 +207,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitData = {
|
const submitData = {
|
||||||
|
id: this.formData.id || '',
|
||||||
modelName: this.formData.modelName || '',
|
modelName: this.formData.modelName || '',
|
||||||
modelCode: this.formData.modelCode || '',
|
modelCode: this.formData.modelCode || '',
|
||||||
supplier: this.formData.supplier,
|
supplier: this.formData.supplier,
|
||||||
|
|
@ -230,6 +236,7 @@ export default {
|
||||||
resetForm() {
|
resetForm() {
|
||||||
this.saving = false;
|
this.saving = false;
|
||||||
this.formData = {
|
this.formData = {
|
||||||
|
id: '',
|
||||||
modelName: '',
|
modelName: '',
|
||||||
modelCode: '',
|
modelCode: '',
|
||||||
supplier: '',
|
supplier: '',
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@
|
||||||
<div class="function-column">
|
<div class="function-column">
|
||||||
<div class="column-header">
|
<div class="column-header">
|
||||||
<h4 class="column-title">{{ $t('functionDialog.unselectedFunctions') }}</h4>
|
<h4 class="column-title">{{ $t('functionDialog.unselectedFunctions') }}</h4>
|
||||||
<el-button type="text" @click="selectAll" class="select-all-btn">{{ $t('functionDialog.selectAll') }}</el-button>
|
<el-button type="text" @click="selectAll" class="select-all-btn">
|
||||||
|
{{ $t('functionDialog.selectAll') }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="function-list">
|
<div class="function-list">
|
||||||
<div v-if="unselected.length">
|
<div v-if="unselected.length">
|
||||||
|
|
@ -21,7 +23,7 @@
|
||||||
<el-checkbox :label="func.name" v-model="selectedNames" @change="(val) => handleCheckboxChange(func, val)"
|
<el-checkbox :label="func.name" v-model="selectedNames" @change="(val) => handleCheckboxChange(func, val)"
|
||||||
@click.native.stop></el-checkbox>
|
@click.native.stop></el-checkbox>
|
||||||
<div class="func-tag" @click="handleFunctionClick(func)">
|
<div class="func-tag" @click="handleFunctionClick(func)">
|
||||||
<div class="color-dot" :style="{ backgroundColor: getFunctionColor(func.name) }"></div>
|
<div class="color-dot"></div>
|
||||||
<span>{{ func.name }}</span>
|
<span>{{ func.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -36,7 +38,9 @@
|
||||||
<div class="function-column">
|
<div class="function-column">
|
||||||
<div class="column-header">
|
<div class="column-header">
|
||||||
<h4 class="column-title">{{ $t('functionDialog.selectedFunctions') }}</h4>
|
<h4 class="column-title">{{ $t('functionDialog.selectedFunctions') }}</h4>
|
||||||
<el-button type="text" @click="deselectAll" class="select-all-btn">{{ $t('functionDialog.selectAll') }}</el-button>
|
<el-button type="text" @click="deselectAll" class="select-all-btn">
|
||||||
|
{{ $t('functionDialog.selectAll') }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="function-list">
|
<div class="function-list">
|
||||||
<div v-if="selectedList.length > 0">
|
<div v-if="selectedList.length > 0">
|
||||||
|
|
@ -44,7 +48,7 @@
|
||||||
<el-checkbox :label="func.name" v-model="selectedNames" @change="(val) => handleCheckboxChange(func, val)"
|
<el-checkbox :label="func.name" v-model="selectedNames" @change="(val) => handleCheckboxChange(func, val)"
|
||||||
@click.native.stop></el-checkbox>
|
@click.native.stop></el-checkbox>
|
||||||
<div class="func-tag" @click="handleFunctionClick(func)">
|
<div class="func-tag" @click="handleFunctionClick(func)">
|
||||||
<div class="color-dot" :style="{ backgroundColor: getFunctionColor(func.name) }"></div>
|
<div class="color-dot"></div>
|
||||||
<span>{{ func.name }}</span>
|
<span>{{ func.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -57,7 +61,9 @@
|
||||||
|
|
||||||
<!-- 右侧:参数配置 -->
|
<!-- 右侧:参数配置 -->
|
||||||
<div class="params-column">
|
<div class="params-column">
|
||||||
<h4 v-if="currentFunction" class="column-title">{{ $t('functionDialog.paramConfig') }} - {{ currentFunction.name }}</h4>
|
<h4 v-if="currentFunction" class="column-title">
|
||||||
|
{{ $t('functionDialog.paramConfig') }} - {{ currentFunction.name }}
|
||||||
|
</h4>
|
||||||
<div v-if="currentFunction" class="params-container">
|
<div v-if="currentFunction" class="params-container">
|
||||||
<el-form :model="currentFunction" class="param-form">
|
<el-form :model="currentFunction" class="param-form">
|
||||||
<!-- 遍历 fieldsMeta,而不是 params 的 keys -->
|
<!-- 遍历 fieldsMeta,而不是 params 的 keys -->
|
||||||
|
|
@ -119,8 +125,8 @@
|
||||||
<el-input v-model="mcpUrl" readonly class="url-input">
|
<el-input v-model="mcpUrl" readonly class="url-input">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<el-button @click="copyUrl" class="inner-copy-btn" icon="el-icon-document-copy">
|
<el-button @click="copyUrl" class="inner-copy-btn" icon="el-icon-document-copy">
|
||||||
{{ $t('functionDialog.copy') }}
|
{{ $t('functionDialog.copy') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -191,10 +197,6 @@ export default {
|
||||||
selectedNames: [],
|
selectedNames: [],
|
||||||
currentFunction: null,
|
currentFunction: null,
|
||||||
modifiedFunctions: {},
|
modifiedFunctions: {},
|
||||||
functionColorMap: [
|
|
||||||
'#FF6B6B', '#4ECDC4', '#45B7D1',
|
|
||||||
'#96CEB4', '#FFEEAD', '#D4A5A5', '#A2836E'
|
|
||||||
],
|
|
||||||
tempFunctions: {},
|
tempFunctions: {},
|
||||||
// 添加一个标志位来跟踪是否已经保存
|
// 添加一个标志位来跟踪是否已经保存
|
||||||
hasSaved: false,
|
hasSaved: false,
|
||||||
|
|
@ -405,10 +407,6 @@ export default {
|
||||||
// 通知父组件对话框已关闭且已保存
|
// 通知父组件对话框已关闭且已保存
|
||||||
this.$emit('dialog-closed', true);
|
this.$emit('dialog-closed', true);
|
||||||
},
|
},
|
||||||
getFunctionColor(name) {
|
|
||||||
const hash = [...name].reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
||||||
return this.functionColorMap[hash % this.functionColorMap.length];
|
|
||||||
},
|
|
||||||
fieldRemark(field) {
|
fieldRemark(field) {
|
||||||
let description = (field && field.label) ? field.label : '';
|
let description = (field && field.label) ? field.label : '';
|
||||||
if (field.default) {
|
if (field.default) {
|
||||||
|
|
@ -527,6 +525,7 @@ export default {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
|
background-color: #5778ff;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,80 +9,125 @@
|
||||||
|
|
||||||
<!-- 中间导航菜单 -->
|
<!-- 中间导航菜单 -->
|
||||||
<div class="header-center">
|
<div class="header-center">
|
||||||
<div class="equipment-management"
|
<div class="equipment-management" :class="{
|
||||||
:class="{ 'active-tab': $route.path === '/home' || $route.path === '/role-config' || $route.path === '/device-management' }"
|
'active-tab':
|
||||||
@click="goHome">
|
$route.path === '/home' ||
|
||||||
<img loading="lazy" alt="" src="@/assets/header/robot.png"
|
$route.path === '/role-config' ||
|
||||||
:style="{ filter: $route.path === '/home' || $route.path === '/role-config' || $route.path === '/device-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
$route.path === '/device-management',
|
||||||
<span class="nav-text">{{ $t('header.smartManagement') }}</span>
|
}" @click="goHome">
|
||||||
|
<img loading="lazy" alt="" src="@/assets/header/robot.png" :style="{
|
||||||
|
filter:
|
||||||
|
$route.path === '/home' ||
|
||||||
|
$route.path === '/role-config' ||
|
||||||
|
$route.path === '/device-management'
|
||||||
|
? 'brightness(0) invert(1)'
|
||||||
|
: 'None',
|
||||||
|
}" />
|
||||||
|
<span class="nav-text">{{ $t("header.smartManagement") }}</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- 普通用户显示音色克隆 -->
|
<!-- 普通用户显示音色克隆 -->
|
||||||
<div v-if="!isSuperAdmin" class="equipment-management"
|
<div v-if="!isSuperAdmin" class="equipment-management"
|
||||||
:class="{ 'active-tab': $route.path === '/voice-clone-management' }" @click="goVoiceCloneManagement">
|
:class="{ 'active-tab': $route.path === '/voice-clone-management' }" @click="goVoiceCloneManagement">
|
||||||
<img loading="lazy" alt="" src="@/assets/header/voice.png"
|
<img loading="lazy" alt="" src="@/assets/header/voice.png" :style="{
|
||||||
:style="{ filter: $route.path === '/voice-clone-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
filter:
|
||||||
<span class="nav-text">{{ $t('header.voiceCloneManagement') }}</span>
|
$route.path === '/voice-clone-management'
|
||||||
|
? 'brightness(0) invert(1)'
|
||||||
|
: 'None',
|
||||||
|
}" />
|
||||||
|
<span class="nav-text">{{ $t("header.voiceCloneManagement") }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 超级管理员显示音色克隆下拉菜单 -->
|
<!-- 超级管理员显示音色克隆下拉菜单 -->
|
||||||
<el-dropdown v-if="isSuperAdmin" trigger="click" class="equipment-management more-dropdown"
|
<el-dropdown v-if="isSuperAdmin" trigger="click" class="equipment-management more-dropdown" :class="{
|
||||||
:class="{ 'active-tab': $route.path === '/voice-clone-management' || $route.path === '/voice-resource-management' }"
|
'active-tab':
|
||||||
@visible-change="handleVoiceCloneDropdownVisibleChange">
|
$route.path === '/voice-clone-management' ||
|
||||||
|
$route.path === '/voice-resource-management',
|
||||||
|
}" @visible-change="handleVoiceCloneDropdownVisibleChange">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
<img loading="lazy" alt="" src="@/assets/header/voice.png"
|
<img loading="lazy" alt="" src="@/assets/header/voice.png" :style="{
|
||||||
:style="{ filter: $route.path === '/voice-clone-management' || $route.path === '/voice-resource-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
filter:
|
||||||
<span class="nav-text">{{ $t('header.voiceCloneManagement') }}</span>
|
$route.path === '/voice-clone-management' ||
|
||||||
|
$route.path === '/voice-resource-management'
|
||||||
|
? 'brightness(0) invert(1)'
|
||||||
|
: 'None',
|
||||||
|
}" />
|
||||||
|
<span class="nav-text">{{ $t("header.voiceCloneManagement") }}</span>
|
||||||
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': voiceCloneDropdownVisible }"></i>
|
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': voiceCloneDropdownVisible }"></i>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item @click.native="goVoiceCloneManagement">
|
<el-dropdown-item @click.native="goVoiceCloneManagement">
|
||||||
{{ $t('header.voiceCloneManagement') }}
|
{{ $t("header.voiceCloneManagement") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click.native="goVoiceResourceManagement">
|
<el-dropdown-item @click.native="goVoiceResourceManagement">
|
||||||
{{ $t('header.voiceResourceManagement') }}
|
{{ $t("header.voiceResourceManagement") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
||||||
<div v-if="isSuperAdmin" class="equipment-management" :class="{ 'active-tab': $route.path === '/model-config' }"
|
<div v-if="isSuperAdmin" class="equipment-management" :class="{ 'active-tab': $route.path === '/model-config' }"
|
||||||
@click="goModelConfig">
|
@click="goModelConfig">
|
||||||
<img loading="lazy" alt="" src="@/assets/header/model_config.png"
|
<img loading="lazy" alt="" src="@/assets/header/model_config.png" :style="{
|
||||||
:style="{ filter: $route.path === '/model-config' ? 'brightness(0) invert(1)' : 'None' }" />
|
filter:
|
||||||
<span class="nav-text">{{ $t('header.modelConfig') }}</span>
|
$route.path === '/model-config' ? 'brightness(0) invert(1)' : 'None',
|
||||||
|
}" />
|
||||||
|
<span class="nav-text">{{ $t("header.modelConfig") }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isSuperAdmin" class="equipment-management"
|
<div class="equipment-management"
|
||||||
:class="{ 'active-tab': $route.path === '/user-management' }" @click="goUserManagement">
|
:class="{ 'active-tab': $route.path === '/knowledge-base-management' || $route.path === '/knowledge-file-upload' }"
|
||||||
<img loading="lazy" alt="" src="@/assets/header/user_management.png"
|
@click="goKnowledgeBaseManagement">
|
||||||
:style="{ filter: $route.path === '/user-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
<img loading="lazy" alt="" src="@/assets/header/knowledge_base.png" :style="{
|
||||||
<span class="nav-text">{{ $t('header.userManagement') }}</span>
|
filter:
|
||||||
|
$route.path === '/knowledge-base-management' || $route.path === '/knowledge-file-upload' ? 'brightness(0) invert(1)' : 'None',
|
||||||
|
}" />
|
||||||
|
<span class="nav-text">{{ $t("header.knowledgeBase") }}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-dropdown v-if="isSuperAdmin" trigger="click" class="equipment-management more-dropdown"
|
<el-dropdown v-if="isSuperAdmin" trigger="click" class="equipment-management more-dropdown" :class="{
|
||||||
:class="{ 'active-tab': $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' || $route.path === '/agent-template-management' || $route.path === '/ota-management' }"
|
'active-tab':
|
||||||
@visible-change="handleParamDropdownVisibleChange">
|
$route.path === '/dict-management' ||
|
||||||
|
$route.path === '/params-management' ||
|
||||||
|
$route.path === '/provider-management' ||
|
||||||
|
$route.path === '/server-side-management' ||
|
||||||
|
$route.path === '/agent-template-management' ||
|
||||||
|
$route.path === '/ota-management' ||
|
||||||
|
$route.path === '/user-management',
|
||||||
|
}" @visible-change="handleParamDropdownVisibleChange">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
<img loading="lazy" alt="" src="@/assets/header/param_management.png"
|
<img loading="lazy" alt="" src="@/assets/header/param_management.png" :style="{
|
||||||
:style="{ filter: $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' || $route.path === '/agent-template-management' || $route.path === '/ota-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
filter:
|
||||||
<span class="nav-text">{{ $t('header.paramDictionary') }}</span>
|
$route.path === '/dict-management' ||
|
||||||
|
$route.path === '/params-management' ||
|
||||||
|
$route.path === '/provider-management' ||
|
||||||
|
$route.path === '/server-side-management' ||
|
||||||
|
$route.path === '/agent-template-management' ||
|
||||||
|
$route.path === '/ota-management' ||
|
||||||
|
$route.path === '/user-management'
|
||||||
|
? 'brightness(0) invert(1)'
|
||||||
|
: 'None',
|
||||||
|
}" />
|
||||||
|
<span class="nav-text">{{ $t("header.paramDictionary") }}</span>
|
||||||
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': paramDropdownVisible }"></i>
|
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': paramDropdownVisible }"></i>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item @click.native="goOtaManagement">
|
|
||||||
{{ $t('header.otaManagement') }}
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item @click.native="goParamManagement">
|
<el-dropdown-item @click.native="goParamManagement">
|
||||||
{{ $t('header.paramManagement') }}
|
{{ $t("header.paramManagement") }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click.native="goUserManagement">
|
||||||
|
{{ $t("header.userManagement") }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click.native="goOtaManagement">
|
||||||
|
{{ $t("header.otaManagement") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click.native="goDictManagement">
|
<el-dropdown-item @click.native="goDictManagement">
|
||||||
{{ $t('header.dictManagement') }}
|
{{ $t("header.dictManagement") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click.native="goProviderManagement">
|
<el-dropdown-item @click.native="goProviderManagement">
|
||||||
{{ $t('header.providerManagement') }}
|
{{ $t("header.providerManagement") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click.native="goAgentTemplateManagement">
|
<el-dropdown-item @click.native="goAgentTemplateManagement">
|
||||||
{{ $t('header.agentTemplate') }}
|
{{ $t("header.agentTemplate") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click.native="goServerSideManagement">
|
<el-dropdown-item @click.native="goServerSideManagement">
|
||||||
{{ $t('header.serverSideManagement') }}
|
{{ $t("header.serverSideManagement") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
@ -100,9 +145,9 @@
|
||||||
<!-- 搜索历史下拉框 -->
|
<!-- 搜索历史下拉框 -->
|
||||||
<div v-if="showHistory && searchHistory.length > 0" class="search-history-dropdown">
|
<div v-if="showHistory && searchHistory.length > 0" class="search-history-dropdown">
|
||||||
<div class="search-history-header">
|
<div class="search-history-header">
|
||||||
<span>{{ $t('header.searchHistory') }}</span>
|
<span>{{ $t("header.searchHistory") }}</span>
|
||||||
<el-button type="text" size="small" class="clear-history-btn" @click="clearSearchHistory">
|
<el-button type="text" size="small" class="clear-history-btn" @click="clearSearchHistory">
|
||||||
{{ $t('header.clearHistory') }}
|
{{ $t("header.clearHistory") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-history-list">
|
<div class="search-history-list">
|
||||||
|
|
@ -118,12 +163,12 @@
|
||||||
|
|
||||||
<img loading="lazy" alt="" src="@/assets/home/avatar.png" class="avatar-img" @click="handleAvatarClick" />
|
<img loading="lazy" alt="" src="@/assets/home/avatar.png" class="avatar-img" @click="handleAvatarClick" />
|
||||||
<span class="el-dropdown-link" @click="handleAvatarClick">
|
<span class="el-dropdown-link" @click="handleAvatarClick">
|
||||||
{{ userInfo.username || '加载中...' }}
|
{{ userInfo.username || "加载中..." }}
|
||||||
<i class="el-icon-arrow-down el-icon--right"></i>
|
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': userMenuVisible }"></i>
|
||||||
</span>
|
</span>
|
||||||
<el-cascader :options="userMenuOptions" trigger="click" :props="cascaderProps"
|
<el-cascader :options="userMenuOptions" trigger="click" :props="cascaderProps"
|
||||||
style="width: 0px;overflow: hidden;" :show-all-levels="false" @change="handleCascaderChange"
|
style="width: 0px; overflow: hidden" :show-all-levels="false" @change="handleCascaderChange"
|
||||||
ref="userCascader">
|
@visible-change="handleUserMenuVisibleChange" ref="userCascader">
|
||||||
<template slot-scope="{ data }">
|
<template slot-scope="{ data }">
|
||||||
<span>{{ data.label }}</span>
|
<span>{{ data.label }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -137,63 +182,64 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import userApi from '@/apis/module/user';
|
import userApi from "@/apis/module/user";
|
||||||
import i18n, { changeLanguage } from '@/i18n';
|
import i18n, { changeLanguage } from "@/i18n";
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { mapActions, mapGetters } from "vuex";
|
||||||
import ChangePasswordDialog from './ChangePasswordDialog.vue'; // 引入修改密码弹窗组件
|
import ChangePasswordDialog from "./ChangePasswordDialog.vue"; // 引入修改密码弹窗组件
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HeaderBar',
|
name: "HeaderBar",
|
||||||
components: {
|
components: {
|
||||||
ChangePasswordDialog
|
ChangePasswordDialog,
|
||||||
},
|
},
|
||||||
props: ['devices'], // 接收父组件设备列表
|
props: ["devices"], // 接收父组件设备列表
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
search: '',
|
search: "",
|
||||||
userInfo: {
|
userInfo: {
|
||||||
username: '',
|
username: "",
|
||||||
mobile: ''
|
mobile: "",
|
||||||
},
|
},
|
||||||
isChangePasswordDialogVisible: false, // 控制修改密码弹窗的显示
|
isChangePasswordDialogVisible: false, // 控制修改密码弹窗的显示
|
||||||
paramDropdownVisible: false,
|
paramDropdownVisible: false,
|
||||||
voiceCloneDropdownVisible: false,
|
voiceCloneDropdownVisible: false,
|
||||||
|
userMenuVisible: false, // 添加用户菜单可见状态
|
||||||
isSmallScreen: false,
|
isSmallScreen: false,
|
||||||
// 搜索历史相关
|
// 搜索历史相关
|
||||||
searchHistory: [],
|
searchHistory: [],
|
||||||
showHistory: false,
|
showHistory: false,
|
||||||
SEARCH_HISTORY_KEY: 'xiaozhi_search_history',
|
SEARCH_HISTORY_KEY: "xiaozhi_search_history",
|
||||||
MAX_HISTORY_COUNT: 3,
|
MAX_HISTORY_COUNT: 3,
|
||||||
// Cascader 配置
|
// Cascader 配置
|
||||||
cascaderProps: {
|
cascaderProps: {
|
||||||
expandTrigger: 'click',
|
expandTrigger: "click",
|
||||||
value: 'value',
|
value: "value",
|
||||||
label: 'label',
|
label: "label",
|
||||||
children: 'children'
|
children: "children",
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['getIsSuperAdmin']),
|
...mapGetters(["getIsSuperAdmin"]),
|
||||||
isSuperAdmin() {
|
isSuperAdmin() {
|
||||||
return this.getIsSuperAdmin;
|
return this.getIsSuperAdmin;
|
||||||
},
|
},
|
||||||
// 获取当前语言
|
// 获取当前语言
|
||||||
currentLanguage() {
|
currentLanguage() {
|
||||||
return i18n.locale || 'zh_CN';
|
return i18n.locale || "zh_CN";
|
||||||
},
|
},
|
||||||
// 获取当前语言显示文本
|
// 获取当前语言显示文本
|
||||||
currentLanguageText() {
|
currentLanguageText() {
|
||||||
const currentLang = this.currentLanguage;
|
const currentLang = this.currentLanguage;
|
||||||
switch (currentLang) {
|
switch (currentLang) {
|
||||||
case 'zh_CN':
|
case "zh_CN":
|
||||||
return this.$t('language.zhCN');
|
return this.$t("language.zhCN");
|
||||||
case 'zh_TW':
|
case "zh_TW":
|
||||||
return this.$t('language.zhTW');
|
return this.$t("language.zhTW");
|
||||||
case 'en':
|
case "en":
|
||||||
return this.$t('language.en');
|
return this.$t("language.en");
|
||||||
default:
|
default:
|
||||||
return this.$t('language.zhCN');
|
return this.$t("language.zhCN");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 用户菜单选项
|
// 用户菜单选项
|
||||||
|
|
@ -201,90 +247,93 @@ export default {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: this.currentLanguageText,
|
label: this.currentLanguageText,
|
||||||
value: 'language',
|
value: "language",
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
label: this.$t('language.zhCN'),
|
label: this.$t("language.zhCN"),
|
||||||
value: 'zh_CN'
|
value: "zh_CN",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.$t('language.zhTW'),
|
label: this.$t("language.zhTW"),
|
||||||
value: 'zh_TW'
|
value: "zh_TW",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.$t('language.en'),
|
label: this.$t("language.en"),
|
||||||
value: 'en'
|
value: "en",
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.$t('header.changePassword'),
|
label: this.$t("header.changePassword"),
|
||||||
value: 'changePassword'
|
value: "changePassword",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.$t('header.logout'),
|
label: this.$t("header.logout"),
|
||||||
value: 'logout'
|
value: "logout",
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchUserInfo();
|
this.fetchUserInfo();
|
||||||
this.checkScreenSize();
|
this.checkScreenSize();
|
||||||
window.addEventListener('resize', this.checkScreenSize);
|
window.addEventListener("resize", this.checkScreenSize);
|
||||||
// 从localStorage加载搜索历史
|
// 从localStorage加载搜索历史
|
||||||
this.loadSearchHistory();
|
this.loadSearchHistory();
|
||||||
},
|
},
|
||||||
//移除事件监听器
|
//移除事件监听器
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
window.removeEventListener('resize', this.checkScreenSize);
|
window.removeEventListener("resize", this.checkScreenSize);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goHome() {
|
goHome() {
|
||||||
// 跳转到首页
|
// 跳转到首页
|
||||||
this.$router.push('/home')
|
this.$router.push("/home");
|
||||||
},
|
},
|
||||||
goUserManagement() {
|
goUserManagement() {
|
||||||
this.$router.push('/user-management')
|
this.$router.push("/user-management");
|
||||||
},
|
},
|
||||||
goModelConfig() {
|
goModelConfig() {
|
||||||
this.$router.push('/model-config')
|
this.$router.push("/model-config");
|
||||||
|
},
|
||||||
|
goKnowledgeBaseManagement() {
|
||||||
|
this.$router.push("/knowledge-base-management");
|
||||||
},
|
},
|
||||||
goVoiceCloneManagement() {
|
goVoiceCloneManagement() {
|
||||||
this.$router.push('/voice-clone-management')
|
this.$router.push("/voice-clone-management");
|
||||||
},
|
},
|
||||||
goParamManagement() {
|
goParamManagement() {
|
||||||
this.$router.push('/params-management')
|
this.$router.push("/params-management");
|
||||||
},
|
},
|
||||||
goOtaManagement() {
|
goOtaManagement() {
|
||||||
this.$router.push('/ota-management')
|
this.$router.push("/ota-management");
|
||||||
},
|
},
|
||||||
goDictManagement() {
|
goDictManagement() {
|
||||||
this.$router.push('/dict-management')
|
this.$router.push("/dict-management");
|
||||||
},
|
},
|
||||||
goProviderManagement() {
|
goProviderManagement() {
|
||||||
this.$router.push('/provider-management')
|
this.$router.push("/provider-management");
|
||||||
},
|
},
|
||||||
goServerSideManagement() {
|
goServerSideManagement() {
|
||||||
this.$router.push('/server-side-management')
|
this.$router.push("/server-side-management");
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到音色资源管理
|
// 跳转到音色资源管理
|
||||||
goVoiceResourceManagement() {
|
goVoiceResourceManagement() {
|
||||||
this.$router.push('/voice-resource-management')
|
this.$router.push("/voice-resource-management");
|
||||||
},
|
},
|
||||||
// 添加默认角色模板管理导航方法
|
// 添加默认角色模板管理导航方法
|
||||||
goAgentTemplateManagement() {
|
goAgentTemplateManagement() {
|
||||||
this.$router.push('/agent-template-management')
|
this.$router.push("/agent-template-management");
|
||||||
},
|
},
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
fetchUserInfo() {
|
fetchUserInfo() {
|
||||||
userApi.getUserInfo(({ data }) => {
|
userApi.getUserInfo(({ data }) => {
|
||||||
this.userInfo = data.data
|
this.userInfo = data.data;
|
||||||
if (data.data.superAdmin !== undefined) {
|
if (data.data.superAdmin !== undefined) {
|
||||||
this.$store.commit('setUserInfo', data.data);
|
this.$store.commit("setUserInfo", data.data);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
checkScreenSize() {
|
checkScreenSize() {
|
||||||
this.isSmallScreen = window.innerWidth <= 1386;
|
this.isSmallScreen = window.innerWidth <= 1386;
|
||||||
|
|
@ -295,7 +344,7 @@ export default {
|
||||||
|
|
||||||
// 如果搜索内容为空,触发重置事件
|
// 如果搜索内容为空,触发重置事件
|
||||||
if (!searchValue) {
|
if (!searchValue) {
|
||||||
this.$emit('search-reset');
|
this.$emit("search-reset");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -304,14 +353,14 @@ export default {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 创建不区分大小写的正则表达式
|
// 创建不区分大小写的正则表达式
|
||||||
const regex = new RegExp(searchValue, 'i');
|
const regex = new RegExp(searchValue, "i");
|
||||||
// 触发搜索事件,将正则表达式传递给父组件
|
// 触发搜索事件,将正则表达式传递给父组件
|
||||||
this.$emit('search', regex);
|
this.$emit("search", regex);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('正则表达式创建失败:', error);
|
console.error("正则表达式创建失败:", error);
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: this.$t('message.error'),
|
message: this.$t("message.error"),
|
||||||
showClose: true
|
showClose: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,7 +391,7 @@ export default {
|
||||||
this.searchHistory = JSON.parse(history);
|
this.searchHistory = JSON.parse(history);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载搜索历史失败:', error);
|
console.error("加载搜索历史失败:", error);
|
||||||
this.searchHistory = [];
|
this.searchHistory = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -365,7 +414,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistory));
|
localStorage.setItem(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistory));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('保存搜索历史失败:', error);
|
console.error("保存搜索历史失败:", error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -381,7 +430,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistory));
|
localStorage.setItem(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistory));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('更新搜索历史失败:', error);
|
console.error("更新搜索历史失败:", error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -391,12 +440,14 @@ export default {
|
||||||
try {
|
try {
|
||||||
localStorage.removeItem(this.SEARCH_HISTORY_KEY);
|
localStorage.removeItem(this.SEARCH_HISTORY_KEY);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('清空搜索历史失败:', error);
|
console.error("清空搜索历史失败:", error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 显示修改密码弹窗
|
// 显示修改密码弹窗
|
||||||
showChangePasswordDialog() {
|
showChangePasswordDialog() {
|
||||||
this.isChangePasswordDialogVisible = true;
|
this.isChangePasswordDialogVisible = true;
|
||||||
|
// 添加:显示修改密码弹窗后重置用户菜单可见状态
|
||||||
|
this.userMenuVisible = false;
|
||||||
},
|
},
|
||||||
// 退出登录
|
// 退出登录
|
||||||
async handleLogout() {
|
async handleLogout() {
|
||||||
|
|
@ -404,14 +455,14 @@ export default {
|
||||||
// 调用 Vuex 的 logout action
|
// 调用 Vuex 的 logout action
|
||||||
await this.logout();
|
await this.logout();
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: this.$t('message.success'),
|
message: this.$t("message.success"),
|
||||||
showClose: true
|
showClose: true,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('退出登录失败:', error);
|
console.error("退出登录失败:", error);
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: this.$t('message.error'),
|
message: this.$t("message.error"),
|
||||||
showClose: true
|
showClose: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -424,6 +475,7 @@ export default {
|
||||||
handleVoiceCloneDropdownVisibleChange(visible) {
|
handleVoiceCloneDropdownVisibleChange(visible) {
|
||||||
this.voiceCloneDropdownVisible = visible;
|
this.voiceCloneDropdownVisible = visible;
|
||||||
},
|
},
|
||||||
|
// 在data中添加一个key用于强制重新渲染组件
|
||||||
// 处理 Cascader 选择变化
|
// 处理 Cascader 选择变化
|
||||||
handleCascaderChange(value) {
|
handleCascaderChange(value) {
|
||||||
if (!value || value.length === 0) {
|
if (!value || value.length === 0) {
|
||||||
|
|
@ -433,41 +485,117 @@ export default {
|
||||||
const action = value[value.length - 1];
|
const action = value[value.length - 1];
|
||||||
|
|
||||||
// 处理语言切换
|
// 处理语言切换
|
||||||
if (value.length === 2 && value[0] === 'language') {
|
if (value.length === 2 && value[0] === "language") {
|
||||||
this.changeLanguage(action);
|
this.changeLanguage(action);
|
||||||
return;
|
} else {
|
||||||
|
// 处理其他操作
|
||||||
|
switch (action) {
|
||||||
|
case "changePassword":
|
||||||
|
this.showChangePasswordDialog();
|
||||||
|
break;
|
||||||
|
case "logout":
|
||||||
|
this.handleLogout();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理其他操作
|
// 操作完成后立即清空选择
|
||||||
switch (action) {
|
setTimeout(() => {
|
||||||
case 'changePassword':
|
this.completeResetCascader();
|
||||||
this.showChangePasswordDialog();
|
}, 300);
|
||||||
break;
|
|
||||||
case 'logout':
|
|
||||||
this.handleLogout();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 切换语言
|
// 切换语言
|
||||||
changeLanguage(lang) {
|
changeLanguage(lang) {
|
||||||
changeLanguage(lang);
|
changeLanguage(lang);
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: this.$t('message.success'),
|
message: this.$t("message.success"),
|
||||||
showClose: true
|
showClose: true,
|
||||||
});
|
});
|
||||||
|
// 添加:切换语言后重置用户菜单可见状态
|
||||||
|
this.userMenuVisible = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 完全重置级联选择器
|
||||||
|
completeResetCascader() {
|
||||||
|
if (this.$refs.userCascader) {
|
||||||
|
try {
|
||||||
|
// 尝试所有可能的方法来清空选择
|
||||||
|
// 1. 尝试使用组件提供的clearValue方法
|
||||||
|
if (this.$refs.userCascader.clearValue) {
|
||||||
|
this.$refs.userCascader.clearValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 直接清空内部属性
|
||||||
|
if (this.$refs.userCascader.$data) {
|
||||||
|
this.$refs.userCascader.$data.selectedPaths = [];
|
||||||
|
this.$refs.userCascader.$data.displayLabels = [];
|
||||||
|
this.$refs.userCascader.$data.inputValue = "";
|
||||||
|
this.$refs.userCascader.$data.checkedValue = [];
|
||||||
|
this.$refs.userCascader.$data.showAllLevels = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 操作DOM清除选中状态
|
||||||
|
const menuElement = this.$refs.userCascader.$refs.menu;
|
||||||
|
if (menuElement && menuElement.$el) {
|
||||||
|
const activeItems = menuElement.$el.querySelectorAll(
|
||||||
|
".el-cascader-node.is-active"
|
||||||
|
);
|
||||||
|
activeItems.forEach((item) => item.classList.remove("is-active"));
|
||||||
|
|
||||||
|
const checkedItems = menuElement.$el.querySelectorAll(
|
||||||
|
".el-cascader-node.is-checked"
|
||||||
|
);
|
||||||
|
checkedItems.forEach((item) => item.classList.remove("is-checked"));
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Cascader values cleared");
|
||||||
|
} catch (error) {
|
||||||
|
console.error("清空选择值失败:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 点击头像触发cascader下拉菜单
|
// 点击头像触发cascader下拉菜单
|
||||||
handleAvatarClick() {
|
handleAvatarClick() {
|
||||||
if (this.$refs.userCascader) {
|
if (this.$refs.userCascader) {
|
||||||
this.$refs.userCascader.toggleDropDownVisible();
|
// 切换菜单可见状态
|
||||||
|
this.userMenuVisible = !this.userMenuVisible;
|
||||||
|
|
||||||
|
// 菜单收起时清空选择值
|
||||||
|
if (!this.userMenuVisible) {
|
||||||
|
this.completeResetCascader();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接设置菜单的显隐状态
|
||||||
|
try {
|
||||||
|
// 尝试使用toggleDropDownVisible方法
|
||||||
|
this.$refs.userCascader.toggleDropDownVisible(this.userMenuVisible);
|
||||||
|
} catch (error) {
|
||||||
|
// 如果toggle方法失败,尝试直接设置属性
|
||||||
|
if (this.$refs.userCascader.$refs.menu) {
|
||||||
|
this.$refs.userCascader.$refs.menu.showMenu(this.userMenuVisible);
|
||||||
|
} else {
|
||||||
|
console.error("Cannot access menu component");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理用户菜单可见性变化
|
||||||
|
handleUserMenuVisibleChange(visible) {
|
||||||
|
this.userMenuVisible = visible;
|
||||||
|
|
||||||
|
// 如果菜单关闭了,也要清空选择值
|
||||||
|
if (!visible) {
|
||||||
|
this.completeResetCascader();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 使用 mapActions 引入 Vuex 的 logout action
|
// 使用 mapActions 引入 Vuex 的 logout action
|
||||||
...mapActions(['logout'])
|
...mapActions(["logout"]),
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
@ -627,7 +755,6 @@ export default {
|
||||||
gap: 7px;
|
gap: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.search-history-item:hover .clear-item-icon {
|
.search-history-item:hover .clear-item-icon {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
@ -706,4 +833,14 @@ export default {
|
||||||
color: #606266;
|
color: #606266;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 添加倒三角旋转样式 */
|
||||||
|
.rotate-down {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-icon-arrow-down {
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
243
main/manager-web/src/components/KnowledgeBaseDialog.vue
Normal file
|
|
@ -0,0 +1,243 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible="dialogVisible" width="600px" class="knowledge-base-dialog" @close="handleClose">
|
||||||
|
<el-form ref="knowledgeBaseForm" :model="form" :rules="rules" label-width="100px" size="medium">
|
||||||
|
<el-form-item :label="$t('knowledgeBaseDialog.name')" prop="name">
|
||||||
|
<el-input v-model="form.name" :placeholder="$t('knowledgeBaseDialog.namePlaceholder')" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('knowledgeBaseDialog.description')" prop="description">
|
||||||
|
<el-input v-model="form.description" :placeholder="$t('knowledgeBaseDialog.descriptionPlaceholder')"
|
||||||
|
type="textarea" :rows="4" maxlength="300" show-word-limit></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('knowledgeBaseDialog.ragModel')" prop="ragModelId">
|
||||||
|
<el-select v-model="form.ragModelId" :placeholder="$t('knowledgeBaseDialog.ragModelPlaceholder')" clearable
|
||||||
|
filterable style="width: 100%" @focus="loadRAGModels">
|
||||||
|
<el-option v-for="model in ragModels" :key="model.id" :label="model.modelName" :value="model.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="handleClose">{{ $t('knowledgeBaseDialog.cancel') }}</el-button>
|
||||||
|
<el-button type="primary" @click="handleSubmit">{{ $t('knowledgeBaseDialog.confirm') }}</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Api from "@/apis/api";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "KnowledgeBaseDialog",
|
||||||
|
props: {
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: ""
|
||||||
|
},
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
id: null,
|
||||||
|
datasetId: null,
|
||||||
|
ragModelId: null,
|
||||||
|
name: "",
|
||||||
|
description: ""
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: this.visible,
|
||||||
|
ragModels: [],
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: this.$t("knowledgeBaseDialog.nameRequired"),
|
||||||
|
trigger: "blur"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
min: 1,
|
||||||
|
max: 50,
|
||||||
|
message: this.$t("knowledgeBaseDialog.nameLength"),
|
||||||
|
trigger: "blur"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: /^[\u4e00-\u9fa5a-zA-Z0-9\s-_]+$/,
|
||||||
|
message: this.$t("knowledgeBaseDialog.namePattern"),
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
description: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: this.$t("knowledgeBaseDialog.descriptionRequired"),
|
||||||
|
trigger: "blur"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
max: 300,
|
||||||
|
message: this.$t("knowledgeBaseDialog.descriptionLength"),
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
ragModelId: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: this.$t("knowledgeBaseDialog.ragModelRequired"),
|
||||||
|
trigger: "change"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
visible(val) {
|
||||||
|
this.dialogVisible = val;
|
||||||
|
if (val) {
|
||||||
|
// 对话框显示时加载RAG模型列表
|
||||||
|
this.loadRAGModels();
|
||||||
|
|
||||||
|
// 如果是新增知识库且没有设置ragModelId,则默认选择第一个RAG模型
|
||||||
|
if (!this.form.id && !this.form.ragModelId && this.ragModels.length > 0) {
|
||||||
|
this.$set(this.form, 'ragModelId', this.ragModels[0].id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.$refs.knowledgeBaseForm) {
|
||||||
|
this.$refs.knowledgeBaseForm.clearValidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 监听RAG模型列表变化,确保新增时能正确设置默认值
|
||||||
|
ragModels(newModels) {
|
||||||
|
if (newModels.length > 0) {
|
||||||
|
// 如果是新增知识库且没有设置ragModelId,则默认选择第一个RAG模型
|
||||||
|
if (!this.form.id && !this.form.ragModelId) {
|
||||||
|
this.$set(this.form, 'ragModelId', newModels[0].id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClose() {
|
||||||
|
// 不重置表单字段,以便在编辑时能保留之前的选择
|
||||||
|
// 只在对话框关闭时重置验证状态
|
||||||
|
if (this.$refs.knowledgeBaseForm) {
|
||||||
|
this.$refs.knowledgeBaseForm.clearValidate();
|
||||||
|
}
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$emit("update:visible", false);
|
||||||
|
},
|
||||||
|
handleSubmit() {
|
||||||
|
console.log('KnowledgeBaseDialog handleSubmit called');
|
||||||
|
this.$refs.knowledgeBaseForm.validate(valid => {
|
||||||
|
console.log('Form validation result:', valid);
|
||||||
|
if (valid) {
|
||||||
|
console.log('Emitting submit event with form:', this.form);
|
||||||
|
this.$emit("submit", {
|
||||||
|
...this.form
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
loadRAGModels() {
|
||||||
|
if (this.ragModels.length > 0) {
|
||||||
|
return; // 已经加载过,避免重复加载
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('开始加载RAG模型列表');
|
||||||
|
Api.model.getRAGModels((res) => {
|
||||||
|
console.log('RAG模型列表响应:', res);
|
||||||
|
if (res.data && res.data.code === 0) {
|
||||||
|
this.ragModels = res.data.data || [];
|
||||||
|
console.log('RAG模型列表加载成功,共', this.ragModels.length, '个模型');
|
||||||
|
|
||||||
|
// 如果是新增知识库且没有设置ragModelId,则默认选择第一个RAG模型
|
||||||
|
if (!this.form.id && !this.form.ragModelId && this.ragModels.length > 0) {
|
||||||
|
this.$set(this.form, 'ragModelId', this.ragModels[0].id);
|
||||||
|
console.log('已设置默认RAG模型:', this.ragModels[0].id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error('获取RAG模型列表失败:', res.data?.msg);
|
||||||
|
this.$message.error(this.$t('knowledgeBaseDialog.loadRAGModelsFailed'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.knowledge-base-dialog {
|
||||||
|
::v-deep .el-dialog {
|
||||||
|
border-radius: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-dialog__body {
|
||||||
|
padding: 20px 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-form-item {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-form-item__label {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #34495e;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-input {
|
||||||
|
.el-input__inner {
|
||||||
|
height: 36px;
|
||||||
|
font-size: 14px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
border-color: #5f70f3;
|
||||||
|
box-shadow: 0 0 0 2px rgba(95, 112, 243, 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-textarea {
|
||||||
|
.el-textarea__inner {
|
||||||
|
font-size: 14px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
border-color: #5f70f3;
|
||||||
|
box-shadow: 0 0 0 2px rgba(95, 112, 243, 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-select {
|
||||||
|
.el-input__inner {
|
||||||
|
height: 36px;
|
||||||
|
font-size: 14px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
border-color: #5f70f3;
|
||||||
|
box-shadow: 0 0 0 2px rgba(95, 112, 243, 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -88,6 +88,7 @@
|
||||||
<el-option :label="$t('providerDialog.booleanType')" value="boolean"></el-option>
|
<el-option :label="$t('providerDialog.booleanType')" value="boolean"></el-option>
|
||||||
<el-option :label="$t('providerDialog.dictType')" value="dict"></el-option>
|
<el-option :label="$t('providerDialog.dictType')" value="dict"></el-option>
|
||||||
<el-option :label="$t('providerDialog.arrayType')" value="array"></el-option>
|
<el-option :label="$t('providerDialog.arrayType')" value="array"></el-option>
|
||||||
|
<el-option :label="$t('providerDialog.ragType')" value="RAG"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
@ -165,7 +166,8 @@ export default {
|
||||||
'number': this.$t('providerDialog.numberType'),
|
'number': this.$t('providerDialog.numberType'),
|
||||||
'boolean': this.$t('providerDialog.booleanType'),
|
'boolean': this.$t('providerDialog.booleanType'),
|
||||||
'dict': this.$t('providerDialog.dictType'),
|
'dict': this.$t('providerDialog.dictType'),
|
||||||
'array': this.$t('providerDialog.arrayType')
|
'array': this.$t('providerDialog.arrayType'),
|
||||||
|
'RAG': this.$t('providerDialog.ragType')
|
||||||
};
|
};
|
||||||
return typeMap[type];
|
return typeMap[type];
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ export default {
|
||||||
// HeaderBar组件文本
|
// HeaderBar组件文本
|
||||||
'header.smartManagement': 'Agents',
|
'header.smartManagement': 'Agents',
|
||||||
'header.modelConfig': 'Models',
|
'header.modelConfig': 'Models',
|
||||||
|
'header.knowledgeBase': 'Knowledge',
|
||||||
'header.voiceCloneManagement': 'Voice Clone',
|
'header.voiceCloneManagement': 'Voice Clone',
|
||||||
'header.voiceResourceManagement': 'Voice Resource',
|
'header.voiceResourceManagement': 'Voice Resource',
|
||||||
'header.userManagement': 'Users',
|
'header.userManagement': 'Users',
|
||||||
|
|
@ -19,6 +20,11 @@ export default {
|
||||||
'header.agentTemplate': 'Default Role Templates', // 添加这一行
|
'header.agentTemplate': 'Default Role Templates', // 添加这一行
|
||||||
'header.searchHistory': 'Search History',
|
'header.searchHistory': 'Search History',
|
||||||
'header.clearHistory': 'Clear History',
|
'header.clearHistory': 'Clear History',
|
||||||
|
'header.providerManagement': 'Provider Management',
|
||||||
|
'header.serverSideManagement': 'Server Management',
|
||||||
|
'header.changePassword': 'Change Password',
|
||||||
|
'header.logout': 'Logout',
|
||||||
|
'header.searchPlaceholder': 'Search by name..',
|
||||||
|
|
||||||
// McpToolCallDialog component text
|
// McpToolCallDialog component text
|
||||||
'mcpToolCall.title': 'Tool Call',
|
'mcpToolCall.title': 'Tool Call',
|
||||||
|
|
@ -191,6 +197,23 @@ export default {
|
||||||
'firmwareDialog.firmwareNamePlaceholder': 'Please enter firmware name (board + version)',
|
'firmwareDialog.firmwareNamePlaceholder': 'Please enter firmware name (board + version)',
|
||||||
'firmwareDialog.firmwareType': 'Firmware Type',
|
'firmwareDialog.firmwareType': 'Firmware Type',
|
||||||
'firmwareDialog.firmwareTypePlaceholder': 'Please select firmware type',
|
'firmwareDialog.firmwareTypePlaceholder': 'Please select firmware type',
|
||||||
|
'firmwareDialog.version': 'Version',
|
||||||
|
'firmwareDialog.versionPlaceholder': 'Please enter version (x.x.x format)',
|
||||||
|
'firmwareDialog.firmwareFile': 'Firmware File',
|
||||||
|
'firmwareDialog.clickUpload': 'Click to Upload',
|
||||||
|
'firmwareDialog.uploadTip': 'Only firmware files (.bin/.apk) are supported, and size should not exceed 100MB',
|
||||||
|
'firmwareDialog.uploadHint': 'Warm reminder: Please upload the pre-merged xiaozhi.bin file, not the merged merged-binary.bin file',
|
||||||
|
'firmwareDialog.remark': 'Remark',
|
||||||
|
'firmwareDialog.remarkPlaceholder': 'Please enter remark information',
|
||||||
|
'firmwareDialog.requiredFirmwareName': 'Please enter firmware name (board + version)',
|
||||||
|
'firmwareDialog.requiredFirmwareType': 'Please select firmware type',
|
||||||
|
'firmwareDialog.requiredVersion': 'Please enter version',
|
||||||
|
'firmwareDialog.versionFormatError': 'Version format is incorrect, please enter x.x.x format',
|
||||||
|
'firmwareDialog.requiredFirmwareFile': 'Please upload firmware file',
|
||||||
|
'firmwareDialog.invalidFileType': 'Only .bin/.apk format firmware files are supported!',
|
||||||
|
'firmwareDialog.invalidFileSize': 'Firmware file size cannot exceed 100MB!',
|
||||||
|
'firmwareDialog.uploadSuccess': 'Firmware file uploaded successfully',
|
||||||
|
'firmwareDialog.uploadFailed': 'File upload failed',
|
||||||
|
|
||||||
// Voice print dialog related
|
// Voice print dialog related
|
||||||
'voicePrintDialog.addSpeaker': 'Add Speaker',
|
'voicePrintDialog.addSpeaker': 'Add Speaker',
|
||||||
|
|
@ -232,6 +255,21 @@ export default {
|
||||||
|
|
||||||
// Manual add device dialog related
|
// Manual add device dialog related
|
||||||
'manualAddDeviceDialog.title': 'Manual Add Device',
|
'manualAddDeviceDialog.title': 'Manual Add Device',
|
||||||
|
'manualAddDeviceDialog.deviceType': 'Device Type',
|
||||||
|
'manualAddDeviceDialog.deviceTypePlaceholder': 'Please select device type',
|
||||||
|
'manualAddDeviceDialog.firmwareVersion': 'Firmware Version',
|
||||||
|
'manualAddDeviceDialog.firmwareVersionPlaceholder': 'Please enter firmware version',
|
||||||
|
'manualAddDeviceDialog.macAddress': 'Mac Address',
|
||||||
|
'manualAddDeviceDialog.macAddressPlaceholder': 'Please enter Mac address',
|
||||||
|
'manualAddDeviceDialog.confirm': 'Confirm',
|
||||||
|
'manualAddDeviceDialog.cancel': 'Cancel',
|
||||||
|
'manualAddDeviceDialog.requiredMacAddress': 'Please enter Mac address',
|
||||||
|
'manualAddDeviceDialog.invalidMacAddress': 'Please enter correct Mac address format, e.g.: 00:1A:2B:3C:4D:5E',
|
||||||
|
'manualAddDeviceDialog.requiredDeviceType': 'Please select device type',
|
||||||
|
'manualAddDeviceDialog.requiredFirmwareVersion': 'Please enter firmware version',
|
||||||
|
'manualAddDeviceDialog.getFirmwareTypeFailed': 'Failed to get firmware type',
|
||||||
|
'manualAddDeviceDialog.addSuccess': 'Device added successfully',
|
||||||
|
'manualAddDeviceDialog.addFailed': 'Failed to add',
|
||||||
|
|
||||||
// AddModelDialog component related
|
// AddModelDialog component related
|
||||||
'addModelDialog.requiredSupplier': 'Please select a supplier',
|
'addModelDialog.requiredSupplier': 'Please select a supplier',
|
||||||
|
|
@ -263,16 +301,12 @@ export default {
|
||||||
'register.requiredPassword': 'Password cannot be empty',
|
'register.requiredPassword': 'Password cannot be empty',
|
||||||
'register.requiredCaptcha': 'Captcha cannot be empty',
|
'register.requiredCaptcha': 'Captcha cannot be empty',
|
||||||
'register.requiredMobileCaptcha': 'Please enter SMS verification code',
|
'register.requiredMobileCaptcha': 'Please enter SMS verification code',
|
||||||
|
'register.invalidCaptcha': 'Invalid verification code',
|
||||||
'manualAddDeviceDialog.deviceType': 'Device Type',
|
'register.passwordLength': 'Password length must be between 6-20 characters',
|
||||||
'manualAddDeviceDialog.deviceTypePlaceholder': 'Please select device type',
|
'register.usernameFormat': 'Invalid username format',
|
||||||
'manualAddDeviceDialog.firmwareVersion': 'Firmware Version',
|
'register.confirmPasswordRequired': 'Confirm password cannot be empty',
|
||||||
'manualAddDeviceDialog.firmwareVersionPlaceholder': 'Please enter firmware version',
|
'register.sendCaptcha': 'Get Verification Code',
|
||||||
'manualAddDeviceDialog.macAddress': 'Mac Address',
|
'register.secondsLater': 'seconds later',
|
||||||
'manualAddDeviceDialog.macAddressPlaceholder': 'Please enter Mac address',
|
|
||||||
'manualAddDeviceDialog.confirm': 'Confirm',
|
|
||||||
'manualAddDeviceDialog.cancel': 'Cancel',
|
|
||||||
'manualAddDeviceDialog.requiredMacAddress': 'Please enter Mac address',
|
|
||||||
|
|
||||||
// Parameter dialog related
|
// Parameter dialog related
|
||||||
'paramDialog.paramCode': 'Parameter Code',
|
'paramDialog.paramCode': 'Parameter Code',
|
||||||
|
|
@ -293,34 +327,6 @@ export default {
|
||||||
'paramDialog.booleanType': 'Boolean',
|
'paramDialog.booleanType': 'Boolean',
|
||||||
'paramDialog.arrayType': 'Array',
|
'paramDialog.arrayType': 'Array',
|
||||||
'paramDialog.jsonType': 'JSON Object',
|
'paramDialog.jsonType': 'JSON Object',
|
||||||
'manualAddDeviceDialog.invalidMacAddress': 'Please enter correct Mac address format, e.g.: 00:1A:2B:3C:4D:5E',
|
|
||||||
'manualAddDeviceDialog.requiredDeviceType': 'Please select device type',
|
|
||||||
'manualAddDeviceDialog.requiredFirmwareVersion': 'Please enter firmware version',
|
|
||||||
'manualAddDeviceDialog.getFirmwareTypeFailed': 'Failed to get firmware type',
|
|
||||||
'manualAddDeviceDialog.addSuccess': 'Device added successfully',
|
|
||||||
'manualAddDeviceDialog.addFailed': 'Failed to add',
|
|
||||||
'firmwareDialog.version': 'Version',
|
|
||||||
'firmwareDialog.versionPlaceholder': 'Please enter version (x.x.x format)',
|
|
||||||
'firmwareDialog.firmwareFile': 'Firmware File',
|
|
||||||
'firmwareDialog.clickUpload': 'Click to Upload',
|
|
||||||
'firmwareDialog.uploadTip': 'Only firmware files (.bin/.apk) are supported, and size should not exceed 100MB',
|
|
||||||
'firmwareDialog.uploadHint': 'Warm reminder: Please upload the pre-merged xiaozhi.bin file, not the merged merged-binary.bin file',
|
|
||||||
'firmwareDialog.remark': 'Remark',
|
|
||||||
'firmwareDialog.remarkPlaceholder': 'Please enter remark information',
|
|
||||||
'firmwareDialog.requiredFirmwareName': 'Please enter firmware name (board + version)',
|
|
||||||
'firmwareDialog.requiredFirmwareType': 'Please select firmware type',
|
|
||||||
'firmwareDialog.requiredVersion': 'Please enter version',
|
|
||||||
'firmwareDialog.versionFormatError': 'Version format is incorrect, please enter x.x.x format',
|
|
||||||
'firmwareDialog.requiredFirmwareFile': 'Please upload firmware file',
|
|
||||||
'firmwareDialog.invalidFileType': 'Only .bin/.apk format firmware files are supported!',
|
|
||||||
'firmwareDialog.invalidFileSize': 'Firmware file size cannot exceed 100MB!',
|
|
||||||
'firmwareDialog.uploadSuccess': 'Firmware file uploaded successfully',
|
|
||||||
'firmwareDialog.uploadFailed': 'File upload failed',
|
|
||||||
'header.providerManagement': 'Provider Management',
|
|
||||||
'header.serverSideManagement': 'Server Management',
|
|
||||||
'header.changePassword': 'Change Password',
|
|
||||||
'header.logout': 'Logout',
|
|
||||||
'header.searchPlaceholder': 'Search by name..',
|
|
||||||
|
|
||||||
// Login page text
|
// Login page text
|
||||||
'login.title': 'Login',
|
'login.title': 'Login',
|
||||||
|
|
@ -344,52 +350,6 @@ export default {
|
||||||
'login.privacyPolicy': 'Privacy Policy',
|
'login.privacyPolicy': 'Privacy Policy',
|
||||||
'login.registerAccount': 'Register Account',
|
'login.registerAccount': 'Register Account',
|
||||||
|
|
||||||
// Register page text
|
|
||||||
'register.title': 'Register Account',
|
|
||||||
'register.welcome': 'WELCOME TO REGISTER',
|
|
||||||
'register.username': 'Username',
|
|
||||||
'register.usernamePlaceholder': 'Please enter username',
|
|
||||||
'register.mobile': 'Mobile',
|
|
||||||
'register.mobilePlaceholder': 'Please enter mobile number',
|
|
||||||
'register.password': 'Password',
|
|
||||||
'register.passwordPlaceholder': 'Please enter password',
|
|
||||||
'register.confirmPassword': 'Confirm Password',
|
|
||||||
'register.confirmPasswordPlaceholder': 'Please confirm password',
|
|
||||||
'register.captcha': 'Verification Code',
|
|
||||||
'register.captchaPlaceholder': 'Please enter verification code',
|
|
||||||
'register.mobileCaptcha': 'Mobile Verification Code',
|
|
||||||
'register.mobileCaptchaPlaceholder': 'Please enter mobile verification code',
|
|
||||||
'register.getMobileCaptcha': 'Get Verification Code',
|
|
||||||
'register.registerButton': 'Register',
|
|
||||||
'register.login': 'Login',
|
|
||||||
'register.inputCorrectMobile': 'Please enter correct mobile number',
|
|
||||||
'register.inputCaptcha': 'Please enter captcha',
|
|
||||||
'register.captchaSendSuccess': 'Verification code sent successfully',
|
|
||||||
'register.invalidCaptcha': 'Invalid verification code',
|
|
||||||
'register.passwordsNotMatch': 'Two password entries do not match',
|
|
||||||
'register.passwordLength': 'Password length must be between 6-20 characters',
|
|
||||||
'register.usernameRequired': 'Username cannot be empty',
|
|
||||||
'register.usernameFormat': 'Invalid username format',
|
|
||||||
'register.mobileRequired': 'Mobile number cannot be empty',
|
|
||||||
'register.passwordRequired': 'Password cannot be empty',
|
|
||||||
'register.confirmPasswordRequired': 'Confirm password cannot be empty',
|
|
||||||
'register.goToLogin': 'Already have an account, go to login',
|
|
||||||
'register.agreeTo': 'register implies acceptance of',
|
|
||||||
'register.userAgreement': 'User Agreement',
|
|
||||||
'register.and': 'and',
|
|
||||||
'register.privacyPolicy': 'Privacy Policy',
|
|
||||||
'register.sendCaptcha': 'Get Verification Code',
|
|
||||||
'register.notAllowRegister': 'User registration is not allowed currently',
|
|
||||||
'register.captchaLoadFailed': 'Verification code loading failed, click to refresh',
|
|
||||||
'register.inputCorrectMobile': 'Please enter correct mobile number',
|
|
||||||
'register.inputCaptcha': 'Please enter captcha',
|
|
||||||
'register.captchaSendSuccess': 'Verification code sent successfully',
|
|
||||||
'register.captchaSendFailed': 'Failed to send verification code',
|
|
||||||
'register.registerSuccess': 'Registration successful!',
|
|
||||||
'register.registerFailed': 'Registration failed',
|
|
||||||
'register.passwordsNotMatch': 'The two passwords do not match',
|
|
||||||
'register.secondsLater': 'seconds later',
|
|
||||||
|
|
||||||
// Retrieve password page text
|
// Retrieve password page text
|
||||||
'retrievePassword.title': 'Reset Password',
|
'retrievePassword.title': 'Reset Password',
|
||||||
'retrievePassword.welcome': 'PASSWORD RETRIEVE',
|
'retrievePassword.welcome': 'PASSWORD RETRIEVE',
|
||||||
|
|
@ -507,6 +467,7 @@ export default {
|
||||||
'chatHistory.downloadCurrentSession': 'Download current session chat history',
|
'chatHistory.downloadCurrentSession': 'Download current session chat history',
|
||||||
'chatHistory.downloadCurrentWithPreviousSessions': 'Download current and previous 20 sessions chat history',
|
'chatHistory.downloadCurrentWithPreviousSessions': 'Download current and previous 20 sessions chat history',
|
||||||
'chatHistory.downloadLinkFailed': 'Failed to get download link',
|
'chatHistory.downloadLinkFailed': 'Failed to get download link',
|
||||||
|
|
||||||
'cache.status': 'Cache Status',
|
'cache.status': 'Cache Status',
|
||||||
'cache.cdnEnabled': 'CDN Mode Enabled',
|
'cache.cdnEnabled': 'CDN Mode Enabled',
|
||||||
'cache.cdnDisabled': 'CDN Mode Disabled',
|
'cache.cdnDisabled': 'CDN Mode Disabled',
|
||||||
|
|
@ -672,6 +633,7 @@ export default {
|
||||||
'common.confirm': 'Confirm',
|
'common.confirm': 'Confirm',
|
||||||
'common.cancel': 'Cancel',
|
'common.cancel': 'Cancel',
|
||||||
'common.sensitive': 'Sensitive',
|
'common.sensitive': 'Sensitive',
|
||||||
|
'common.loading': 'Loading',
|
||||||
|
|
||||||
// Language switch
|
// Language switch
|
||||||
'language.zhCN': '中文简体',
|
'language.zhCN': '中文简体',
|
||||||
|
|
@ -833,6 +795,7 @@ export default {
|
||||||
'modelConfig.intent': 'Intent Recognition',
|
'modelConfig.intent': 'Intent Recognition',
|
||||||
'modelConfig.tts': 'Text-to-Speech',
|
'modelConfig.tts': 'Text-to-Speech',
|
||||||
'modelConfig.memory': 'Memory',
|
'modelConfig.memory': 'Memory',
|
||||||
|
'modelConfig.rag': 'RAG',
|
||||||
'modelConfig.modelId': 'Model ID',
|
'modelConfig.modelId': 'Model ID',
|
||||||
'modelConfig.modelName': 'Model Name',
|
'modelConfig.modelName': 'Model Name',
|
||||||
'modelConfig.provider': 'Provider',
|
'modelConfig.provider': 'Provider',
|
||||||
|
|
@ -855,6 +818,7 @@ export default {
|
||||||
'modelConfig.partialDeleteFailed': 'Partial deletion failed',
|
'modelConfig.partialDeleteFailed': 'Partial deletion failed',
|
||||||
'modelConfig.deleteSuccess': 'Deletion successful',
|
'modelConfig.deleteSuccess': 'Deletion successful',
|
||||||
'modelConfig.deleteFailed': 'Deletion failed',
|
'modelConfig.deleteFailed': 'Deletion failed',
|
||||||
|
'modelConfig.deleteCancelled': 'Deletion cancelled',
|
||||||
'modelConfig.duplicateSuccess': 'Duplication successful',
|
'modelConfig.duplicateSuccess': 'Duplication successful',
|
||||||
'modelConfig.duplicateFailed': 'Duplication failed',
|
'modelConfig.duplicateFailed': 'Duplication failed',
|
||||||
'modelConfig.saveSuccess': 'Save successful',
|
'modelConfig.saveSuccess': 'Save successful',
|
||||||
|
|
@ -881,6 +845,8 @@ export default {
|
||||||
'modelConfigDialog.modelInfo': 'Model Information',
|
'modelConfigDialog.modelInfo': 'Model Information',
|
||||||
'modelConfigDialog.enable': 'Enable',
|
'modelConfigDialog.enable': 'Enable',
|
||||||
'modelConfigDialog.setDefault': 'Set as Default',
|
'modelConfigDialog.setDefault': 'Set as Default',
|
||||||
|
'modelConfigDialog.modelId': 'Model ID',
|
||||||
|
'modelConfigDialog.enterModelId': 'If not filled in, it will be generated automatically',
|
||||||
'modelConfigDialog.modelName': 'Model Name',
|
'modelConfigDialog.modelName': 'Model Name',
|
||||||
'modelConfigDialog.enterModelName': 'Please enter model name',
|
'modelConfigDialog.enterModelName': 'Please enter model name',
|
||||||
'modelConfigDialog.modelCode': 'Model Code',
|
'modelConfigDialog.modelCode': 'Model Code',
|
||||||
|
|
@ -916,6 +882,8 @@ export default {
|
||||||
'ttsModel.operationClosed': 'Operation closed',
|
'ttsModel.operationClosed': 'Operation closed',
|
||||||
'ttsModel.edit': 'Edit',
|
'ttsModel.edit': 'Edit',
|
||||||
'ttsModel.delete': 'Delete',
|
'ttsModel.delete': 'Delete',
|
||||||
|
'ttsModel.deleteVoiceSuccess': 'Successfully deleted {count} voices',
|
||||||
|
'ttsModel.deleteFailed': 'Failed to delete voices',
|
||||||
'ttsModel.save': 'Save',
|
'ttsModel.save': 'Save',
|
||||||
'ttsModel.deselectAll': 'Deselect All',
|
'ttsModel.deselectAll': 'Deselect All',
|
||||||
'ttsModel.selectAll': 'Select All',
|
'ttsModel.selectAll': 'Select All',
|
||||||
|
|
@ -925,6 +893,8 @@ export default {
|
||||||
'ttsModel.unnamedVoice': 'Unnamed Voice',
|
'ttsModel.unnamedVoice': 'Unnamed Voice',
|
||||||
'ttsModel.finishEditingFirst': 'Please finish current editing first',
|
'ttsModel.finishEditingFirst': 'Please finish current editing first',
|
||||||
'ttsModel.selectVoiceToDelete': 'Please select voices to delete',
|
'ttsModel.selectVoiceToDelete': 'Please select voices to delete',
|
||||||
|
'ttsModel.warning': 'Warning',
|
||||||
|
'ttsModel.confirmDeleteVoice': 'Are you sure to delete {count} voices?',
|
||||||
|
|
||||||
// OTA Management Page Text
|
// OTA Management Page Text
|
||||||
'otaManagement.firmwareManagement': 'Firmware Management',
|
'otaManagement.firmwareManagement': 'Firmware Management',
|
||||||
|
|
@ -976,6 +946,7 @@ export default {
|
||||||
'providerManagement.modelType.Memory': 'Memory Module',
|
'providerManagement.modelType.Memory': 'Memory Module',
|
||||||
'providerManagement.modelType.VAD': 'Voice Activity Detection',
|
'providerManagement.modelType.VAD': 'Voice Activity Detection',
|
||||||
'providerManagement.modelType.Plugin': 'Plugin Tool',
|
'providerManagement.modelType.Plugin': 'Plugin Tool',
|
||||||
|
'providerManagement.modelType.RAG': 'RAG',
|
||||||
|
|
||||||
// Provider Dialog translations
|
// Provider Dialog translations
|
||||||
'providerDialog.category': 'Category',
|
'providerDialog.category': 'Category',
|
||||||
|
|
@ -999,6 +970,7 @@ export default {
|
||||||
'providerDialog.booleanType': 'Boolean',
|
'providerDialog.booleanType': 'Boolean',
|
||||||
'providerDialog.dictType': 'Dictionary',
|
'providerDialog.dictType': 'Dictionary',
|
||||||
'providerDialog.arrayType': 'Semicolon-separated List',
|
'providerDialog.arrayType': 'Semicolon-separated List',
|
||||||
|
'providerDialog.ragType': 'RAG',
|
||||||
'providerDialog.defaultValue': 'Default Value',
|
'providerDialog.defaultValue': 'Default Value',
|
||||||
'providerDialog.inputDefaultValue': 'Please input default value',
|
'providerDialog.inputDefaultValue': 'Please input default value',
|
||||||
'providerDialog.operation': 'Operation',
|
'providerDialog.operation': 'Operation',
|
||||||
|
|
@ -1059,6 +1031,8 @@ export default {
|
||||||
'warning': 'Warning',
|
'warning': 'Warning',
|
||||||
'info': 'Info',
|
'info': 'Info',
|
||||||
'common.networkError': 'Network request failed',
|
'common.networkError': 'Network request failed',
|
||||||
|
|
||||||
|
// SM2 Encryption
|
||||||
'sm2.publicKeyNotConfigured': 'SM2 public key not configured, please contact administrator',
|
'sm2.publicKeyNotConfigured': 'SM2 public key not configured, please contact administrator',
|
||||||
'sm2.encryptionFailed': 'Password encryption failed',
|
'sm2.encryptionFailed': 'Password encryption failed',
|
||||||
'sm2.keyGenerationFailed': 'Key pair generation failed',
|
'sm2.keyGenerationFailed': 'Key pair generation failed',
|
||||||
|
|
@ -1067,7 +1041,7 @@ export default {
|
||||||
'sm2.publicKeyRetry': 'Retrying to get public key...',
|
'sm2.publicKeyRetry': 'Retrying to get public key...',
|
||||||
'sm2.publicKeyRetryFailed': 'Public key retrieval retry failed',
|
'sm2.publicKeyRetryFailed': 'Public key retrieval retry failed',
|
||||||
|
|
||||||
// 音色资源管理
|
// Voice Clone and Resource Management
|
||||||
'voiceClone.title': 'Voice Clone',
|
'voiceClone.title': 'Voice Clone',
|
||||||
'voiceResource.title': 'Voice Resource',
|
'voiceResource.title': 'Voice Resource',
|
||||||
'voiceClone.platformName': 'Platform Name',
|
'voiceClone.platformName': 'Platform Name',
|
||||||
|
|
@ -1132,7 +1106,10 @@ export default {
|
||||||
'voiceClone.reset': 'Reset',
|
'voiceClone.reset': 'Reset',
|
||||||
'voiceClone.play': 'Play',
|
'voiceClone.play': 'Play',
|
||||||
'voiceClone.pause': 'Pause',
|
'voiceClone.pause': 'Pause',
|
||||||
|
'voiceClone.stop': 'Stop',
|
||||||
'voiceClone.cancel': 'Cancel',
|
'voiceClone.cancel': 'Cancel',
|
||||||
|
'voiceClone.warning': 'Warning',
|
||||||
|
'voiceClone.ok': 'OK',
|
||||||
'voiceClone.nextStep': 'Next',
|
'voiceClone.nextStep': 'Next',
|
||||||
'voiceClone.prevStep': 'Previous',
|
'voiceClone.prevStep': 'Previous',
|
||||||
'voiceClone.upload': 'Upload Audio',
|
'voiceClone.upload': 'Upload Audio',
|
||||||
|
|
@ -1146,4 +1123,141 @@ export default {
|
||||||
'voiceClone.updateNameSuccess': 'Name updated successfully',
|
'voiceClone.updateNameSuccess': 'Name updated successfully',
|
||||||
'voiceClone.updateNameFailed': 'Failed to update name',
|
'voiceClone.updateNameFailed': 'Failed to update name',
|
||||||
'voiceClone.playFailed': 'Play failed',
|
'voiceClone.playFailed': 'Play failed',
|
||||||
|
'voiceClone.Details': 'Error Details',
|
||||||
|
|
||||||
|
// Knowledge Base Management page text
|
||||||
|
'knowledgeBaseManagement.title': 'Knowledge Base',
|
||||||
|
'knowledgeBaseManagement.searchPlaceholder': 'Please enter knowledge base name to search',
|
||||||
|
'knowledgeBaseManagement.search': 'Search',
|
||||||
|
'knowledgeBaseManagement.name': 'Knowledge Base Name',
|
||||||
|
'knowledgeBaseManagement.description': 'Knowledge Base Description',
|
||||||
|
'knowledgeBaseManagement.documentCount': 'Document Count',
|
||||||
|
'knowledgeBaseManagement.status': 'Enabled',
|
||||||
|
'knowledgeBaseManagement.createdAt': 'Created At',
|
||||||
|
'knowledgeBaseManagement.operation': 'Operation',
|
||||||
|
'knowledgeBaseManagement.add': 'Add',
|
||||||
|
'knowledgeBaseManagement.delete': 'Delete',
|
||||||
|
'knowledgeBaseManagement.edit': 'Edit',
|
||||||
|
'knowledgeBaseManagement.itemsPerPage': 'items/page',
|
||||||
|
'knowledgeBaseManagement.firstPage': 'First Page',
|
||||||
|
'knowledgeBaseManagement.prevPage': 'Previous Page',
|
||||||
|
'knowledgeBaseManagement.nextPage': 'Next Page',
|
||||||
|
'knowledgeBaseManagement.totalRecords': 'Total {total} records',
|
||||||
|
'knowledgeBaseManagement.addKnowledgeBase': 'Add Knowledge Base',
|
||||||
|
'knowledgeBaseManagement.editKnowledgeBase': 'Edit Knowledge Base',
|
||||||
|
'knowledgeBaseManagement.getKnowledgeBaseListFailed': 'Failed to get knowledge base list',
|
||||||
|
'knowledgeBaseManagement.selectKnowledgeBaseFirst': 'Please select knowledge bases to delete first',
|
||||||
|
'knowledgeBaseManagement.confirmBatchDelete': 'Are you sure you want to delete the selected {count} knowledge bases?',
|
||||||
|
'knowledgeBaseManagement.batchDeleteSuccess': 'Successfully deleted {count} knowledge bases',
|
||||||
|
'knowledgeBaseManagement.deleteFailed': 'Delete failed, please try again',
|
||||||
|
'knowledgeBaseManagement.operationCancelled': 'Delete operation has been cancelled',
|
||||||
|
'knowledgeBaseManagement.updateSuccess': 'Update successful',
|
||||||
|
'knowledgeBaseManagement.addSuccess': 'Add successful',
|
||||||
|
'knowledgeBaseManagement.updateFailed': 'Update failed',
|
||||||
|
'knowledgeBaseManagement.addFailed': 'Add failed',
|
||||||
|
'knowledgeBaseManagement.selectAll': 'Select All',
|
||||||
|
'knowledgeBaseManagement.cancelSelectAll': 'Deselect All',
|
||||||
|
|
||||||
|
// Knowledge Base Dialog text
|
||||||
|
'knowledgeBaseDialog.title': 'Knowledge Base',
|
||||||
|
'knowledgeBaseDialog.name': 'Knowledge Base Name',
|
||||||
|
'knowledgeBaseDialog.namePlaceholder': 'Please enter knowledge base name accurately to improve the accuracy of knowledge base call',
|
||||||
|
'knowledgeBaseDialog.description': 'Knowledge Base Description',
|
||||||
|
'knowledgeBaseDialog.descriptionPlaceholder': 'Please enter knowledge base description accurately to help the model better understand the knowledge base content',
|
||||||
|
'knowledgeBaseDialog.ragModel': 'RAG Model',
|
||||||
|
'knowledgeBaseDialog.ragModelPlaceholder': 'Please select RAG model',
|
||||||
|
'knowledgeBaseDialog.ragModelRequired': 'Please select RAG model',
|
||||||
|
'knowledgeBaseDialog.loadRAGModelsFailed': 'Failed to load RAG models list',
|
||||||
|
'knowledgeBaseDialog.status': 'Status',
|
||||||
|
'knowledgeBaseDialog.statusEnabled': 'Enabled',
|
||||||
|
'knowledgeBaseDialog.statusDisabled': 'Disabled',
|
||||||
|
'knowledgeBaseDialog.save': 'Save',
|
||||||
|
'knowledgeBaseDialog.cancel': 'Cancel',
|
||||||
|
'knowledgeBaseDialog.confirm': 'Confirm',
|
||||||
|
'knowledgeBaseDialog.requiredName': 'Please enter knowledge base name',
|
||||||
|
'knowledgeBaseDialog.nameRequired': 'Please enter knowledge base name',
|
||||||
|
'knowledgeBaseDialog.nameLength': 'Knowledge base name length should be between 1 and 50 characters',
|
||||||
|
'knowledgeBaseDialog.namePattern': 'Knowledge base name can only contain Chinese, English, numbers, spaces, underscores and hyphens',
|
||||||
|
'knowledgeBaseDialog.descriptionLength': 'Knowledge base description cannot exceed 200 characters',
|
||||||
|
'knowledgeBaseDialog.nameLengthLimit': 'Knowledge base name cannot exceed 50 characters',
|
||||||
|
'knowledgeBaseDialog.descriptionLengthLimit': 'Knowledge base description cannot exceed 200 characters',
|
||||||
|
|
||||||
|
// Knowledge Base Management page new view button text
|
||||||
|
'knowledgeBaseManagement.view': 'Manage Files',
|
||||||
|
|
||||||
|
// Knowledge File Upload page text
|
||||||
|
'knowledgeFileUpload.back': 'Back',
|
||||||
|
'knowledgeFileUpload.searchPlaceholder': 'Please enter document name to search',
|
||||||
|
'knowledgeFileUpload.search': 'Search',
|
||||||
|
'knowledgeFileUpload.addDocument': 'Add Document',
|
||||||
|
'knowledgeFileUpload.documentName': 'Document Name',
|
||||||
|
'knowledgeFileUpload.uploadTime': 'Upload Time',
|
||||||
|
'knowledgeFileUpload.status': 'Status',
|
||||||
|
'knowledgeFileUpload.operation': 'Operation',
|
||||||
|
'knowledgeFileUpload.parse': 'Parse',
|
||||||
|
'knowledgeFileUpload.viewSlices': 'View Slices',
|
||||||
|
'knowledgeFileUpload.delete': 'Delete',
|
||||||
|
'knowledgeFileUpload.itemsPerPage': 'items/page',
|
||||||
|
'knowledgeFileUpload.firstPage': 'First Page',
|
||||||
|
'knowledgeFileUpload.prevPage': 'Previous Page',
|
||||||
|
'knowledgeFileUpload.nextPage': 'Next Page',
|
||||||
|
'knowledgeFileUpload.totalRecords': 'Total {total} records',
|
||||||
|
'knowledgeFileUpload.uploadDocument': 'Upload Document',
|
||||||
|
'knowledgeFileUpload.documentNamePlaceholder': 'Please enter document name',
|
||||||
|
'knowledgeFileUpload.file': 'File',
|
||||||
|
'knowledgeFileUpload.clickToUpload': 'Click to upload',
|
||||||
|
'knowledgeFileUpload.uploadTip': 'Supported file types: PDF, DOC, DOCX, TXT, MD, CSV, XLS, XLSX, PPT, PPTX. Maximum 32 files per upload, each file size up to 10MB',
|
||||||
|
'knowledgeFileUpload.dragOrClick': 'Drag file here, or click to upload',
|
||||||
|
'knowledgeFileUpload.cancel': 'Cancel',
|
||||||
|
'knowledgeFileUpload.confirm': 'Confirm',
|
||||||
|
'knowledgeFileUpload.knowledgeBaseName': 'Knowledge Base Name',
|
||||||
|
'knowledgeFileUpload.statusNotStarted': 'Not Started',
|
||||||
|
'knowledgeFileUpload.statusProcessing': 'Processing',
|
||||||
|
'knowledgeFileUpload.statusCancelled': 'Cancelled',
|
||||||
|
'knowledgeFileUpload.statusCompleted': 'Completed',
|
||||||
|
'knowledgeFileUpload.statusFailed': 'Failed',
|
||||||
|
'knowledgeFileUpload.uploadSuccess': 'Document upload successful',
|
||||||
|
'knowledgeFileUpload.uploadFailed': 'Document upload failed',
|
||||||
|
'knowledgeFileUpload.parseSuccess': 'Document parse successful',
|
||||||
|
'knowledgeFileUpload.parseFailed': 'Document parse failed',
|
||||||
|
'knowledgeFileUpload.deleteSuccess': 'Document delete successful',
|
||||||
|
'knowledgeFileUpload.deleteFailed': 'Document delete failed',
|
||||||
|
'knowledgeFileUpload.confirmDelete': 'Are you sure you want to delete this document?',
|
||||||
|
'knowledgeFileUpload.confirmParse': 'Are you sure you want to parse this document?',
|
||||||
|
'knowledgeFileUpload.nameRequired': 'Please enter document name',
|
||||||
|
'knowledgeFileUpload.fileRequired': 'Please select a file to upload',
|
||||||
|
'knowledgeFileUpload.getListFailed': 'Failed to get document list',
|
||||||
|
'knowledgeFileUpload.parseCancelled': 'Parse cancelled',
|
||||||
|
'knowledgeFileUpload.deleteCancelled': 'Delete cancelled',
|
||||||
|
'knowledgeFileUpload.selectFilesFirst': 'Please select files to delete first',
|
||||||
|
'knowledgeFileUpload.selectAll': 'Select All',
|
||||||
|
'knowledgeFileUpload.deselectAll': 'Deselect All',
|
||||||
|
'knowledgeFileUpload.batchDelete': 'Delete',
|
||||||
|
'knowledgeFileUpload.confirmBatchDelete': 'Are you sure you want to delete the selected {count} files?',
|
||||||
|
'knowledgeFileUpload.batchDeleteSuccess': 'Successfully deleted {count} files',
|
||||||
|
'knowledgeFileUpload.batchDeleteFailed': 'Batch delete failed',
|
||||||
|
'knowledgeFileUpload.sliceCount': 'Slice Count',
|
||||||
|
'knowledgeFileUpload.add': 'Add',
|
||||||
|
'knowledgeFileUpload.retrievalTest': 'Retrieval Test',
|
||||||
|
'knowledgeFileUpload.testQuestion': 'Test Question',
|
||||||
|
'knowledgeFileUpload.testQuestionPlaceholder': 'Please enter the question to test',
|
||||||
|
'knowledgeFileUpload.executeTest': 'Execute Test',
|
||||||
|
'knowledgeFileUpload.testResult': 'Test Result:',
|
||||||
|
'knowledgeFileUpload.selectedFiles': 'Selected Files',
|
||||||
|
'knowledgeFileUpload.totalSlices': 'Total {total} records',
|
||||||
|
'knowledgeFileUpload.slice': 'Slice',
|
||||||
|
'knowledgeFileUpload.noSliceData': 'No slice data available',
|
||||||
|
'knowledgeFileUpload.firstPage': 'First',
|
||||||
|
'knowledgeFileUpload.prevPage': 'Previous',
|
||||||
|
'knowledgeFileUpload.nextPage': 'Next',
|
||||||
|
'knowledgeFileUpload.totalRecords': 'Total {total} records',
|
||||||
|
'knowledgeFileUpload.testQuestion': 'Test Question',
|
||||||
|
'knowledgeFileUpload.testQuestionPlaceholder': 'Please enter the question to test',
|
||||||
|
'knowledgeFileUpload.runTest': 'Run Test',
|
||||||
|
'knowledgeFileUpload.testResult': 'Test Result:',
|
||||||
|
'knowledgeFileUpload.noRelatedSlices': 'No related slices found',
|
||||||
|
'knowledgeFileUpload.comprehensiveSimilarity': 'Comprehensive Similarity',
|
||||||
|
'knowledgeFileUpload.content': 'Content:',
|
||||||
|
'knowledgeFileUpload.testQuestionRequired': 'Please enter test question',
|
||||||
|
'knowledgeBaseDialog.descriptionRequired': 'Please enter knowledge base description',
|
||||||
}
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ export default {
|
||||||
'header.voiceCloneManagement': '音色克隆',
|
'header.voiceCloneManagement': '音色克隆',
|
||||||
'header.voiceResourceManagement': '音色资源',
|
'header.voiceResourceManagement': '音色资源',
|
||||||
'header.modelConfig': '模型配置',
|
'header.modelConfig': '模型配置',
|
||||||
|
'header.knowledgeBase': '知识库',
|
||||||
'header.userManagement': '用户管理',
|
'header.userManagement': '用户管理',
|
||||||
'header.otaManagement': 'OTA管理',
|
'header.otaManagement': 'OTA管理',
|
||||||
'header.paramDictionary': '参数字典',
|
'header.paramDictionary': '参数字典',
|
||||||
|
|
@ -19,6 +20,11 @@ export default {
|
||||||
'header.agentTemplate': '默认角色模板',
|
'header.agentTemplate': '默认角色模板',
|
||||||
'header.searchHistory': '搜索历史',
|
'header.searchHistory': '搜索历史',
|
||||||
'header.clearHistory': '清空历史',
|
'header.clearHistory': '清空历史',
|
||||||
|
'header.providerManagement': '字段管理',
|
||||||
|
'header.serverSideManagement': '服务端管理',
|
||||||
|
'header.changePassword': '修改密码',
|
||||||
|
'header.logout': '退出登录',
|
||||||
|
'header.searchPlaceholder': '输入名称搜索..',
|
||||||
|
|
||||||
// McpToolCallDialog组件文本
|
// McpToolCallDialog组件文本
|
||||||
'mcpToolCall.title': '工具调用',
|
'mcpToolCall.title': '工具调用',
|
||||||
|
|
@ -191,6 +197,23 @@ export default {
|
||||||
'firmwareDialog.firmwareNamePlaceholder': '请输入固件名称(板子+版本号)',
|
'firmwareDialog.firmwareNamePlaceholder': '请输入固件名称(板子+版本号)',
|
||||||
'firmwareDialog.firmwareType': '固件类型',
|
'firmwareDialog.firmwareType': '固件类型',
|
||||||
'firmwareDialog.firmwareTypePlaceholder': '请选择固件类型',
|
'firmwareDialog.firmwareTypePlaceholder': '请选择固件类型',
|
||||||
|
'firmwareDialog.version': '版本号',
|
||||||
|
'firmwareDialog.versionPlaceholder': '请输入版本号(x.x.x格式)',
|
||||||
|
'firmwareDialog.firmwareFile': '固件文件',
|
||||||
|
'firmwareDialog.clickUpload': '点击上传',
|
||||||
|
'firmwareDialog.uploadTip': '只能上传固件文件(.bin/.apk),且不超过100MB',
|
||||||
|
'firmwareDialog.uploadHint': '温馨提示:请上传合并前的xiaozhi.bin文件,而不是合并后的merged-binary.bin文件',
|
||||||
|
'firmwareDialog.remark': '备注',
|
||||||
|
'firmwareDialog.remarkPlaceholder': '请输入备注信息',
|
||||||
|
'firmwareDialog.requiredFirmwareName': '请输入固件名称(板子+版本号)',
|
||||||
|
'firmwareDialog.requiredFirmwareType': '请选择固件类型',
|
||||||
|
'firmwareDialog.requiredVersion': '请输入版本号',
|
||||||
|
'firmwareDialog.versionFormatError': '版本号格式不正确,请输入x.x.x格式',
|
||||||
|
'firmwareDialog.requiredFirmwareFile': '请上传固件文件',
|
||||||
|
'firmwareDialog.invalidFileType': '只能上传.bin/.apk格式的固件文件!',
|
||||||
|
'firmwareDialog.invalidFileSize': '固件文件大小不能超过100MB!',
|
||||||
|
'firmwareDialog.uploadSuccess': '固件文件上传成功',
|
||||||
|
'firmwareDialog.uploadFailed': '文件上传失败',
|
||||||
|
|
||||||
// 声纹对话框相关
|
// 声纹对话框相关
|
||||||
'voicePrintDialog.addSpeaker': '添加说话人',
|
'voicePrintDialog.addSpeaker': '添加说话人',
|
||||||
|
|
@ -232,6 +255,21 @@ export default {
|
||||||
|
|
||||||
// 手動添加設備對話框相關
|
// 手動添加設備對話框相關
|
||||||
'manualAddDeviceDialog.title': '手动添加设备',
|
'manualAddDeviceDialog.title': '手动添加设备',
|
||||||
|
'manualAddDeviceDialog.deviceType': '设备型号',
|
||||||
|
'manualAddDeviceDialog.deviceTypePlaceholder': '请选择设备型号',
|
||||||
|
'manualAddDeviceDialog.firmwareVersion': '固件版本',
|
||||||
|
'manualAddDeviceDialog.firmwareVersionPlaceholder': '请输入固件版本',
|
||||||
|
'manualAddDeviceDialog.macAddress': 'Mac地址',
|
||||||
|
'manualAddDeviceDialog.macAddressPlaceholder': '请输入Mac地址',
|
||||||
|
'manualAddDeviceDialog.confirm': '确定',
|
||||||
|
'manualAddDeviceDialog.cancel': '取消',
|
||||||
|
'manualAddDeviceDialog.requiredMacAddress': '请输入Mac地址',
|
||||||
|
'manualAddDeviceDialog.invalidMacAddress': '请输入正确的Mac地址格式,例如:00:1A:2B:3C:4D:5E',
|
||||||
|
'manualAddDeviceDialog.requiredDeviceType': '请选择设备型号',
|
||||||
|
'manualAddDeviceDialog.requiredFirmwareVersion': '请输入固件版本',
|
||||||
|
'manualAddDeviceDialog.getFirmwareTypeFailed': '获取固件类型失败',
|
||||||
|
'manualAddDeviceDialog.addSuccess': '设备添加成功',
|
||||||
|
'manualAddDeviceDialog.addFailed': '添加失败',
|
||||||
|
|
||||||
// AddModelDialog组件相关
|
// AddModelDialog组件相关
|
||||||
'addModelDialog.requiredSupplier': '请选择供应器',
|
'addModelDialog.requiredSupplier': '请选择供应器',
|
||||||
|
|
@ -251,28 +289,24 @@ export default {
|
||||||
'register.userAgreement': '用户协议',
|
'register.userAgreement': '用户协议',
|
||||||
'register.privacyPolicy': '隐私政策',
|
'register.privacyPolicy': '隐私政策',
|
||||||
'register.notAllowRegister': '当前不允许用户注册',
|
'register.notAllowRegister': '当前不允许用户注册',
|
||||||
'register.captchaLoadFailed': '验证码加载失败',
|
'register.captchaLoadFailed': '验证码加载失败,点击刷新',
|
||||||
'register.inputCaptcha': '请输入验证码',
|
'register.inputCaptcha': '请输入验证码',
|
||||||
'register.inputCorrectMobile': '请输入正确的手机号码',
|
'register.inputCorrectMobile': '请输入正确的手机号码',
|
||||||
'register.captchaSendSuccess': '验证码发送成功',
|
'register.captchaSendSuccess': '验证码发送成功',
|
||||||
'register.captchaSendFailed': '验证码发送失败',
|
'register.captchaSendFailed': '验证码发送失败',
|
||||||
'register.passwordsNotMatch': '两次输入的密码不一致',
|
|
||||||
'register.registerSuccess': '注册成功!',
|
'register.registerSuccess': '注册成功!',
|
||||||
'register.registerFailed': '注册失败',
|
'register.registerFailed': '注册失败',
|
||||||
|
'register.passwordsNotMatch': '两次输入的密码不一致',
|
||||||
'register.requiredUsername': '用户名不能为空',
|
'register.requiredUsername': '用户名不能为空',
|
||||||
'register.requiredPassword': '密码不能为空',
|
'register.requiredPassword': '密码不能为空',
|
||||||
'register.requiredCaptcha': '验证码不能为空',
|
'register.requiredCaptcha': '验证码不能为空',
|
||||||
'register.requiredMobileCaptcha': '请输入短信验证码',
|
'register.requiredMobileCaptcha': '请输入短信验证码',
|
||||||
|
'register.invalidCaptcha': '验证码不正确',
|
||||||
'manualAddDeviceDialog.deviceType': '设备型号',
|
'register.passwordLength': '密码长度必须在6-20位之间',
|
||||||
'manualAddDeviceDialog.deviceTypePlaceholder': '请选择设备型号',
|
'register.usernameFormat': '用户名格式不正确',
|
||||||
'manualAddDeviceDialog.firmwareVersion': '固件版本',
|
'register.confirmPasswordRequired': '确认密码不能为空',
|
||||||
'manualAddDeviceDialog.firmwareVersionPlaceholder': '请输入固件版本',
|
'register.sendCaptcha': '获取验证码',
|
||||||
'manualAddDeviceDialog.macAddress': 'Mac地址',
|
'register.secondsLater': '秒后',
|
||||||
'manualAddDeviceDialog.macAddressPlaceholder': '请输入Mac地址',
|
|
||||||
'manualAddDeviceDialog.confirm': '确定',
|
|
||||||
'manualAddDeviceDialog.cancel': '取消',
|
|
||||||
'manualAddDeviceDialog.requiredMacAddress': '请输入Mac地址',
|
|
||||||
|
|
||||||
// 参数对话框相关
|
// 参数对话框相关
|
||||||
'paramDialog.paramCode': '参数编码',
|
'paramDialog.paramCode': '参数编码',
|
||||||
|
|
@ -293,34 +327,6 @@ export default {
|
||||||
'paramDialog.booleanType': '布尔值(boolean)',
|
'paramDialog.booleanType': '布尔值(boolean)',
|
||||||
'paramDialog.arrayType': '数组(array)',
|
'paramDialog.arrayType': '数组(array)',
|
||||||
'paramDialog.jsonType': 'JSON对象(json)',
|
'paramDialog.jsonType': 'JSON对象(json)',
|
||||||
'manualAddDeviceDialog.invalidMacAddress': '请输入正确的Mac地址格式,例如:00:1A:2B:3C:4D:5E',
|
|
||||||
'manualAddDeviceDialog.requiredDeviceType': '请选择设备型号',
|
|
||||||
'manualAddDeviceDialog.requiredFirmwareVersion': '请输入固件版本',
|
|
||||||
'manualAddDeviceDialog.getFirmwareTypeFailed': '获取固件类型失败',
|
|
||||||
'manualAddDeviceDialog.addSuccess': '设备添加成功',
|
|
||||||
'manualAddDeviceDialog.addFailed': '添加失败',
|
|
||||||
'firmwareDialog.version': '版本号',
|
|
||||||
'firmwareDialog.versionPlaceholder': '请输入版本号(x.x.x格式)',
|
|
||||||
'firmwareDialog.firmwareFile': '固件文件',
|
|
||||||
'firmwareDialog.clickUpload': '点击上传',
|
|
||||||
'firmwareDialog.uploadTip': '只能上传固件文件(.bin/.apk),且不超过100MB',
|
|
||||||
'firmwareDialog.uploadHint': '温馨提示:请上传合并前的xiaozhi.bin文件,而不是合并后的merged-binary.bin文件',
|
|
||||||
'firmwareDialog.remark': '备注',
|
|
||||||
'firmwareDialog.remarkPlaceholder': '请输入备注信息',
|
|
||||||
'firmwareDialog.requiredFirmwareName': '请输入固件名称(板子+版本号)',
|
|
||||||
'firmwareDialog.requiredFirmwareType': '请选择固件类型',
|
|
||||||
'firmwareDialog.requiredVersion': '请输入版本号',
|
|
||||||
'firmwareDialog.versionFormatError': '版本号格式不正确,请输入x.x.x格式',
|
|
||||||
'firmwareDialog.requiredFirmwareFile': '请上传固件文件',
|
|
||||||
'firmwareDialog.invalidFileType': '只能上传.bin/.apk格式的固件文件!',
|
|
||||||
'firmwareDialog.invalidFileSize': '固件文件大小不能超过100MB!',
|
|
||||||
'firmwareDialog.uploadSuccess': '固件文件上传成功',
|
|
||||||
'firmwareDialog.uploadFailed': '文件上传失败',
|
|
||||||
'header.providerManagement': '字段管理',
|
|
||||||
'header.serverSideManagement': '服务端管理',
|
|
||||||
'header.changePassword': '修改密码',
|
|
||||||
'header.logout': '退出登录',
|
|
||||||
'header.searchPlaceholder': '输入名称搜索..',
|
|
||||||
|
|
||||||
// 登录页面文本
|
// 登录页面文本
|
||||||
'login.title': '登录',
|
'login.title': '登录',
|
||||||
|
|
@ -344,52 +350,6 @@ export default {
|
||||||
'login.privacyPolicy': '《隐私政策》',
|
'login.privacyPolicy': '《隐私政策》',
|
||||||
'login.registerAccount': '注册账号',
|
'login.registerAccount': '注册账号',
|
||||||
|
|
||||||
// 注册页面文本
|
|
||||||
'register.title': '注册账号',
|
|
||||||
'register.welcome': '欢迎注册',
|
|
||||||
'register.username': '用户名',
|
|
||||||
'register.usernamePlaceholder': '请输入用户名',
|
|
||||||
'register.mobile': '手机号',
|
|
||||||
'register.mobilePlaceholder': '请输入手机号码',
|
|
||||||
'register.password': '密码',
|
|
||||||
'register.passwordPlaceholder': '请输入密码',
|
|
||||||
'register.confirmPassword': '确认密码',
|
|
||||||
'register.confirmPasswordPlaceholder': '请确认密码',
|
|
||||||
'register.captcha': '验证码',
|
|
||||||
'register.captchaPlaceholder': '请输入验证码',
|
|
||||||
'register.mobileCaptcha': '手机验证码',
|
|
||||||
'register.mobileCaptchaPlaceholder': '请输入手机验证码',
|
|
||||||
'register.getMobileCaptcha': '获取验证码',
|
|
||||||
'register.registerButton': '注册',
|
|
||||||
'register.login': '登录',
|
|
||||||
'register.inputCorrectMobile': '请输入正确的手机号码',
|
|
||||||
'register.inputCaptcha': '请输入图形验证码',
|
|
||||||
'register.captchaSendSuccess': '验证码发送成功',
|
|
||||||
'register.invalidCaptcha': '验证码不正确',
|
|
||||||
'register.passwordsNotMatch': '两次输入的密码不一致',
|
|
||||||
'register.passwordLength': '密码长度必须在6-20位之间',
|
|
||||||
'register.usernameRequired': '用户名不能为空',
|
|
||||||
'register.usernameFormat': '用户名格式不正确',
|
|
||||||
'register.mobileRequired': '手机号不能为空',
|
|
||||||
'register.passwordRequired': '密码不能为空',
|
|
||||||
'register.confirmPasswordRequired': '确认密码不能为空',
|
|
||||||
'register.goToLogin': '已有账号,去登录',
|
|
||||||
'register.agreeTo': '注册即同意',
|
|
||||||
'register.userAgreement': '《用户协议》',
|
|
||||||
'register.and': '和',
|
|
||||||
'register.privacyPolicy': '《隐私政策》',
|
|
||||||
'register.sendCaptcha': '获取验证码',
|
|
||||||
'register.notAllowRegister': '当前不允许普通用户注册',
|
|
||||||
'register.captchaLoadFailed': '验证码加载失败,点击刷新',
|
|
||||||
'register.inputCorrectMobile': '请输入正确的手机号码',
|
|
||||||
'register.inputCaptcha': '请输入图形验证码',
|
|
||||||
'register.captchaSendSuccess': '验证码发送成功',
|
|
||||||
'register.captchaSendFailed': '验证码发送失败',
|
|
||||||
'register.registerSuccess': '注册成功!',
|
|
||||||
'register.registerFailed': '注册失败',
|
|
||||||
'register.passwordsNotMatch': '两次输入的密码不一致',
|
|
||||||
'register.secondsLater': '秒后',
|
|
||||||
|
|
||||||
// 忘记密码页面文本
|
// 忘记密码页面文本
|
||||||
'retrievePassword.title': '重置密码',
|
'retrievePassword.title': '重置密码',
|
||||||
'retrievePassword.welcome': '密码找回',
|
'retrievePassword.welcome': '密码找回',
|
||||||
|
|
@ -507,6 +467,7 @@ export default {
|
||||||
'chatHistory.downloadCurrentSession': '下载本会话聊天记录',
|
'chatHistory.downloadCurrentSession': '下载本会话聊天记录',
|
||||||
'chatHistory.downloadCurrentWithPreviousSessions': '下载本会话及前20条会话聊天记录',
|
'chatHistory.downloadCurrentWithPreviousSessions': '下载本会话及前20条会话聊天记录',
|
||||||
'chatHistory.downloadLinkFailed': '获取下载链接失败',
|
'chatHistory.downloadLinkFailed': '获取下载链接失败',
|
||||||
|
|
||||||
'cache.status': '缓存状态',
|
'cache.status': '缓存状态',
|
||||||
'cache.cdnEnabled': 'CDN模式已启用',
|
'cache.cdnEnabled': 'CDN模式已启用',
|
||||||
'cache.cdnDisabled': 'CDN模式已禁用',
|
'cache.cdnDisabled': 'CDN模式已禁用',
|
||||||
|
|
@ -672,6 +633,7 @@ export default {
|
||||||
'common.confirm': '确定',
|
'common.confirm': '确定',
|
||||||
'common.cancel': '取消',
|
'common.cancel': '取消',
|
||||||
'common.sensitive': '敏感',
|
'common.sensitive': '敏感',
|
||||||
|
'common.loading': '加载中',
|
||||||
|
|
||||||
// 语言切换
|
// 语言切换
|
||||||
'language.zhCN': '中文简体',
|
'language.zhCN': '中文简体',
|
||||||
|
|
@ -833,6 +795,7 @@ export default {
|
||||||
'modelConfig.intent': '意图识别',
|
'modelConfig.intent': '意图识别',
|
||||||
'modelConfig.tts': '语音合成',
|
'modelConfig.tts': '语音合成',
|
||||||
'modelConfig.memory': '记忆',
|
'modelConfig.memory': '记忆',
|
||||||
|
'modelConfig.rag': '知识库',
|
||||||
'modelConfig.modelId': '模型ID',
|
'modelConfig.modelId': '模型ID',
|
||||||
'modelConfig.modelName': '模型名称',
|
'modelConfig.modelName': '模型名称',
|
||||||
'modelConfig.provider': '提供商',
|
'modelConfig.provider': '提供商',
|
||||||
|
|
@ -855,6 +818,7 @@ export default {
|
||||||
'modelConfig.partialDeleteFailed': '部分删除失败',
|
'modelConfig.partialDeleteFailed': '部分删除失败',
|
||||||
'modelConfig.deleteSuccess': '删除成功',
|
'modelConfig.deleteSuccess': '删除成功',
|
||||||
'modelConfig.deleteFailed': '删除失败',
|
'modelConfig.deleteFailed': '删除失败',
|
||||||
|
'modelConfig.deleteCancelled': '删除已取消',
|
||||||
'modelConfig.duplicateSuccess': '创建副本成功',
|
'modelConfig.duplicateSuccess': '创建副本成功',
|
||||||
'modelConfig.duplicateFailed': '创建副本失败',
|
'modelConfig.duplicateFailed': '创建副本失败',
|
||||||
'modelConfig.saveSuccess': '保存成功',
|
'modelConfig.saveSuccess': '保存成功',
|
||||||
|
|
@ -881,6 +845,8 @@ export default {
|
||||||
'modelConfigDialog.modelInfo': '模型信息',
|
'modelConfigDialog.modelInfo': '模型信息',
|
||||||
'modelConfigDialog.enable': '是否启用',
|
'modelConfigDialog.enable': '是否启用',
|
||||||
'modelConfigDialog.setDefault': '设为默认',
|
'modelConfigDialog.setDefault': '设为默认',
|
||||||
|
'modelConfigDialog.modelId': '模型ID',
|
||||||
|
'modelConfigDialog.enterModelId': '未填写将自动生成模型ID',
|
||||||
'modelConfigDialog.modelName': '模型名称',
|
'modelConfigDialog.modelName': '模型名称',
|
||||||
'modelConfigDialog.enterModelName': '请输入模型名称',
|
'modelConfigDialog.enterModelName': '请输入模型名称',
|
||||||
'modelConfigDialog.modelCode': '模型编码',
|
'modelConfigDialog.modelCode': '模型编码',
|
||||||
|
|
@ -916,6 +882,8 @@ export default {
|
||||||
'ttsModel.operationClosed': '操作已关闭',
|
'ttsModel.operationClosed': '操作已关闭',
|
||||||
'ttsModel.edit': '编辑',
|
'ttsModel.edit': '编辑',
|
||||||
'ttsModel.delete': '删除',
|
'ttsModel.delete': '删除',
|
||||||
|
'ttsModel.deleteVoiceSuccess': '成功删除{count}个音色',
|
||||||
|
'ttsModel.deleteFailed': '删除音色失败',
|
||||||
'ttsModel.save': '保存',
|
'ttsModel.save': '保存',
|
||||||
'ttsModel.deselectAll': '取消全选',
|
'ttsModel.deselectAll': '取消全选',
|
||||||
'ttsModel.selectAll': '全选',
|
'ttsModel.selectAll': '全选',
|
||||||
|
|
@ -925,6 +893,8 @@ export default {
|
||||||
'ttsModel.unnamedVoice': '未命名音色',
|
'ttsModel.unnamedVoice': '未命名音色',
|
||||||
'ttsModel.finishEditingFirst': '请先完成当前编辑',
|
'ttsModel.finishEditingFirst': '请先完成当前编辑',
|
||||||
'ttsModel.selectVoiceToDelete': '请选择要删除的音色',
|
'ttsModel.selectVoiceToDelete': '请选择要删除的音色',
|
||||||
|
'ttsModel.warning': '警告',
|
||||||
|
'ttsModel.confirmDeleteVoice': '确定要删除{count}个音色吗?',
|
||||||
|
|
||||||
// OTA管理页面文本
|
// OTA管理页面文本
|
||||||
'otaManagement.firmwareManagement': '固件管理',
|
'otaManagement.firmwareManagement': '固件管理',
|
||||||
|
|
@ -976,6 +946,7 @@ export default {
|
||||||
'providerManagement.modelType.Memory': '记忆模块',
|
'providerManagement.modelType.Memory': '记忆模块',
|
||||||
'providerManagement.modelType.VAD': '语音活动检测',
|
'providerManagement.modelType.VAD': '语音活动检测',
|
||||||
'providerManagement.modelType.Plugin': '插件工具',
|
'providerManagement.modelType.Plugin': '插件工具',
|
||||||
|
'providerManagement.modelType.RAG': '知识库',
|
||||||
|
|
||||||
// Provider Dialog 翻译
|
// Provider Dialog 翻译
|
||||||
'providerDialog.category': '类别',
|
'providerDialog.category': '类别',
|
||||||
|
|
@ -999,6 +970,7 @@ export default {
|
||||||
'providerDialog.booleanType': '布尔值',
|
'providerDialog.booleanType': '布尔值',
|
||||||
'providerDialog.dictType': '字典',
|
'providerDialog.dictType': '字典',
|
||||||
'providerDialog.arrayType': '分号分割的列表',
|
'providerDialog.arrayType': '分号分割的列表',
|
||||||
|
'providerDialog.ragType': '知识库',
|
||||||
'providerDialog.defaultValue': '默认值',
|
'providerDialog.defaultValue': '默认值',
|
||||||
'providerDialog.inputDefaultValue': '请输入默认值',
|
'providerDialog.inputDefaultValue': '请输入默认值',
|
||||||
'providerDialog.operation': '操作',
|
'providerDialog.operation': '操作',
|
||||||
|
|
@ -1059,6 +1031,7 @@ export default {
|
||||||
'warning': '警告',
|
'warning': '警告',
|
||||||
'info': '提示',
|
'info': '提示',
|
||||||
'common.networkError': '网络请求失败',
|
'common.networkError': '网络请求失败',
|
||||||
|
|
||||||
// SM2加密相关错误消息
|
// SM2加密相关错误消息
|
||||||
'sm2.publicKeyNotConfigured': 'SM2公钥未配置,请联系管理员',
|
'sm2.publicKeyNotConfigured': 'SM2公钥未配置,请联系管理员',
|
||||||
'sm2.encryptionFailed': '密码加密失败',
|
'sm2.encryptionFailed': '密码加密失败',
|
||||||
|
|
@ -1133,7 +1106,10 @@ export default {
|
||||||
'voiceClone.reset': '重置',
|
'voiceClone.reset': '重置',
|
||||||
'voiceClone.play': '播放',
|
'voiceClone.play': '播放',
|
||||||
'voiceClone.pause': '暂停',
|
'voiceClone.pause': '暂停',
|
||||||
|
'voiceClone.stop': '停止',
|
||||||
'voiceClone.cancel': '取消',
|
'voiceClone.cancel': '取消',
|
||||||
|
'voiceClone.warning': '警告',
|
||||||
|
'voiceClone.ok': '确定',
|
||||||
'voiceClone.nextStep': '下一步',
|
'voiceClone.nextStep': '下一步',
|
||||||
'voiceClone.prevStep': '上一步',
|
'voiceClone.prevStep': '上一步',
|
||||||
'voiceClone.upload': '上传音频',
|
'voiceClone.upload': '上传音频',
|
||||||
|
|
@ -1147,4 +1123,141 @@ export default {
|
||||||
'voiceClone.updateNameSuccess': '名称更新成功',
|
'voiceClone.updateNameSuccess': '名称更新成功',
|
||||||
'voiceClone.updateNameFailed': '名称更新失败',
|
'voiceClone.updateNameFailed': '名称更新失败',
|
||||||
'voiceClone.playFailed': '播放失败',
|
'voiceClone.playFailed': '播放失败',
|
||||||
|
'voiceClone.Details': '错误详情',
|
||||||
|
|
||||||
|
// 知识库管理页面文本
|
||||||
|
'knowledgeBaseManagement.title': '知识库',
|
||||||
|
'knowledgeBaseManagement.searchPlaceholder': '请输入知识库名称搜索',
|
||||||
|
'knowledgeBaseManagement.search': '搜索',
|
||||||
|
'knowledgeBaseManagement.name': '知识库名称',
|
||||||
|
'knowledgeBaseManagement.description': '知识库描述',
|
||||||
|
'knowledgeBaseManagement.documentCount': '文档数量',
|
||||||
|
'knowledgeBaseManagement.status': '启用',
|
||||||
|
'knowledgeBaseManagement.createdAt': '创建时间',
|
||||||
|
'knowledgeBaseManagement.operation': '操作',
|
||||||
|
'knowledgeBaseManagement.add': '新增',
|
||||||
|
'knowledgeBaseManagement.delete': '删除',
|
||||||
|
'knowledgeBaseManagement.edit': '编辑',
|
||||||
|
'knowledgeBaseManagement.itemsPerPage': '条/页',
|
||||||
|
'knowledgeBaseManagement.firstPage': '首页',
|
||||||
|
'knowledgeBaseManagement.prevPage': '上一页',
|
||||||
|
'knowledgeBaseManagement.nextPage': '下一页',
|
||||||
|
'knowledgeBaseManagement.totalRecords': '共{total}条记录',
|
||||||
|
'knowledgeBaseManagement.addKnowledgeBase': '新增知识库',
|
||||||
|
'knowledgeBaseManagement.editKnowledgeBase': '编辑知识库',
|
||||||
|
'knowledgeBaseManagement.getKnowledgeBaseListFailed': '获取知识库列表失败',
|
||||||
|
'knowledgeBaseManagement.selectKnowledgeBaseFirst': '请先选择需要删除的知识库',
|
||||||
|
'knowledgeBaseManagement.confirmBatchDelete': '确定要删除选中的{count}个知识库吗?',
|
||||||
|
'knowledgeBaseManagement.batchDeleteSuccess': '成功删除{count}个知识库',
|
||||||
|
'knowledgeBaseManagement.deleteFailed': '删除失败,请重试',
|
||||||
|
'knowledgeBaseManagement.operationCancelled': '已取消删除操作',
|
||||||
|
'knowledgeBaseManagement.updateSuccess': '修改成功',
|
||||||
|
'knowledgeBaseManagement.addSuccess': '新增成功',
|
||||||
|
'knowledgeBaseManagement.updateFailed': '更新失败',
|
||||||
|
'knowledgeBaseManagement.addFailed': '新增失败',
|
||||||
|
'knowledgeBaseManagement.selectAll': '全选',
|
||||||
|
'knowledgeBaseManagement.cancelSelectAll': '取消全选',
|
||||||
|
|
||||||
|
// 知识库对话框文本
|
||||||
|
'knowledgeBaseDialog.title': '知识库',
|
||||||
|
'knowledgeBaseDialog.name': '知识库名称',
|
||||||
|
'knowledgeBaseDialog.namePlaceholder': '请精确输入知识库名称,才能提高调用知识库的精准性',
|
||||||
|
'knowledgeBaseDialog.description': '知识库描述',
|
||||||
|
'knowledgeBaseDialog.descriptionPlaceholder': '请详细输入知识库描述,以便大模型更好地理解这个知识库的总体内容',
|
||||||
|
'knowledgeBaseDialog.ragModel': 'RAG模型',
|
||||||
|
'knowledgeBaseDialog.ragModelPlaceholder': '请选择RAG模型',
|
||||||
|
'knowledgeBaseDialog.ragModelRequired': '请选择RAG模型',
|
||||||
|
'knowledgeBaseDialog.loadRAGModelsFailed': '加载RAG模型列表失败',
|
||||||
|
'knowledgeBaseDialog.status': '状态',
|
||||||
|
'knowledgeBaseDialog.statusEnabled': '启用',
|
||||||
|
'knowledgeBaseDialog.statusDisabled': '禁用',
|
||||||
|
'knowledgeBaseDialog.save': '保存',
|
||||||
|
'knowledgeBaseDialog.cancel': '取消',
|
||||||
|
'knowledgeBaseDialog.confirm': '确认',
|
||||||
|
'knowledgeBaseDialog.requiredName': '请输入知识库名称',
|
||||||
|
'knowledgeBaseDialog.nameRequired': '请输入知识库名称',
|
||||||
|
'knowledgeBaseDialog.nameLength': '知识库名称长度在1到50个字符之间',
|
||||||
|
'knowledgeBaseDialog.namePattern': '知识库名称只能包含中文、英文、数字、空格、下划线和连字符',
|
||||||
|
'knowledgeBaseDialog.descriptionLength': '知识库描述不能超过200个字符',
|
||||||
|
'knowledgeBaseDialog.nameLengthLimit': '知识库名称不能超过50个字符',
|
||||||
|
'knowledgeBaseDialog.descriptionLengthLimit': '知识库描述不能超过200个字符',
|
||||||
|
|
||||||
|
// 知识库管理页面新增查看按钮文本
|
||||||
|
'knowledgeBaseManagement.view': '管理文件',
|
||||||
|
|
||||||
|
// 上传文件页面文本
|
||||||
|
'knowledgeFileUpload.back': '返回',
|
||||||
|
'knowledgeFileUpload.searchPlaceholder': '请输入文档名称搜索',
|
||||||
|
'knowledgeFileUpload.search': '搜索',
|
||||||
|
'knowledgeFileUpload.addDocument': '新增文档',
|
||||||
|
'knowledgeFileUpload.documentName': '文档名称',
|
||||||
|
'knowledgeFileUpload.uploadTime': '上传时间',
|
||||||
|
'knowledgeFileUpload.status': '状态',
|
||||||
|
'knowledgeFileUpload.operation': '操作',
|
||||||
|
'knowledgeFileUpload.parse': '解析',
|
||||||
|
'knowledgeFileUpload.viewSlices': '查看切片',
|
||||||
|
'knowledgeFileUpload.delete': '删除',
|
||||||
|
'knowledgeFileUpload.itemsPerPage': '条/页',
|
||||||
|
'knowledgeFileUpload.firstPage': '首页',
|
||||||
|
'knowledgeFileUpload.prevPage': '上一页',
|
||||||
|
'knowledgeFileUpload.nextPage': '下一页',
|
||||||
|
'knowledgeFileUpload.totalRecords': '共{total}条记录',
|
||||||
|
'knowledgeFileUpload.uploadDocument': '上传文档',
|
||||||
|
'knowledgeFileUpload.documentNamePlaceholder': '请输入文档名称',
|
||||||
|
'knowledgeFileUpload.file': '文件',
|
||||||
|
'knowledgeFileUpload.clickToUpload': '点击上传',
|
||||||
|
'knowledgeFileUpload.uploadTip': '支持的文档类型:PDF、DOC、DOCX、TXT、MD、CSV、XLS、XLSX、PPT、PPTX,单次批量上传文件数不超过 32 个',
|
||||||
|
'knowledgeFileUpload.dragOrClick': '将文件拖到此处,或点击上传',
|
||||||
|
'knowledgeFileUpload.cancel': '取消',
|
||||||
|
'knowledgeFileUpload.confirm': '确定',
|
||||||
|
'knowledgeFileUpload.knowledgeBaseName': '知识库名称',
|
||||||
|
'knowledgeFileUpload.statusNotStarted': '未开始',
|
||||||
|
'knowledgeFileUpload.statusProcessing': '处理中',
|
||||||
|
'knowledgeFileUpload.statusCancelled': '已取消',
|
||||||
|
'knowledgeFileUpload.statusCompleted': '已完成',
|
||||||
|
'knowledgeFileUpload.statusFailed': '失败',
|
||||||
|
'knowledgeFileUpload.uploadSuccess': '文档上传成功',
|
||||||
|
'knowledgeFileUpload.uploadFailed': '文档上传失败',
|
||||||
|
'knowledgeFileUpload.parseSuccess': '文档解析成功',
|
||||||
|
'knowledgeFileUpload.parseFailed': '文档解析失败',
|
||||||
|
'knowledgeFileUpload.deleteSuccess': '文档删除成功',
|
||||||
|
'knowledgeFileUpload.deleteFailed': '文档删除失败',
|
||||||
|
'knowledgeFileUpload.confirmDelete': '确定要删除此文檔吗?',
|
||||||
|
'knowledgeFileUpload.confirmParse': '确定要解析该文档吗?',
|
||||||
|
'knowledgeFileUpload.nameRequired': '请输入文档名称',
|
||||||
|
'knowledgeFileUpload.fileRequired': '请选择要上传的文件',
|
||||||
|
'knowledgeFileUpload.getListFailed': '获取文档列表失败',
|
||||||
|
'knowledgeFileUpload.parseCancelled': '已取消解析',
|
||||||
|
'knowledgeFileUpload.deleteCancelled': '已取消删除',
|
||||||
|
'knowledgeFileUpload.selectFilesFirst': '请先选择要删除的文件',
|
||||||
|
'knowledgeFileUpload.selectAll': '全选',
|
||||||
|
'knowledgeFileUpload.deselectAll': '取消全选',
|
||||||
|
'knowledgeFileUpload.batchDelete': '删除',
|
||||||
|
'knowledgeFileUpload.confirmBatchDelete': '确定要删除选中的{count}个文件吗?',
|
||||||
|
'knowledgeFileUpload.batchDeleteSuccess': '成功删除{count}个文件',
|
||||||
|
'knowledgeFileUpload.batchDeleteFailed': '批量删除失败',
|
||||||
|
'knowledgeFileUpload.sliceCount': '切片数量',
|
||||||
|
'knowledgeFileUpload.add': '新增',
|
||||||
|
'knowledgeFileUpload.retrievalTest': '召回测试',
|
||||||
|
'knowledgeFileUpload.testQuestion': '测试问题',
|
||||||
|
'knowledgeFileUpload.testQuestionPlaceholder': '请输入要测试的问题',
|
||||||
|
'knowledgeFileUpload.executeTest': '执行测试',
|
||||||
|
'knowledgeFileUpload.testResult': '测试结果:',
|
||||||
|
'knowledgeFileUpload.selectedFiles': '已选择文件',
|
||||||
|
'knowledgeFileUpload.totalSlices': '共{total}条记录',
|
||||||
|
'knowledgeFileUpload.slice': '切片',
|
||||||
|
'knowledgeFileUpload.noSliceData': '暂无切片数据',
|
||||||
|
'knowledgeFileUpload.firstPage': '首页',
|
||||||
|
'knowledgeFileUpload.prevPage': '上一页',
|
||||||
|
'knowledgeFileUpload.nextPage': '下一页',
|
||||||
|
'knowledgeFileUpload.totalRecords': '共{total}条记录',
|
||||||
|
'knowledgeFileUpload.testQuestion': '测试问题',
|
||||||
|
'knowledgeFileUpload.testQuestionPlaceholder': '请输入要测试的问题',
|
||||||
|
'knowledgeFileUpload.runTest': '执行测试',
|
||||||
|
'knowledgeFileUpload.testResult': '测试结果:',
|
||||||
|
'knowledgeFileUpload.noRelatedSlices': '未找到相关切片',
|
||||||
|
'knowledgeFileUpload.comprehensiveSimilarity': '综合相似度',
|
||||||
|
'knowledgeFileUpload.content': '内容:',
|
||||||
|
'knowledgeFileUpload.testQuestionRequired': '请输入测试问题',
|
||||||
|
'knowledgeBaseDialog.descriptionRequired': '请输入知识库描述',
|
||||||
}
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ export default {
|
||||||
// HeaderBar组件文本
|
// HeaderBar组件文本
|
||||||
'header.smartManagement': '智能體管理',
|
'header.smartManagement': '智能體管理',
|
||||||
'header.modelConfig': '模型配置',
|
'header.modelConfig': '模型配置',
|
||||||
|
'header.knowledgeBase': '知識庫',
|
||||||
'header.userManagement': '用戶管理',
|
'header.userManagement': '用戶管理',
|
||||||
'header.voiceCloneManagement': '音色克隆',
|
'header.voiceCloneManagement': '音色克隆',
|
||||||
'header.voiceResourceManagement': '音色資源',
|
'header.voiceResourceManagement': '音色資源',
|
||||||
|
|
@ -16,9 +17,14 @@ export default {
|
||||||
'header.paramDictionary': '參數字典',
|
'header.paramDictionary': '參數字典',
|
||||||
'header.paramManagement': '參數管理',
|
'header.paramManagement': '參數管理',
|
||||||
'header.dictManagement': '字典管理',
|
'header.dictManagement': '字典管理',
|
||||||
'header.agentTemplate': '預設角色模板', // 添加这一行
|
'header.agentTemplate': '預設角色模板',
|
||||||
'header.searchHistory': '搜索歷史',
|
'header.searchHistory': '搜索歷史',
|
||||||
'header.clearHistory': '清空歷史',
|
'header.clearHistory': '清空歷史',
|
||||||
|
'header.providerManagement': '字段管理',
|
||||||
|
'header.serverSideManagement': '服務端管理',
|
||||||
|
'header.changePassword': '修改密碼',
|
||||||
|
'header.logout': '退出登錄',
|
||||||
|
'header.searchPlaceholder': '輸入名稱搜索..',
|
||||||
|
|
||||||
// McpToolCallDialog组件文本
|
// McpToolCallDialog组件文本
|
||||||
'mcpToolCall.title': '工具調用',
|
'mcpToolCall.title': '工具調用',
|
||||||
|
|
@ -191,6 +197,23 @@ export default {
|
||||||
'firmwareDialog.firmwareNamePlaceholder': '請輸入固件名稱(板子+版本號)',
|
'firmwareDialog.firmwareNamePlaceholder': '請輸入固件名稱(板子+版本號)',
|
||||||
'firmwareDialog.firmwareType': '固件類型',
|
'firmwareDialog.firmwareType': '固件類型',
|
||||||
'firmwareDialog.firmwareTypePlaceholder': '請選擇固件類型',
|
'firmwareDialog.firmwareTypePlaceholder': '請選擇固件類型',
|
||||||
|
'firmwareDialog.version': '版本號',
|
||||||
|
'firmwareDialog.versionPlaceholder': '請輸入版本號(x.x.x格式)',
|
||||||
|
'firmwareDialog.firmwareFile': '固件文件',
|
||||||
|
'firmwareDialog.clickUpload': '點擊上傳',
|
||||||
|
'firmwareDialog.uploadTip': '只能上傳固件文件(.bin/.apk),且不超過100MB',
|
||||||
|
'firmwareDialog.uploadHint': '溫馨提示:請上傳合併前的xiaozhi.bin文件,而不是合併後的merged-binary.bin文件',
|
||||||
|
'firmwareDialog.remark': '備註',
|
||||||
|
'firmwareDialog.remarkPlaceholder': '請輸入備註信息',
|
||||||
|
'firmwareDialog.requiredFirmwareName': '請輸入固件名稱(板子+版本號)',
|
||||||
|
'firmwareDialog.requiredFirmwareType': '請選擇固件類型',
|
||||||
|
'firmwareDialog.requiredVersion': '請輸入版本號',
|
||||||
|
'firmwareDialog.versionFormatError': '版本號格式不正確,請輸入x.x.x格式',
|
||||||
|
'firmwareDialog.requiredFirmwareFile': '請上傳固件文件',
|
||||||
|
'firmwareDialog.invalidFileType': '只能上傳.bin/.apk格式的固件文件!',
|
||||||
|
'firmwareDialog.invalidFileSize': '固件文件大小不能超過100MB!',
|
||||||
|
'firmwareDialog.uploadSuccess': '固件文件上傳成功',
|
||||||
|
'firmwareDialog.uploadFailed': '文件上傳失敗',
|
||||||
|
|
||||||
// 聲紋對話框相關
|
// 聲紋對話框相關
|
||||||
'voicePrintDialog.addSpeaker': '添加說話人',
|
'voicePrintDialog.addSpeaker': '添加說話人',
|
||||||
|
|
@ -232,6 +255,21 @@ export default {
|
||||||
|
|
||||||
// 手動添加設備對話框相關
|
// 手動添加設備對話框相關
|
||||||
'manualAddDeviceDialog.title': '手動添加設備',
|
'manualAddDeviceDialog.title': '手動添加設備',
|
||||||
|
'manualAddDeviceDialog.deviceType': '設備型號',
|
||||||
|
'manualAddDeviceDialog.deviceTypePlaceholder': '請選擇設備型號',
|
||||||
|
'manualAddDeviceDialog.firmwareVersion': '固件版本',
|
||||||
|
'manualAddDeviceDialog.firmwareVersionPlaceholder': '請輸入固件版本',
|
||||||
|
'manualAddDeviceDialog.macAddress': 'Mac地址',
|
||||||
|
'manualAddDeviceDialog.macAddressPlaceholder': '請輸入Mac地址',
|
||||||
|
'manualAddDeviceDialog.confirm': '確定',
|
||||||
|
'manualAddDeviceDialog.cancel': '取消',
|
||||||
|
'manualAddDeviceDialog.requiredMacAddress': '請輸入Mac地址',
|
||||||
|
'manualAddDeviceDialog.invalidMacAddress': '請輸入正確的Mac地址格式,例如:00:1A:2B:3C:4D:5E',
|
||||||
|
'manualAddDeviceDialog.requiredDeviceType': '請選擇設備型號',
|
||||||
|
'manualAddDeviceDialog.requiredFirmwareVersion': '請輸入固件版本',
|
||||||
|
'manualAddDeviceDialog.getFirmwareTypeFailed': '獲取固件類型失敗',
|
||||||
|
'manualAddDeviceDialog.addSuccess': '設備添加成功',
|
||||||
|
'manualAddDeviceDialog.addFailed': '添加失敗',
|
||||||
|
|
||||||
// AddModelDialog組件相關
|
// AddModelDialog組件相關
|
||||||
'addModelDialog.requiredSupplier': '請選擇供應器',
|
'addModelDialog.requiredSupplier': '請選擇供應器',
|
||||||
|
|
@ -264,16 +302,11 @@ export default {
|
||||||
'register.requiredPassword': '密碼不能為空',
|
'register.requiredPassword': '密碼不能為空',
|
||||||
'register.requiredCaptcha': '驗證碼不能為空',
|
'register.requiredCaptcha': '驗證碼不能為空',
|
||||||
'register.requiredMobileCaptcha': '請輸入簡訊驗證碼',
|
'register.requiredMobileCaptcha': '請輸入簡訊驗證碼',
|
||||||
|
'register.invalidCaptcha': '驗證碼不正確',
|
||||||
'manualAddDeviceDialog.deviceType': '設備型號',
|
'register.passwordLength': '密碼長度必須在6-20位之間',
|
||||||
'manualAddDeviceDialog.deviceTypePlaceholder': '請選擇設備型號',
|
'register.usernameFormat': '用戶名格式不正確',
|
||||||
'manualAddDeviceDialog.firmwareVersion': '固件版本',
|
'register.confirmPasswordRequired': '確認密碼不能為空',
|
||||||
'manualAddDeviceDialog.firmwareVersionPlaceholder': '請輸入固件版本',
|
'register.sendCaptcha': '獲取驗證碼',
|
||||||
'manualAddDeviceDialog.macAddress': 'Mac地址',
|
|
||||||
'manualAddDeviceDialog.macAddressPlaceholder': '請輸入Mac地址',
|
|
||||||
'manualAddDeviceDialog.confirm': '確定',
|
|
||||||
'manualAddDeviceDialog.cancel': '取消',
|
|
||||||
'manualAddDeviceDialog.requiredMacAddress': '請輸入Mac地址',
|
|
||||||
|
|
||||||
// 參數對話框相關
|
// 參數對話框相關
|
||||||
'paramDialog.paramCode': '參數編碼',
|
'paramDialog.paramCode': '參數編碼',
|
||||||
|
|
@ -294,34 +327,6 @@ export default {
|
||||||
'paramDialog.booleanType': '布林值(boolean)',
|
'paramDialog.booleanType': '布林值(boolean)',
|
||||||
'paramDialog.arrayType': '陣列(array)',
|
'paramDialog.arrayType': '陣列(array)',
|
||||||
'paramDialog.jsonType': 'JSON物件(json)',
|
'paramDialog.jsonType': 'JSON物件(json)',
|
||||||
'manualAddDeviceDialog.invalidMacAddress': '請輸入正確的Mac地址格式,例如:00:1A:2B:3C:4D:5E',
|
|
||||||
'manualAddDeviceDialog.requiredDeviceType': '請選擇設備型號',
|
|
||||||
'manualAddDeviceDialog.requiredFirmwareVersion': '請輸入固件版本',
|
|
||||||
'manualAddDeviceDialog.getFirmwareTypeFailed': '獲取固件類型失敗',
|
|
||||||
'manualAddDeviceDialog.addSuccess': '設備添加成功',
|
|
||||||
'manualAddDeviceDialog.addFailed': '添加失敗',
|
|
||||||
'firmwareDialog.version': '版本號',
|
|
||||||
'firmwareDialog.versionPlaceholder': '請輸入版本號(x.x.x格式)',
|
|
||||||
'firmwareDialog.firmwareFile': '固件文件',
|
|
||||||
'firmwareDialog.clickUpload': '點擊上傳',
|
|
||||||
'firmwareDialog.uploadTip': '只能上傳固件文件(.bin/.apk),且不超過100MB',
|
|
||||||
'firmwareDialog.uploadHint': '溫馨提示:請上傳合併前的xiaozhi.bin文件,而不是合併後的merged-binary.bin文件',
|
|
||||||
'firmwareDialog.remark': '備註',
|
|
||||||
'firmwareDialog.remarkPlaceholder': '請輸入備註信息',
|
|
||||||
'firmwareDialog.requiredFirmwareName': '請輸入固件名稱(板子+版本號)',
|
|
||||||
'firmwareDialog.requiredFirmwareType': '請選擇固件類型',
|
|
||||||
'firmwareDialog.requiredVersion': '請輸入版本號',
|
|
||||||
'firmwareDialog.versionFormatError': '版本號格式不正確,請輸入x.x.x格式',
|
|
||||||
'firmwareDialog.requiredFirmwareFile': '請上傳固件文件',
|
|
||||||
'firmwareDialog.invalidFileType': '只能上傳.bin/.apk格式的固件文件!',
|
|
||||||
'firmwareDialog.invalidFileSize': '固件文件大小不能超過100MB!',
|
|
||||||
'firmwareDialog.uploadSuccess': '固件文件上傳成功',
|
|
||||||
'firmwareDialog.uploadFailed': '文件上傳失敗',
|
|
||||||
'header.providerManagement': '字段管理',
|
|
||||||
'header.serverSideManagement': '服務端管理',
|
|
||||||
'header.changePassword': '修改密碼',
|
|
||||||
'header.logout': '退出登錄',
|
|
||||||
'header.searchPlaceholder': '輸入名稱搜索..',
|
|
||||||
|
|
||||||
// 登录页面文本
|
// 登录页面文本
|
||||||
'login.title': '登錄',
|
'login.title': '登錄',
|
||||||
|
|
@ -345,51 +350,6 @@ export default {
|
||||||
'login.privacyPolicy': '《隱私政策》',
|
'login.privacyPolicy': '《隱私政策》',
|
||||||
'login.registerAccount': '註冊賬號',
|
'login.registerAccount': '註冊賬號',
|
||||||
|
|
||||||
// 注册页面文本
|
|
||||||
'register.title': '註冊賬號',
|
|
||||||
'register.welcome': '歡迎註冊',
|
|
||||||
'register.username': '用戶名',
|
|
||||||
'register.usernamePlaceholder': '請輸入用戶名',
|
|
||||||
'register.mobile': '手機號',
|
|
||||||
'register.mobilePlaceholder': '請輸入手機號碼',
|
|
||||||
'register.password': '密碼',
|
|
||||||
'register.passwordPlaceholder': '請輸入密碼',
|
|
||||||
'register.confirmPassword': '確認密碼',
|
|
||||||
'register.confirmPasswordPlaceholder': '請確認密碼',
|
|
||||||
'register.captcha': '驗證碼',
|
|
||||||
'register.captchaPlaceholder': '請輸入驗證碼',
|
|
||||||
'register.mobileCaptcha': '手機驗證碼',
|
|
||||||
'register.mobileCaptchaPlaceholder': '請輸入手機驗證碼',
|
|
||||||
'register.getMobileCaptcha': '獲取驗證碼',
|
|
||||||
'register.registerButton': '註冊',
|
|
||||||
'register.login': '登錄',
|
|
||||||
'register.inputCorrectMobile': '請輸入正確的手機號碼',
|
|
||||||
'register.inputCaptcha': '請輸入圖形驗證碼',
|
|
||||||
'register.captchaSendSuccess': '驗證碼發送成功',
|
|
||||||
'register.invalidCaptcha': '驗證碼不正確',
|
|
||||||
'register.passwordsNotMatch': '兩次輸入的密碼不一致',
|
|
||||||
'register.passwordLength': '密碼長度必須在6-20位之間',
|
|
||||||
'register.usernameRequired': '用戶名不能為空',
|
|
||||||
'register.usernameFormat': '用戶名格式不正確',
|
|
||||||
'register.mobileRequired': '手機號不能為空',
|
|
||||||
'register.passwordRequired': '密碼不能為空',
|
|
||||||
'register.confirmPasswordRequired': '確認密碼不能為空',
|
|
||||||
'register.goToLogin': '已有賬號,去登錄',
|
|
||||||
'register.agreeTo': '註冊即同意',
|
|
||||||
'register.userAgreement': '《用戶協議》',
|
|
||||||
'register.and': '和',
|
|
||||||
'register.privacyPolicy': '《隱私政策》',
|
|
||||||
'register.sendCaptcha': '獲取驗證碼',
|
|
||||||
'register.notAllowRegister': '當前不允許普通用戶註冊',
|
|
||||||
'register.captchaLoadFailed': '驗證碼加載失敗,點擊刷新',
|
|
||||||
'register.inputCorrectMobile': '請輸入正確的手機號碼',
|
|
||||||
'register.inputCaptcha': '請輸入圖形驗證碼',
|
|
||||||
'register.captchaSendSuccess': '驗證碼發送成功',
|
|
||||||
'register.captchaSendFailed': '驗證碼發送失敗',
|
|
||||||
'register.registerSuccess': '註冊成功!',
|
|
||||||
'register.registerFailed': '註冊失敗',
|
|
||||||
'register.passwordsNotMatch': '兩次輸入的密碼不一致',
|
|
||||||
|
|
||||||
// 忘记密码页面文本
|
// 忘记密码页面文本
|
||||||
'retrievePassword.title': '重置密碼',
|
'retrievePassword.title': '重置密碼',
|
||||||
'retrievePassword.welcome': '密碼找回',
|
'retrievePassword.welcome': '密碼找回',
|
||||||
|
|
@ -507,6 +467,7 @@ export default {
|
||||||
'chatHistory.downloadCurrentSession': '下載本會話聊天記錄',
|
'chatHistory.downloadCurrentSession': '下載本會話聊天記錄',
|
||||||
'chatHistory.downloadCurrentWithPreviousSessions': '下載本會話及前20條會話聊天記錄',
|
'chatHistory.downloadCurrentWithPreviousSessions': '下載本會話及前20條會話聊天記錄',
|
||||||
'chatHistory.downloadLinkFailed': '獲取下載鏈接失敗',
|
'chatHistory.downloadLinkFailed': '獲取下載鏈接失敗',
|
||||||
|
|
||||||
'cache.status': '緩存狀態',
|
'cache.status': '緩存狀態',
|
||||||
'cache.cdnEnabled': 'CDN模式已啟用',
|
'cache.cdnEnabled': 'CDN模式已啟用',
|
||||||
'cache.cdnDisabled': 'CDN模式已禁用',
|
'cache.cdnDisabled': 'CDN模式已禁用',
|
||||||
|
|
@ -672,6 +633,7 @@ export default {
|
||||||
'common.confirm': '確定',
|
'common.confirm': '確定',
|
||||||
'common.cancel': '取消',
|
'common.cancel': '取消',
|
||||||
'common.sensitive': '敏感',
|
'common.sensitive': '敏感',
|
||||||
|
'common.loading': '載入中',
|
||||||
|
|
||||||
// 語言切換
|
// 語言切換
|
||||||
'language.zhCN': '中文简体',
|
'language.zhCN': '中文简体',
|
||||||
|
|
@ -833,6 +795,7 @@ export default {
|
||||||
'modelConfig.intent': '意圖識別',
|
'modelConfig.intent': '意圖識別',
|
||||||
'modelConfig.tts': '語音合成',
|
'modelConfig.tts': '語音合成',
|
||||||
'modelConfig.memory': '記憶',
|
'modelConfig.memory': '記憶',
|
||||||
|
'modelConfig.rag': '知識庫',
|
||||||
'modelConfig.modelId': '模型ID',
|
'modelConfig.modelId': '模型ID',
|
||||||
'modelConfig.modelName': '模型名稱',
|
'modelConfig.modelName': '模型名稱',
|
||||||
'modelConfig.provider': '提供商',
|
'modelConfig.provider': '提供商',
|
||||||
|
|
@ -855,6 +818,7 @@ export default {
|
||||||
'modelConfig.partialDeleteFailed': '部分刪除失敗',
|
'modelConfig.partialDeleteFailed': '部分刪除失敗',
|
||||||
'modelConfig.deleteSuccess': '刪除成功',
|
'modelConfig.deleteSuccess': '刪除成功',
|
||||||
'modelConfig.deleteFailed': '刪除失敗',
|
'modelConfig.deleteFailed': '刪除失敗',
|
||||||
|
'modelConfig.deleteCancelled': '刪除已取消',
|
||||||
'modelConfig.duplicateSuccess': '創建副本成功',
|
'modelConfig.duplicateSuccess': '創建副本成功',
|
||||||
'modelConfig.duplicateFailed': '創建副本失敗',
|
'modelConfig.duplicateFailed': '創建副本失敗',
|
||||||
'modelConfig.saveSuccess': '保存成功',
|
'modelConfig.saveSuccess': '保存成功',
|
||||||
|
|
@ -881,6 +845,8 @@ export default {
|
||||||
'modelConfigDialog.modelInfo': '模型信息',
|
'modelConfigDialog.modelInfo': '模型信息',
|
||||||
'modelConfigDialog.enable': '是否啟用',
|
'modelConfigDialog.enable': '是否啟用',
|
||||||
'modelConfigDialog.setDefault': '設為默認',
|
'modelConfigDialog.setDefault': '設為默認',
|
||||||
|
'modelConfigDialog.modelId': '模型ID',
|
||||||
|
'modelConfigDialog.enterModelId': '未填冩將自動生成模型ID',
|
||||||
'modelConfigDialog.modelName': '模型名稱',
|
'modelConfigDialog.modelName': '模型名稱',
|
||||||
'modelConfigDialog.enterModelName': '請輸入模型名稱',
|
'modelConfigDialog.enterModelName': '請輸入模型名稱',
|
||||||
'modelConfigDialog.modelCode': '模型編碼',
|
'modelConfigDialog.modelCode': '模型編碼',
|
||||||
|
|
@ -914,6 +880,8 @@ export default {
|
||||||
'ttsModel.operation': '操作',
|
'ttsModel.operation': '操作',
|
||||||
'ttsModel.edit': '編輯',
|
'ttsModel.edit': '編輯',
|
||||||
'ttsModel.delete': '刪除',
|
'ttsModel.delete': '刪除',
|
||||||
|
'ttsModel.deleteVoiceSuccess': '成功刪除{count}個音色',
|
||||||
|
'ttsModel.deleteFailed': '刪除音色失敗',
|
||||||
'ttsModel.save': '保存',
|
'ttsModel.save': '保存',
|
||||||
'ttsModel.deselectAll': '取消全選',
|
'ttsModel.deselectAll': '取消全選',
|
||||||
'ttsModel.selectAll': '全選',
|
'ttsModel.selectAll': '全選',
|
||||||
|
|
@ -923,6 +891,8 @@ export default {
|
||||||
'ttsModel.unnamedVoice': '未命名音色',
|
'ttsModel.unnamedVoice': '未命名音色',
|
||||||
'ttsModel.finishEditingFirst': '請先完成目前編輯',
|
'ttsModel.finishEditingFirst': '請先完成目前編輯',
|
||||||
'ttsModel.selectVoiceToDelete': '請選擇要刪除的音色',
|
'ttsModel.selectVoiceToDelete': '請選擇要刪除的音色',
|
||||||
|
'ttsModel.warning': '警告',
|
||||||
|
'ttsModel.confirmDeleteVoice': '確定要刪除{count}個音色嗎?',
|
||||||
'ttsModel.operationFailed': '操作失敗',
|
'ttsModel.operationFailed': '操作失敗',
|
||||||
'ttsModel.operationClosed': '操作已關閉',
|
'ttsModel.operationClosed': '操作已關閉',
|
||||||
|
|
||||||
|
|
@ -976,6 +946,7 @@ export default {
|
||||||
'providerManagement.modelType.Memory': '記憶模組',
|
'providerManagement.modelType.Memory': '記憶模組',
|
||||||
'providerManagement.modelType.VAD': '語音活動檢測',
|
'providerManagement.modelType.VAD': '語音活動檢測',
|
||||||
'providerManagement.modelType.Plugin': '插件工具',
|
'providerManagement.modelType.Plugin': '插件工具',
|
||||||
|
'providerManagement.modelType.RAG': '知識庫',
|
||||||
|
|
||||||
// Provider Dialog 翻譯
|
// Provider Dialog 翻譯
|
||||||
'providerDialog.category': '類別',
|
'providerDialog.category': '類別',
|
||||||
|
|
@ -999,6 +970,7 @@ export default {
|
||||||
'providerDialog.booleanType': '布林值',
|
'providerDialog.booleanType': '布林值',
|
||||||
'providerDialog.dictType': '字典',
|
'providerDialog.dictType': '字典',
|
||||||
'providerDialog.arrayType': '分號分隔的列表',
|
'providerDialog.arrayType': '分號分隔的列表',
|
||||||
|
'providerDialog.ragType': '知識庫',
|
||||||
'providerDialog.defaultValue': '預設值',
|
'providerDialog.defaultValue': '預設值',
|
||||||
'providerDialog.inputDefaultValue': '請輸入預設值',
|
'providerDialog.inputDefaultValue': '請輸入預設值',
|
||||||
'providerDialog.operation': '操作',
|
'providerDialog.operation': '操作',
|
||||||
|
|
@ -1134,7 +1106,10 @@ export default {
|
||||||
'voiceClone.reset': '重置',
|
'voiceClone.reset': '重置',
|
||||||
'voiceClone.play': '播放',
|
'voiceClone.play': '播放',
|
||||||
'voiceClone.pause': '暫停',
|
'voiceClone.pause': '暫停',
|
||||||
|
'voiceClone.stop': '停止',
|
||||||
'voiceClone.cancel': '取消',
|
'voiceClone.cancel': '取消',
|
||||||
|
'voiceClone.warning': '警告',
|
||||||
|
'voiceClone.ok': '確定',
|
||||||
'voiceClone.nextStep': '下一步',
|
'voiceClone.nextStep': '下一步',
|
||||||
'voiceClone.prevStep': '上一步',
|
'voiceClone.prevStep': '上一步',
|
||||||
'voiceClone.upload': '上傳音頻',
|
'voiceClone.upload': '上傳音頻',
|
||||||
|
|
@ -1148,4 +1123,141 @@ export default {
|
||||||
'voiceClone.updateNameSuccess': '名稱更新成功',
|
'voiceClone.updateNameSuccess': '名稱更新成功',
|
||||||
'voiceClone.updateNameFailed': '名稱更新失敗',
|
'voiceClone.updateNameFailed': '名稱更新失敗',
|
||||||
'voiceClone.playFailed': '播放失敗',
|
'voiceClone.playFailed': '播放失敗',
|
||||||
|
'voiceClone.Details': '錯誤詳情',
|
||||||
|
|
||||||
|
// 知識庫管理頁面文本
|
||||||
|
'knowledgeBaseManagement.title': '知識庫',
|
||||||
|
'knowledgeBaseManagement.searchPlaceholder': '請輸入知識庫名稱搜尋',
|
||||||
|
'knowledgeBaseManagement.search': '搜尋',
|
||||||
|
'knowledgeBaseManagement.name': '知識庫名稱',
|
||||||
|
'knowledgeBaseManagement.description': '知識庫描述',
|
||||||
|
'knowledgeBaseManagement.documentCount': '文檔數量',
|
||||||
|
'knowledgeBaseManagement.status': '啟用',
|
||||||
|
'knowledgeBaseManagement.createdAt': '建立時間',
|
||||||
|
'knowledgeBaseManagement.operation': '操作',
|
||||||
|
'knowledgeBaseManagement.add': '新增',
|
||||||
|
'knowledgeBaseManagement.delete': '刪除',
|
||||||
|
'knowledgeBaseManagement.edit': '編輯',
|
||||||
|
'knowledgeBaseManagement.itemsPerPage': '條/頁',
|
||||||
|
'knowledgeBaseManagement.firstPage': '首頁',
|
||||||
|
'knowledgeBaseManagement.prevPage': '上一頁',
|
||||||
|
'knowledgeBaseManagement.nextPage': '下一頁',
|
||||||
|
'knowledgeBaseManagement.totalRecords': '共{total}條記錄',
|
||||||
|
'knowledgeBaseManagement.addKnowledgeBase': '新增知識庫',
|
||||||
|
'knowledgeBaseManagement.editKnowledgeBase': '編輯知識庫',
|
||||||
|
'knowledgeBaseManagement.getKnowledgeBaseListFailed': '獲取知識庫列表失敗',
|
||||||
|
'knowledgeBaseManagement.selectKnowledgeBaseFirst': '請先選擇需要刪除的知識庫',
|
||||||
|
'knowledgeBaseManagement.confirmBatchDelete': '確定要刪除選中的{count}個知識庫嗎?',
|
||||||
|
'knowledgeBaseManagement.batchDeleteSuccess': '成功刪除{count}個知識庫',
|
||||||
|
'knowledgeBaseManagement.deleteFailed': '刪除失敗,請重試',
|
||||||
|
'knowledgeBaseManagement.operationCancelled': '已取消刪除操作',
|
||||||
|
'knowledgeBaseManagement.updateSuccess': '修改成功',
|
||||||
|
'knowledgeBaseManagement.addSuccess': '新增成功',
|
||||||
|
'knowledgeBaseManagement.updateFailed': '更新失敗',
|
||||||
|
'knowledgeBaseManagement.addFailed': '新增失敗',
|
||||||
|
'knowledgeBaseManagement.selectAll': '全選',
|
||||||
|
'knowledgeBaseManagement.cancelSelectAll': '取消全選',
|
||||||
|
|
||||||
|
// 知識庫對話框文本
|
||||||
|
'knowledgeBaseDialog.title': '知識庫',
|
||||||
|
'knowledgeBaseDialog.name': '知識庫名稱',
|
||||||
|
'knowledgeBaseDialog.namePlaceholder': '請精確輸入知識庫名稱,才能提高知識庫呼叫的準確性',
|
||||||
|
'knowledgeBaseDialog.description': '知識庫描述',
|
||||||
|
'knowledgeBaseDialog.descriptionPlaceholder': '請詳細輸入知識庫描述,以便大模型更好地理解這個知識庫的总体內容',
|
||||||
|
'knowledgeBaseDialog.ragModel': 'RAG模型',
|
||||||
|
'knowledgeBaseDialog.ragModelPlaceholder': '請選擇RAG模型',
|
||||||
|
'knowledgeBaseDialog.ragModelRequired': '請選擇RAG模型',
|
||||||
|
'knowledgeBaseDialog.loadRAGModelsFailed': '載入RAG模型列表失敗',
|
||||||
|
'knowledgeBaseDialog.status': '狀態',
|
||||||
|
'knowledgeBaseDialog.statusEnabled': '啟用',
|
||||||
|
'knowledgeBaseDialog.statusDisabled': '禁用',
|
||||||
|
'knowledgeBaseDialog.save': '儲存',
|
||||||
|
'knowledgeBaseDialog.cancel': '取消',
|
||||||
|
'knowledgeBaseDialog.confirm': '確認',
|
||||||
|
'knowledgeBaseDialog.requiredName': '請輸入知識庫名稱',
|
||||||
|
'knowledgeBaseDialog.nameRequired': '請輸入知識庫名稱',
|
||||||
|
'knowledgeBaseDialog.nameLength': '知識庫名稱長度在1到50個字符之間',
|
||||||
|
'knowledgeBaseDialog.namePattern': '知識庫名稱只能包含中文、英文、數字、空格、下劃線和連字符',
|
||||||
|
'knowledgeBaseDialog.descriptionLength': '知識庫描述不能超過200個字符',
|
||||||
|
'knowledgeBaseDialog.nameLengthLimit': '知識庫名稱不能超過50個字符',
|
||||||
|
'knowledgeBaseDialog.descriptionLengthLimit': '知識庫描述不能超過200個字符',
|
||||||
|
|
||||||
|
// 知識庫管理頁面查看按鈕文本
|
||||||
|
'knowledgeBaseManagement.view': '管理文件',
|
||||||
|
|
||||||
|
// 知識庫文件上傳頁面文本
|
||||||
|
'knowledgeFileUpload.back': '返回',
|
||||||
|
'knowledgeFileUpload.searchPlaceholder': '請輸入文檔名稱搜尋',
|
||||||
|
'knowledgeFileUpload.search': '搜尋',
|
||||||
|
'knowledgeFileUpload.addDocument': '新增文檔',
|
||||||
|
'knowledgeFileUpload.documentName': '文檔名稱',
|
||||||
|
'knowledgeFileUpload.uploadTime': '上傳時間',
|
||||||
|
'knowledgeFileUpload.status': '狀態',
|
||||||
|
'knowledgeFileUpload.operation': '操作',
|
||||||
|
'knowledgeFileUpload.parse': '解析',
|
||||||
|
'knowledgeFileUpload.viewSlices': '查看切片',
|
||||||
|
'knowledgeFileUpload.delete': '刪除',
|
||||||
|
'knowledgeFileUpload.itemsPerPage': '條/頁',
|
||||||
|
'knowledgeFileUpload.firstPage': '首頁',
|
||||||
|
'knowledgeFileUpload.prevPage': '上一頁',
|
||||||
|
'knowledgeFileUpload.nextPage': '下一頁',
|
||||||
|
'knowledgeFileUpload.totalRecords': '共{total}條記錄',
|
||||||
|
'knowledgeFileUpload.uploadDocument': '上傳文檔',
|
||||||
|
'knowledgeFileUpload.documentNamePlaceholder': '請輸入文檔名稱',
|
||||||
|
'knowledgeFileUpload.file': '文件',
|
||||||
|
'knowledgeFileUpload.clickToUpload': '點擊上傳',
|
||||||
|
'knowledgeFileUpload.uploadTip': '支持的文件類型:PDF、DOC、DOCX、TXT、MD、CSV、XLS、XLSX、PPT、PPTX,单次批量上傳文件數不超過 32 個,每個文件大小不超過 10MB',
|
||||||
|
'knowledgeFileUpload.dragOrClick': '將文件拖到此處,或點擊上傳',
|
||||||
|
'knowledgeFileUpload.cancel': '取消',
|
||||||
|
'knowledgeFileUpload.confirm': '確定',
|
||||||
|
'knowledgeFileUpload.knowledgeBaseName': '知識庫名稱',
|
||||||
|
'knowledgeFileUpload.statusNotStarted': '未開始',
|
||||||
|
'knowledgeFileUpload.statusProcessing': '處理中',
|
||||||
|
'knowledgeFileUpload.statusCancelled': '已取消',
|
||||||
|
'knowledgeFileUpload.statusCompleted': '已完成',
|
||||||
|
'knowledgeFileUpload.statusFailed': '失敗',
|
||||||
|
'knowledgeFileUpload.uploadSuccess': '文檔上傳成功',
|
||||||
|
'knowledgeFileUpload.uploadFailed': '文檔上傳失敗',
|
||||||
|
'knowledgeFileUpload.parseSuccess': '文檔解析成功',
|
||||||
|
'knowledgeFileUpload.parseFailed': '文檔解析失敗',
|
||||||
|
'knowledgeFileUpload.deleteSuccess': '文檔刪除成功',
|
||||||
|
'knowledgeFileUpload.deleteFailed': '文檔刪除失敗',
|
||||||
|
'knowledgeFileUpload.confirmDelete': '確定要刪除此文檔嗎?',
|
||||||
|
'knowledgeFileUpload.confirmParse': '確定要解析該文檔嗎?',
|
||||||
|
'knowledgeFileUpload.nameRequired': '請輸入文檔名稱',
|
||||||
|
'knowledgeFileUpload.fileRequired': '請選擇要上傳的文件',
|
||||||
|
'knowledgeFileUpload.getListFailed': '獲取文檔列表失敗',
|
||||||
|
'knowledgeFileUpload.parseCancelled': '已取消解析',
|
||||||
|
'knowledgeFileUpload.deleteCancelled': '已取消删除',
|
||||||
|
'knowledgeFileUpload.selectFilesFirst': '請先選擇要刪除的文件',
|
||||||
|
'knowledgeFileUpload.selectAll': '全選',
|
||||||
|
'knowledgeFileUpload.deselectAll': '取消全選',
|
||||||
|
'knowledgeFileUpload.batchDelete': '刪除',
|
||||||
|
'knowledgeFileUpload.confirmBatchDelete': '確定要刪除選中的{count}個文件嗎?',
|
||||||
|
'knowledgeFileUpload.batchDeleteSuccess': '成功刪除{count}個文件',
|
||||||
|
'knowledgeFileUpload.batchDeleteFailed': '批量刪除失敗',
|
||||||
|
'knowledgeFileUpload.sliceCount': '切片數量',
|
||||||
|
'knowledgeFileUpload.add': '新增',
|
||||||
|
'knowledgeFileUpload.retrievalTest': '召回測試',
|
||||||
|
'knowledgeFileUpload.testQuestion': '測試問題',
|
||||||
|
'knowledgeFileUpload.testQuestionPlaceholder': '請輸入要測試的問題',
|
||||||
|
'knowledgeFileUpload.executeTest': '執行測試',
|
||||||
|
'knowledgeFileUpload.testResult': '測試結果:',
|
||||||
|
'knowledgeFileUpload.selectedFiles': '已選擇文件',
|
||||||
|
'knowledgeFileUpload.totalSlices': '共{total}條記錄',
|
||||||
|
'knowledgeFileUpload.slice': '切片',
|
||||||
|
'knowledgeFileUpload.noSliceData': '暫無切片數據',
|
||||||
|
'knowledgeFileUpload.firstPage': '首頁',
|
||||||
|
'knowledgeFileUpload.prevPage': '上一頁',
|
||||||
|
'knowledgeFileUpload.nextPage': '下一頁',
|
||||||
|
'knowledgeFileUpload.totalRecords': '共{total}條記錄',
|
||||||
|
'knowledgeFileUpload.testQuestion': '測試問題',
|
||||||
|
'knowledgeFileUpload.testQuestionPlaceholder': '請輸入要測試的問題',
|
||||||
|
'knowledgeFileUpload.runTest': '執行測試',
|
||||||
|
'knowledgeFileUpload.testResult': '測試結果:',
|
||||||
|
'knowledgeFileUpload.noRelatedSlices': '未找到相關切片',
|
||||||
|
'knowledgeFileUpload.comprehensiveSimilarity': '綜合相似度',
|
||||||
|
'knowledgeFileUpload.content': '內容:',
|
||||||
|
'knowledgeFileUpload.testQuestionRequired': '請輸入測試問題',
|
||||||
|
'knowledgeBaseDialog.descriptionRequired': '請輸入知识库描述',
|
||||||
}
|
}
|
||||||
|
|
@ -76,8 +76,7 @@ const routes = [
|
||||||
return import('../views/ModelConfig.vue')
|
return import('../views/ModelConfig.vue')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{ path: '/params-management',
|
||||||
path: '/params-management',
|
|
||||||
name: 'ParamsManagement',
|
name: 'ParamsManagement',
|
||||||
component: function () {
|
component: function () {
|
||||||
return import('../views/ParamsManagement.vue')
|
return import('../views/ParamsManagement.vue')
|
||||||
|
|
@ -87,6 +86,26 @@ const routes = [
|
||||||
title: '参数管理'
|
title: '参数管理'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{ path: '/knowledge-base-management',
|
||||||
|
name: 'KnowledgeBaseManagement',
|
||||||
|
component: function () {
|
||||||
|
return import('../views/KnowledgeBaseManagement.vue')
|
||||||
|
},
|
||||||
|
meta: {
|
||||||
|
requiresAuth: true,
|
||||||
|
title: '知识库管理'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ path: '/knowledge-file-upload',
|
||||||
|
name: 'KnowledgeFileUpload',
|
||||||
|
component: function () {
|
||||||
|
return import('../views/KnowledgeFileUpload.vue')
|
||||||
|
},
|
||||||
|
meta: {
|
||||||
|
requiresAuth: true,
|
||||||
|
title: '文档上传管理'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/server-side-management',
|
path: '/server-side-management',
|
||||||
|
|
@ -162,13 +181,6 @@ const routes = [
|
||||||
return import('../views/TemplateQuickConfig.vue')
|
return import('../views/TemplateQuickConfig.vue')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '/provider-management',
|
|
||||||
name: 'ProviderManagement',
|
|
||||||
component: function () {
|
|
||||||
return import('../views/ProviderManagement.vue')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
base: process.env.VUE_APP_PUBLIC_PATH || '/',
|
base: process.env.VUE_APP_PUBLIC_PATH || '/',
|
||||||
|
|
@ -190,7 +202,7 @@ VueRouter.prototype.push = function push(location) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 需要登录才能访问的路由
|
// 需要登录才能访问的路由
|
||||||
const protectedRoutes = ['home', 'RoleConfig', 'DeviceManagement', 'UserManagement', 'ModelConfig']
|
const protectedRoutes = ['home', 'RoleConfig', 'DeviceManagement', 'UserManagement', 'ModelConfig', 'KnowledgeBaseManagement', 'KnowledgeFileUpload']
|
||||||
|
|
||||||
// 路由守卫
|
// 路由守卫
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ export function getUUID() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证手机号格式
|
* 验证手机号格式
|
||||||
* @param {string} mobile 手机号
|
* @param {string} mobile 手机号
|
||||||
|
|
|
||||||