Merge branch 'dev' into hugo

This commit is contained in:
hugo committed 2026-05-21 22:03:20 +08:00
commit 452f6ebc6d
11 files changed
+1307 -689

No files matched your search

Vendored
+15 -15
View File
@@ -329,21 +329,21 @@ pipeline {
}
}
stage('Frontend Build (CI)') {
when {
expression { env.FRONTEND_CHANGED == 'true' }
}
steps {
echo '[Frontend Build] FRONTEND_CHANGED=true,容器内执行 npm ci && npm run build(与部署构建一致)'
sh '''
set -e
docker run --rm \
-v "${WORKSPACE}:/repo" \
-w /repo \
node:22-alpine sh -c "chmod +x scripts/ci_frontend_build.sh && ./scripts/ci_frontend_build.sh"
'''
}
}
// stage('Frontend Build (CI)') {
// when {
// expression { env.FRONTEND_CHANGED == 'true' }
// }
// steps {
// echo '[Frontend Build] FRONTEND_CHANGED=true,容器内执行 npm ci && npm run build(与部署构建一致)'
// sh '''
// set -e
// docker run --rm \
// -v "${WORKSPACE}:/repo" \
// -w /repo \
// node:22-alpine sh -c "chmod +x scripts/ci_frontend_build.sh && ./scripts/ci_frontend_build.sh"
// '''
// }
// }
stage('Deploy Dev') {
when {
+221
View File
@@ -0,0 +1,221 @@
# Git Hooks 团队启用指南
> 更新时间:2026-05-21
> 适用对象:全体开发同学
> 相关脚本:`.githooks/`、`scripts/install_git_hooks.sh`、`scripts/ci_frontend_build.sh`
团队启用 Git Hook 分两步:**仓库里已有 `.githooks/`(`git pull` 即有)**,**每人本机执行一次安装**。
---
## 1. 策略概览
本地两层 Hook + 远程 Jenkins CI,避免「日常只跑 `npm run dev`、上线 Jenkins `npm run build` 才报错」。
| 层级 | 时机 | 谁生效 | 检查内容 |
|------|------|--------|----------|
| **pre-commit** | `git commit` | 已安装 Hook 的本机 | models 须带 migration;暂存 `frontend/` 时跑 `vue-tsc` |
| **pre-push** | `git push` | 已安装 Hook 的本机 | 本次推送含 `frontend/` 变更时跑 `npm run build` |
| **Jenkins CI** | push 触发流水线 | 全员(不装 Hook 也跑) | `npm ci && npm run build`(`scripts/ci_frontend_build.sh`) |
- Hook **不会**随 `git clone` 自动启用,需每人配置 `core.hooksPath=.githooks`。
- 没装 Hook 时,主要靠 Jenkins **Frontend Build (CI)** 阶段兜底。
- 日常开发仍用 `npm run dev`;Hook 只在 commit / push 时额外检查。
---
## 2. 确认仓库里已有钩子文件
在项目根目录(与 `frontend`、`backend` 同级):
**PowerShell:**
```powershell
cd D:\path\to\hxops
git pull
dir .githooks
```
**Git Bash:**
```bash
cd /path/to/hxops
git pull
ls -la .githooks
```
应能看到:
- `pre-commit`
- `pre-push`
- `_common.sh`
若目录不存在,先 `git pull` 到包含这些文件的版本。
---
## 3. 本机启用(每人、每个 clone 做一次)
### 3.1 方式 A:安装脚本(推荐)
在 **Git Bash** 或 **WSL** 中:
```bash
cd /path/to/hxops
chmod +x scripts/install_git_hooks.sh
./scripts/install_git_hooks.sh
```
成功输出示例:
```text
[hook-install] Installed Git hooks successfully.
[hook-install] pre-commit: models 变更需带 migration;frontend 暂存时跑 vue-tsc
[hook-install] pre-push: 推送含 frontend 变更时跑 npm run build
[hook-install] core.hooksPath=.githooks
```
### 3.2 方式 B:PowerShell / CMD
不跑 bash 脚本时,在仓库根执行:
```powershell
cd D:\path\to\hxops
git config core.hooksPath .githooks
```
若 commit/push 时提示无执行权限,在 Git Bash 中补充:
```bash
chmod +x .githooks/pre-commit .githooks/pre-push
```
### 3.3 方式 C:hxops_menu 菜单
在 Git Bash 中运行 `hxops_menu.sh`,选择 **`hook`** 或 **`43`**,确认安装。
---
## 4. 验证是否生效
```powershell
git config --get core.hooksPath
```
应输出:`.githooks`
安装前端依赖(Hook 跑检查前必需):
```powershell
cd frontend
npm install
```
可选自测:暂存一个 `frontend/` 下的小改动后 `git commit`(会触发 `vue-tsc`),测完 `git reset` 即可。
---
## 5. 装好后会自动做什么
### 5.1 pre-commit
| 条件 | 行为 |
|------|------|
| 暂存了 `backend/app/models.py`,但未暂存 `backend/migrations/versions/*.py` | **拒绝 commit** |
| 暂存路径含 `frontend/` | 运行 `npx vue-tsc -b`(需已有 `node_modules`) |
| 未暂存 `frontend/` | 不跑前端检查 |
`SKIP_FRONTEND_HOOKS` **不能**跳过 models/migration 检查。
### 5.2 pre-push
| 条件 | 行为 |
|------|------|
| 本次 push 的提交 diff 含 `frontend/` | 运行 `npm run build`(`vue-tsc -b && vite build`) |
| 无 `frontend/` 变更 | 直接通过 |
### 5.3 Jenkins CI
- 在 **Detect Changes** 之后、**Deploy** 之前执行。
- 仅当 `FRONTEND_CHANGED=true` 时在 `node:22-alpine` 容器内执行 `scripts/ci_frontend_build.sh`。
---
## 6. 团队落地清单(可转发)
1. **新同事**:`git clone` → `cd frontend && npm install` → 按本文 **§3** 安装 Hook → **§4** 验证。
2. **老同事**:`git pull` 后若从未装过,补做一次安装。
3. **换电脑 / 新 clone**:每个新目录都要再装一次(`core.hooksPath` 写在本地 `.git/config`,不随 push 同步)。
4. **Windows**:建议用 Git for Windows 自带的 Git Bash 执行 commit/push;PowerShell 可用 **§3.2** 仅完成 Hook 路径配置。
---
## 7. 应急跳过(不要常态化)
### 7.1 只跳过前端检查
migration 规则在 pre-commit 中仍会执行。
**Git Bash:**
```bash
SKIP_FRONTEND_HOOKS=1 git commit -m "your message"
SKIP_FRONTEND_HOOKS=1 git push
```
**PowerShell(当前终端会话):**
```powershell
$env:SKIP_FRONTEND_HOOKS = "1"
git commit -m "your message"
git push
```
### 7.2 跳过全部 Hook
```bash
git commit --no-verify
git push --no-verify
```
同时跳过 migration、vue-tsc、build 等所有 Hook。
### 7.3 环境变量说明
| 变量 | 默认值 | 生效条件 |
|------|--------|----------|
| `SKIP_FRONTEND_HOOKS` | 未设置 | 设为 `1` 时跳过前端 vue-tsc / build |
| `SKIP_GIT_HOOKS` | 未设置 | 设为 `1` 时跳过前端检查(与上一项在前端逻辑等价) |
仓库内**没有**预置这些变量的配置文件,仅在单次命令前临时设置。
---
## 8. 常见问题
| 现象 | 处理 |
|------|------|
| `dir .githooks` 找不到 | `git pull`;确认在仓库根目录 |
| `missing hook file` | 同上,确保 `.githooks` 已拉取 |
| `frontend/node_modules 不存在` | `cd frontend && npm install` |
| PowerShell 无法执行 `.sh` | 用 **§3.2** 的 `git config`,或改用 Git Bash |
| 装了 Hook 仍不拦截 | 确认 `git config --get core.hooksPath`;是否用了 `--no-verify` |
| 想取消 Hook | `git config --unset core.hooksPath` |
---
## 9. 相关文件
| 路径 | 说明 |
|------|------|
| `.githooks/pre-commit` | 提交时检查 |
| `.githooks/pre-push` | 推送时检查 |
| `.githooks/_common.sh` | 共用逻辑 |
| `scripts/install_git_hooks.sh` | 一键安装 |
| `scripts/ci_frontend_build.sh` | Jenkins / 本地 CI 同款 build |
| `Jenkinsfile` | `Frontend Build (CI)` 阶段 |
| `docs/新人环境搭建与配置文档.md` | 新人环境 §4.2 简要说明 |
---
维护建议:调整 Hook 规则或 Jenkins 构建步骤后,请同步更新本文档。
+5 -15
View File
@@ -65,31 +65,21 @@ cd hxops
### 4.2 安装 Git Hooks(推荐,每人 clone 后执行一次)
仓库根目录的 `.githooks/` 会随代码拉取;**不会自动生效**,需在本机启用:
完整说明见 **[Git Hooks 团队启用指南](./GIT_HOOKS.md)**(策略、安装步骤、验证、跳过方式、常见问题)。
| Hook | 时机 | 检查内容 |
|------|------|----------|
| `pre-commit` | `git commit` | 改 `models.py` 须同时提交 migration;暂存 `frontend/` 时跑 `vue-tsc` |
| `pre-push` | `git push` | 本次推送含 `frontend/` 变更时跑 `npm run build`(与 Jenkins 部署一致) |
**Git Bash / WSL:**
快速安装:
```bash
chmod +x scripts/install_git_hooks.sh .githooks/pre-commit .githooks/pre-push
# Git Bash / WSL
./scripts/install_git_hooks.sh
```
**PowerShell(仅启用钩子目录):**
```powershell
# PowerShell
git config core.hooksPath .githooks
```
验证:`git config --get core.hooksPath` 应输出 `.githooks`。
前置:已执行 `cd frontend && npm install`。应急跳过前端检查:`$env:SKIP_FRONTEND_HOOKS="1"`(bash 为 `SKIP_FRONTEND_HOOKS=1`)。
Jenkins 在检测到 `frontend/` 变更时会再跑一遍同款构建(`scripts/ci_frontend_build.sh`),作为 Hook 被跳过时的兜底。
验证:`git config --get core.hooksPath` → `.githooks`;前置:`cd frontend && npm install`。
### 4.3 常用 Git 操作示例
+354
View File
@@ -0,0 +1,354 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Activity, FolderPlus, Pencil, Play, Settings, Trash2, Wrench, X } from 'lucide-vue-next';
import DifyHealthDialog from './DifyHealthDialog.vue';
import DifySettingsDialog from './DifySettingsDialog.vue';
import {
createKbGroup,
deleteKbGroup,
getKbGroupsSafe,
getKbJobsSafe,
runKbJob,
updateKbGroup,
type KbGroup,
type KbJob,
} from '../../api/kb';
const router = useRouter();
const groups = ref<KbGroup[]>([]);
const jobs = ref<KbJob[]>([]);
const isSubmitting = ref(false);
const isRefreshing = ref(false);
const editingGroupId = ref<number | null>(null);
const form = ref({
name: '',
description: '',
});
const feedback = ref('');
const feedbackType = ref<'success' | 'error' | ''>('');
const runningJobId = ref<number | string | null>(null);
const settingsDialogOpen = ref(false);
const healthDialogOpen = ref(false);
const formTitle = computed(() => editingGroupId.value ? '编辑知识库分组' : '新建知识库分组');
const formDescription = computed(() => editingGroupId.value
? '修改知识库分组名称和描述,保存后会立即刷新列表。'
: '用于验证主平台里的知识库管理入口和基础接口壳。');
const submitText = computed(() => {
if (isSubmitting.value) return editingGroupId.value ? '保存中...' : '提交中...';
return editingGroupId.value ? '保存修改' : '创建分组';
});
const loadData = async () => {
isRefreshing.value = true;
const [groupsResult, jobsResult] = await Promise.all([getKbGroupsSafe(), getKbJobsSafe()]);
if (groupsResult.ok) {
groups.value = groupsResult.data;
} else {
feedback.value = groupsResult.error || '加载知识库分组失败';
feedbackType.value = 'error';
}
if (jobsResult.ok) {
jobs.value = jobsResult.data;
} else {
feedback.value = jobsResult.error || '加载任务列表失败';
feedbackType.value = 'error';
}
isRefreshing.value = false;
};
const resetForm = () => {
editingGroupId.value = null;
form.value = { name: '', description: '' };
};
const handleCreateGroup = async () => {
if (!form.value.name.trim()) {
feedback.value = '请输入知识库分组名称';
feedbackType.value = 'error';
return;
}
isSubmitting.value = true;
const payload = {
name: form.value.name.trim(),
description: form.value.description.trim(),
};
const result = editingGroupId.value
? await updateKbGroup(editingGroupId.value, payload)
: await createKbGroup(payload);
isSubmitting.value = false;
if (!result.ok) {
feedback.value = result.error || '创建失败';
feedbackType.value = 'error';
return;
}
feedback.value = editingGroupId.value ? '知识库分组已更新' : '知识库分组创建成功';
feedbackType.value = 'success';
resetForm();
await loadData();
};
const handleEditGroup = (group: KbGroup) => {
editingGroupId.value = group.id;
form.value = {
name: group.name,
description: group.description || '',
};
feedback.value = '';
feedbackType.value = '';
};
const handleDeleteGroup = async (group: KbGroup) => {
const confirmed = window.confirm(`确认删除知识库分组「${group.name}」吗?`);
if (!confirmed) return;
const result = await deleteKbGroup(group.id);
if (!result.ok) {
feedback.value = result.error || '删除失败';
feedbackType.value = 'error';
return;
}
if (editingGroupId.value === group.id) {
resetForm();
}
feedback.value = '知识库分组已删除';
feedbackType.value = 'success';
await loadData();
};
const handleRunJob = async (job: KbJob) => {
runningJobId.value = job.id;
const result = await runKbJob(job.id);
runningJobId.value = null;
if (!result.ok) {
feedback.value = result.error || '任务执行失败';
feedbackType.value = 'error';
return;
}
feedback.value = result.run_result || '任务已执行';
feedbackType.value = 'success';
await loadData();
};
onMounted(async () => {
await loadData();
});
defineExpose({ loadData });
</script>
<template>
<div class="animate-fade-in-up">
<div class="flex flex-col gap-4 border-b border-gray-100 bg-white px-8 py-6 dark:border-slate-700 dark:bg-slate-900 lg:flex-row lg:items-start lg:justify-between">
<div class="min-w-0 flex-1">
<h2 class="text-xl font-bold text-gray-900 dark:text-slate-100">知识库管理</h2>
<p class="mt-1 text-sm text-gray-500 dark:text-slate-400">
第一阶段先承接分组、任务和 Dify 管理入口,后续再接入清洗链路。
</p>
</div>
<div class="flex w-full shrink-0 flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:justify-end">
<div
class="inline-flex w-full items-stretch divide-x divide-slate-200 overflow-hidden rounded-xl border border-slate-200 bg-slate-50 dark:divide-slate-600 dark:border-slate-600 dark:bg-slate-800/80 sm:w-auto"
role="toolbar"
aria-label="知识库工具操作"
>
<button
type="button"
@click="settingsDialogOpen = true"
class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4"
title="Dify 设置"
>
<Settings class="h-4 w-4 shrink-0" />
<span class="whitespace-nowrap">Dify 设置</span>
</button>
<button
type="button"
@click="healthDialogOpen = true"
class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4"
title="健康检查"
>
<Activity class="h-4 w-4 shrink-0" />
<span class="whitespace-nowrap">健康检查</span>
</button>
</div>
<button
type="button"
@click="router.push('/kb/workspace')"
class="inline-flex w-full items-center justify-center gap-2 rounded-xl bg-blue-600 px-5 py-2.5 text-sm font-medium text-white shadow-lg shadow-blue-200 transition-colors hover:bg-blue-700 sm:w-auto"
>
<Wrench class="h-4 w-4 shrink-0" />
<span class="whitespace-nowrap">前往工作台</span>
</button>
</div>
</div>
<div class="grid grid-cols-1 gap-6 bg-white p-8 dark:bg-slate-900 xl:grid-cols-[420px_minmax(0,1fr)]">
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
<div class="mb-5 flex items-center gap-3">
<div class="flex h-10 w-10 items-center justify-center rounded-2xl bg-brand-50 text-brand-600 dark:bg-brand-500/10">
<FolderPlus class="h-5 w-5" />
</div>
<div>
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ formTitle }}</h3>
<p class="text-sm text-slate-500 dark:text-slate-400">{{ formDescription }}</p>
</div>
</div>
<div class="space-y-4">
<div>
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">分组名称</label>
<input v-model="form.name" class="input-field" placeholder="例如:财务制度库" />
</div>
<div>
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">分组描述</label>
<textarea
v-model="form.description"
rows="4"
class="input-field"
placeholder="描述该知识库分组的业务范围或清洗目标"
/>
</div>
<div class="flex flex-wrap items-center justify-end gap-2 border-t border-slate-100 pt-4 dark:border-slate-700">
<button
type="button"
@click="handleCreateGroup"
:disabled="isSubmitting"
class="inline-flex items-center gap-1.5 rounded-xl bg-blue-600 px-5 py-2 text-sm font-medium text-white shadow-md shadow-blue-200 transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60"
>
<FolderPlus v-if="!isSubmitting" class="h-4 w-4 shrink-0" />
{{ submitText }}
</button>
<button
v-if="editingGroupId"
@click="resetForm"
type="button"
class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
>
<X class="h-4 w-4 shrink-0" />
取消编辑
</button>
</div>
<p
v-if="feedback"
class="text-sm"
:class="feedbackType === 'error' ? 'text-rose-500' : 'text-emerald-600 dark:text-emerald-400'"
>
{{ feedback }}
</p>
</div>
</section>
<div class="space-y-6">
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
<div class="mb-4 flex items-center justify-between">
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">知识库分组概览</h3>
<span class="text-xs text-slate-400">{{ isRefreshing ? '加载中...' : '/api/kb/groups' }}</span>
</div>
<div v-if="groups.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
当前暂无分组,或知识库接口尚未联调完成。
</div>
<div v-else class="grid grid-cols-1 gap-3 md:grid-cols-2">
<div
v-for="group in groups"
:key="group.id"
class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"
>
<div class="flex items-start justify-between gap-3">
<div class="min-w-0">
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ group.name }}</div>
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ group.description || '暂无描述' }}</div>
</div>
<div class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
{{ group.document_count ?? 0 }} 文档
</div>
</div>
<div class="mt-4 flex flex-wrap items-center justify-between gap-3">
<div class="text-xs text-slate-400">
更新时间:{{ group.updated_at || '--' }}
</div>
<div class="flex items-center gap-2">
<button
@click="handleEditGroup(group)"
class="inline-flex items-center gap-1 rounded-xl border border-slate-200 px-3 py-2 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
>
<Pencil class="h-3.5 w-3.5" />
编辑
</button>
<button
@click="handleDeleteGroup(group)"
class="inline-flex items-center gap-1 rounded-xl border border-rose-200 px-3 py-2 text-xs font-medium text-rose-600 transition-colors hover:bg-rose-50 dark:border-rose-500/30 dark:text-rose-400 dark:hover:bg-rose-500/10"
>
<Trash2 class="h-3.5 w-3.5" />
删除
</button>
</div>
</div>
</div>
</div>
</section>
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
<div class="mb-4 flex items-center justify-between">
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">任务队列占位</h3>
<span class="text-xs text-slate-400">/api/kb/jobs</span>
</div>
<div v-if="jobs.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
暂无任务。第二阶段会在这里接入清洗、同步和重试任务。
</div>
<div v-else class="space-y-3">
<div
v-for="job in jobs"
:key="job.id"
class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"
>
<div class="flex items-start justify-between gap-3">
<div class="min-w-0">
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ job.job_type }}</div>
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ job.created_at || '--' }}</div>
<div class="mt-2 text-sm text-slate-500 dark:text-slate-400">
{{ job.message || '暂无任务说明' }}
</div>
<div class="mt-2 text-xs text-slate-400">
文档:{{ job.document_id ?? '--' }} · 版本:{{ job.document_version_id ?? '--' }} · 进度:{{ job.progress ?? 0 }}%
</div>
</div>
<span class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
{{ job.status }}
</span>
</div>
<div class="mt-3 flex justify-end" v-if="['clean', 'sync_dify'].includes(job.job_type) && job.status !== 'success'">
<button
@click="handleRunJob(job)"
:disabled="runningJobId === job.id"
class="inline-flex items-center gap-1 rounded-xl border border-brand-200 px-3 py-2 text-xs font-medium text-brand-700 transition-colors hover:bg-brand-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-brand-500/30 dark:text-brand-300 dark:hover:bg-brand-500/10"
>
<Play class="h-3.5 w-3.5" />
{{ runningJobId === job.id ? '执行中...' : '执行任务' }}
</button>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<DifySettingsDialog
:open="settingsDialogOpen"
@close="settingsDialogOpen = false"
@saved="(message) => { feedback = message; feedbackType = 'success'; void loadData(); }"
@error="(message) => { feedback = message; feedbackType = 'error'; }"
/>
<DifyHealthDialog
:open="healthDialogOpen"
@close="healthDialogOpen = false"
@error="(message) => { feedback = message; feedbackType = 'error'; }"
/>
</template>
+1
View File
@@ -54,6 +54,7 @@ export const config = {
users: true, // 用户管理
departments: true, // 部门管理
agents: true, // 应用管理
knowledge_base: true, // 知识库管理
announcements: true, // 公告管理
questions: true, // 常用问题
wecom: true, // 企业微信
+513 -14
View File
@@ -112,9 +112,9 @@ const messages = {
},
landing: {
hero: {
prefix: 'Unleash the Power of',
highlight: 'Generative AI',
subtitle: 'Access a suite of powerful AI agents tailored for your enterprise needs. Secure, scalable, and intelligent.'
prefix: 'Hexin Precision',
highlight: 'AI Agent Application Platform',
subtitle: 'In the world of AI, we hope you enjoy your work and live happily.'
},
agent: {
role: 'AI Assistant'
@@ -245,6 +245,7 @@ const messages = {
users: 'User Maintenance',
departments: 'Departments',
agents: 'Agent Management',
knowledgeBase: 'Knowledge Base',
announcements: 'Announcements',
questions: 'Common Questions',
wecom: 'WeCom',
@@ -844,6 +845,57 @@ const messages = {
loadingAgent: 'Loading agent...',
thinking: 'Generating response...',
disclaimer: 'AI can make mistakes. Please verify important information.',
createNewChat: 'New Chat',
clearAll: 'Clear All',
clearOneRecord: 'Clear This Record',
agents: 'Agents',
noOtherAgents: 'No other agents',
noAvailableAgents: 'No available agents',
collapseAgents: 'Collapse agents',
expandAgents: 'Expand agents',
generalFeedback: 'Feedback',
language: 'Language',
langZhCn: 'Simplified Chinese',
langEn: 'English',
langZhTw: 'Traditional Chinese',
langTh: 'Thai',
logout: 'Logout',
welcomeTitle: 'Hello, I am Hexin AI Digital Human',
askAnything: 'Ask me anything...',
voiceFeature: 'Voice feature',
collapseBrowser: 'Collapse Browser',
openBrowser: 'Open Browser',
browser: 'Browser',
closeBrowser: 'Close Browser',
browserInputPlaceholder: 'Enter URL, e.g. https://example.com',
open: 'Open',
refresh: 'Refresh',
openInNewTab: 'Open in new tab',
browserHint1: 'Open webpages here while chatting.',
browserHint2: 'Supports https://, localhost, and intranet IP.',
feedbackSubmitSuccess: 'Feedback submitted successfully',
noData: 'No data',
loading: 'Loading...',
loadMore: 'Load more',
loadAll: 'Load all',
noMoreData: 'No more data',
loginOaSystem: 'Login OA System',
employeeId: 'Employee ID',
enterOaPassword: 'Please enter OA password',
confirmLogin: 'Confirm login',
currentUser: 'Current User',
dayUnit: 'day',
hourUnit: 'hour',
leaveBalanceInsufficient: '**{label} balance is insufficient.**',
leaveBalanceTableLeaveType: 'Leave Type',
leaveBalanceTableYear: 'Year',
leaveBalanceTableAvailable: 'Available',
leaveBalanceTableUsed: 'Used',
leaveBalanceTableRemaining: 'Remaining',
leaveBalanceContactHr: 'If needed, please contact HR to confirm leave data.',
leaveConfirmPrompt: 'Please confirm the following leave information before submitting to OA.',
oaLeaveSubmitFailed: 'OA leave submission failed, please try again later.',
leaveSubmitFailedPrefix: 'Leave submission failed: {error}',
suggestions: {
whatCanYouDo: 'What can you do?',
helpWriteReport: 'Help me write a report',
@@ -858,8 +910,81 @@ const messages = {
selectRating: 'Please select a rating first',
commentPlaceholder: 'Add a comment (optional)...',
sent: 'Sent'
}
},
oaPopupBlocked: 'Popup blocked. Please allow popups and retry.',
oaLoggingTitle: 'Logging into OA...',
oaLoggingBody: 'Logging into OA, please wait...',
noEmployeeId: 'Cannot login OA without employee ID.',
oaPasswordRequired: 'Please enter OA password.',
oaRequestMissing: 'OA request ID is missing.',
devComingSoon: 'This feature is under development',
previewUnavailable: 'Preview is temporarily unavailable',
invalidBrowserUrl: 'Please enter a valid URL such as https://example.com or localhost:8891',
enterBrowserUrl: 'Please enter a URL first',
queryLeaveBalance: 'Checking your leave balance, please wait...',
leaveFormIntro: 'We generated the leave form for you. Fill and submit below, or ',
oaLeaveDirectLink: 'apply directly in OA',
oaLeaveDirectHintKey: 'or',
leaveApplicantRequired: 'Leave applicant is required.',
leaveTypeRequired: 'Please select leave type.',
leaveAgentRequired: 'Please select agent.',
startTimeRequired: 'Please select a valid start time.',
endTimeRequired: 'Please select a valid end time.',
durationInvalid: 'Duration must be greater than 0 hour.',
leaveResultSubmitted: 'Leave request submitted to OA. Please check:',
confirmClearHistory: 'Clear all chat history? This cannot be undone.',
confirmDeleteHistoryItem: 'Delete this chat history?',
leaveFiller: 'Filler',
createdAt: 'Created At',
leaveType: 'Leave Type',
selectLeaveType: 'Select leave type',
leaveApplicant: 'Applicant',
selectLeaveApplicant: 'Select applicant',
pickLeaveApplicant: 'Pick applicant',
leaveAgent: 'Agent',
selectLeaveAgent: 'Select agent',
pickLeaveAgent: 'Pick agent',
startTime: 'Start Time',
endTime: 'End Time',
duration: 'Duration',
isOutOfOffice: 'Out of office',
isWorkInjury: 'Work injury',
yes: 'Yes',
no: 'No',
leaveConfirmGenerated: 'Confirmation generated. You can edit and submit again.',
submitting: 'Submitting...',
submit: 'Submit',
leaveFillerInfo: 'Filler Info',
leaveApplicantInfo: 'Applicant Info',
leaveInfo: 'Leave Info',
notSelected: 'Not selected',
leaveFillerTitle: 'Filler Title',
leaveFillerDept: 'Filler Department',
leaveFillerCompany: 'Filler Company',
leaveApplicantTitle: 'Applicant Title',
leaveApplicantDept: 'Applicant Department',
leaveApplicantCompany: 'Applicant Company',
leaveAgentTitle: 'Agent Title',
leaveAgentDept: 'Agent Department',
leaveAgentCompany: 'Agent Company',
backToEdit: 'Back to edit',
confirming: 'Confirming...',
confirmed: 'Confirmed',
confirm: 'Confirm',
oaSubmitResult: 'OA submit result',
oaSubmitFailed: 'OA submit failed',
leaveResultPrefix: 'Leave request submitted to OA. View:',
leaveResultLinkText: '[ View in OA ]',
requestNo: 'Request No',
submitTime: 'Submitted At',
sourceDocs: 'Source Documents',
attributionParts: 'Attribution Parts',
selectWho: 'Select {role}',
oaDataConnected: 'Connected to OA database view query.',
searchByNameOrEmployeeId: 'Search by name or employee ID, press Enter',
name: 'Name',
employeeIdRequired: 'Employee ID is required.'
},
profile: {
title: 'Profile',
personalInfo: 'Personal Information',
@@ -1133,6 +1258,7 @@ const messages = {
users: '用户管理',
departments: '部门管理',
agents: '应用管理',
knowledgeBase: '知识库管理',
announcements: '公告管理',
questions: '常用问题',
wecom: '企业微信',
@@ -1711,6 +1837,57 @@ const messages = {
loadingAgent: '正在加载应用...',
thinking: '正在生成回答...',
disclaimer: 'AI 可能会犯错,请核实重要信息。',
createNewChat: '创建新对话',
clearAll: '清空全部',
clearOneRecord: '清除该记录',
agents: '智能体',
noOtherAgents: '暂无其他智能体',
noAvailableAgents: '暂无可用智能体',
collapseAgents: '收起智能体',
expandAgents: '展开智能体',
generalFeedback: '意见反馈',
language: '语言',
langZhCn: '简体中文',
langEn: 'English',
langZhTw: '繁體中文',
langTh: 'ไทย',
logout: '退出登录',
welcomeTitle: '你好,我是和信AI数字人',
askAnything: '问我任何事...',
voiceFeature: '语音功能',
collapseBrowser: '收起浏览器',
openBrowser: '打开浏览器',
browser: '浏览器',
closeBrowser: '关闭浏览器',
browserInputPlaceholder: '输入网址,例如 https://example.com',
open: '打开',
refresh: '刷新',
openInNewTab: '新标签打开',
browserHint1: '在这里直接打开网页,边聊天边查看内容。',
browserHint2: '支持输入 `https://`、`localhost` 或内网 IP 地址。',
feedbackSubmitSuccess: '反馈提交成功',
noData: '暂无数据',
loading: '加载中...',
loadMore: '加载更多',
loadAll: '加载全部',
noMoreData: '没有更多数据了',
loginOaSystem: '登录OA系统',
employeeId: '工号',
enterOaPassword: '请输入OA登录密码',
confirmLogin: '确认登录',
currentUser: '当前用户',
dayUnit: '天',
hourUnit: '小时',
leaveBalanceInsufficient: '**{label}余额不足,暂无可用假期。**',
leaveBalanceTableLeaveType: '假别',
leaveBalanceTableYear: '年度',
leaveBalanceTableAvailable: '可休',
leaveBalanceTableUsed: '已休',
leaveBalanceTableRemaining: '当前剩余',
leaveBalanceContactHr: '如有疑问,请联系人事部门确认假期数据。',
leaveConfirmPrompt: '请确认以下请假信息,确认无误后再提交到 OA。',
oaLeaveSubmitFailed: 'OA 请假提交失败,请稍后重试。',
leaveSubmitFailedPrefix: '请假单提交失败:{error}',
suggestions: {
whatCanYouDo: '你能做什么?',
helpWriteReport: '帮我写一份报告',
@@ -1725,7 +1902,80 @@ const messages = {
selectRating: '请先选择评分',
commentPlaceholder: '添加评论(可选)...',
sent: '已发送'
}
},
oaPopupBlocked: '浏览器拦截了 OA 页面,请允许弹出窗口后重试。',
oaLoggingTitle: '正在登录OA系统...',
oaLoggingBody: '正在登录OA系统,请稍候...',
noEmployeeId: '没有工号信息无法登录OA系统!',
oaPasswordRequired: '请输入OA登录密码!',
oaRequestMissing: '当前未获取到 OA 单据编号,暂时无法打开单据详情。',
devComingSoon: '该功能正在开发中',
previewUnavailable: '当前源文件暂时无法预览',
invalidBrowserUrl: '请输入有效的网址,例如 https://example.com 或 localhost:8891',
enterBrowserUrl: '请先输入可打开的网址。',
queryLeaveBalance: '正在查询您的假期余额,请稍候...',
leaveFormIntro: '已为你生成请假申请表,请直接在下方填写并提交。或',
oaLeaveDirectLink: '登录OA系统直接申请',
oaLeaveDirectHintKey: '或登录OA系统直接申请',
leaveApplicantRequired: '请假人不能为空。',
leaveTypeRequired: '请选择假别。',
leaveAgentRequired: '请选择代理人。',
startTimeRequired: '请选择正确的开始时间。',
endTimeRequired: '请选择正确的结束时间。',
durationInvalid: '时长必须大于0小时,请检查开始时间和结束时间。',
leaveResultSubmitted: '请假单已推送到 OA,具体单据请 【 登录OA系统查看提交】',
confirmClearHistory: '确定要清除全部聊天历史记录吗?此操作不可恢复。',
confirmDeleteHistoryItem: '确定要删除这条聊天记录吗?',
leaveFiller: '填单人',
createdAt: '创建时间',
leaveType: '假别',
selectLeaveType: '请选择假别',
leaveApplicant: '请假人',
selectLeaveApplicant: '请选择请假人',
pickLeaveApplicant: '选择请假人',
leaveAgent: '代理人',
selectLeaveAgent: '请选择代理人',
pickLeaveAgent: '选择代理人',
startTime: '开始时间',
endTime: '结束时间',
duration: '时长',
isOutOfOffice: '是否外出',
isWorkInjury: '是否为工伤',
yes: '是',
no: '否',
leaveConfirmGenerated: '已生成确认单,如需调整可直接修改表单后再次点击提交。',
submitting: '提交中...',
submit: '提交',
leaveFillerInfo: '填单人信息',
leaveApplicantInfo: '申请人信息',
leaveInfo: '请假信息',
notSelected: '未选择',
leaveFillerTitle: '填单人职务',
leaveFillerDept: '填单人部门',
leaveFillerCompany: '填单人公司',
leaveApplicantTitle: '申请人职务',
leaveApplicantDept: '申请人部门',
leaveApplicantCompany: '申请人公司',
leaveAgentTitle: '代理人职务',
leaveAgentDept: '代理人部门',
leaveAgentCompany: '代理人公司',
backToEdit: '返回修改',
confirming: '确认中...',
confirmed: '已确认',
confirm: '确认',
oaSubmitResult: 'OA 提交结果',
oaSubmitFailed: 'OA 提交失败',
leaveResultPrefix: '请假单已推送到 OA,具体单据请',
leaveResultLinkText: '【 登录OA系统查看提交】',
requestNo: '单据编号',
submitTime: '提交时间',
sourceDocs: '源文档',
attributionParts: '生成内容归属部分',
selectWho: '选择{role}',
oaDataConnected: '已接入 OA 数据库视图查询。',
searchByNameOrEmployeeId: '输入姓名或工号搜索,按回车键查询',
name: '姓名',
employeeIdRequired: '工号不能为空。'
},
profile: {
title: '个人资料',
@@ -1856,9 +2106,9 @@ const messages = {
},
landing: {
hero: {
prefix: '釋放',
highlight: '生成式 AI 的力量',
subtitle: '訪問為您企業量身定制的強大 AI 助手套件。安全、可擴展、智能。'
prefix: '和信精密',
highlight: 'AI 智能體 應用平台',
subtitle: 'AI 的世界,期望讓你開心工作,快樂生活。'
},
agent: {
role: 'AI 助手'
@@ -1984,6 +2234,7 @@ const messages = {
users: '用戶管理',
departments: '部門管理',
agents: '應用管理',
knowledgeBase: '知識庫管理',
announcements: '公告管理',
questions: '常用問題',
wecom: '企業微信',
@@ -2567,6 +2818,57 @@ const messages = {
loadingAgent: '正在加載應用...',
thinking: '正在生成回答...',
disclaimer: 'AI 可能會犯錯,請核實重要信息。',
createNewChat: '建立新對話',
clearAll: '清空全部',
clearOneRecord: '清除此記錄',
agents: '智能體',
noOtherAgents: '暫無其他智能體',
noAvailableAgents: '暫無可用智能體',
collapseAgents: '收起智能體',
expandAgents: '展開智能體',
generalFeedback: '意見反饋',
language: '語言',
langZhCn: '簡體中文',
langEn: 'English',
langZhTw: '繁體中文',
langTh: 'ไทย',
logout: '退出登入',
welcomeTitle: '你好,我是和信AI數字人',
askAnything: '問我任何事...',
voiceFeature: '語音功能',
collapseBrowser: '收起瀏覽器',
openBrowser: '打開瀏覽器',
browser: '瀏覽器',
closeBrowser: '關閉瀏覽器',
browserInputPlaceholder: '輸入網址,例如 https://example.com',
open: '打開',
refresh: '刷新',
openInNewTab: '新分頁打開',
browserHint1: '在這裡直接打開網頁,邊聊天邊查看內容。',
browserHint2: '支持輸入 `https://`、`localhost` 或內網 IP 地址。',
feedbackSubmitSuccess: '反饋提交成功',
noData: '暫無資料',
loading: '載入中...',
loadMore: '載入更多',
loadAll: '載入全部',
noMoreData: '沒有更多資料了',
loginOaSystem: '登入OA系統',
employeeId: '工號',
enterOaPassword: '請輸入OA登入密碼',
confirmLogin: '確認登入',
currentUser: '目前使用者',
dayUnit: '天',
hourUnit: '小時',
leaveBalanceInsufficient: '**{label}餘額不足,暫無可用假期。**',
leaveBalanceTableLeaveType: '假別',
leaveBalanceTableYear: '年度',
leaveBalanceTableAvailable: '可休',
leaveBalanceTableUsed: '已休',
leaveBalanceTableRemaining: '目前剩餘',
leaveBalanceContactHr: '如有疑問,請聯繫人事部門確認假期資料。',
leaveConfirmPrompt: '請確認以下請假資訊,確認無誤後再提交到 OA。',
oaLeaveSubmitFailed: 'OA 請假提交失敗,請稍後重試。',
leaveSubmitFailedPrefix: '請假單提交失敗:{error}',
suggestions: {
whatCanYouDo: '你能做什麼?',
helpWriteReport: '幫我寫一份報告',
@@ -2581,7 +2883,80 @@ const messages = {
selectRating: '請先選擇評分',
commentPlaceholder: '添加評論(可選)...',
sent: '已發送'
}
},
oaPopupBlocked: '瀏覽器攔截了 OA 頁面,請允許彈出視窗後重試。',
oaLoggingTitle: '正在登入OA系統...',
oaLoggingBody: '正在登入OA系統,請稍候...',
noEmployeeId: '沒有工號資訊無法登入OA系統!',
oaPasswordRequired: '請輸入OA登入密碼!',
oaRequestMissing: '目前未取得 OA 單據編號,暫時無法開啟單據詳情。',
devComingSoon: '該功能正在開發中',
previewUnavailable: '目前源文件暫時無法預覽',
invalidBrowserUrl: '請輸入有效網址,例如 https://example.com 或 localhost:8891',
enterBrowserUrl: '請先輸入可開啟的網址。',
queryLeaveBalance: '正在查詢您的假期餘額,請稍候...',
leaveFormIntro: '已為你生成請假申請表,請直接在下方填寫並提交。或',
oaLeaveDirectLink: '登入OA系統直接申請',
oaLeaveDirectHintKey: '或登入OA系統直接申請',
leaveApplicantRequired: '請假人不能為空。',
leaveTypeRequired: '請選擇假別。',
leaveAgentRequired: '請選擇代理人。',
startTimeRequired: '請選擇正確的開始時間。',
endTimeRequired: '請選擇正確的結束時間。',
durationInvalid: '時長必須大於0小時,請檢查開始與結束時間。',
leaveResultSubmitted: '請假單已推送到 OA,具體單據請 【 登入OA系統查看提交】',
confirmClearHistory: '確定要清除全部聊天歷史記錄嗎?此操作不可恢復。',
confirmDeleteHistoryItem: '確定要刪除這條聊天記錄嗎?',
leaveFiller: '填單人',
createdAt: '建立時間',
leaveType: '假別',
selectLeaveType: '請選擇假別',
leaveApplicant: '請假人',
selectLeaveApplicant: '請選擇請假人',
pickLeaveApplicant: '選擇請假人',
leaveAgent: '代理人',
selectLeaveAgent: '請選擇代理人',
pickLeaveAgent: '選擇代理人',
startTime: '開始時間',
endTime: '結束時間',
duration: '時長',
isOutOfOffice: '是否外出',
isWorkInjury: '是否為工傷',
yes: '是',
no: '否',
leaveConfirmGenerated: '已生成確認單,如需調整可直接修改表單後再次點擊提交。',
submitting: '提交中...',
submit: '提交',
leaveFillerInfo: '填單人資訊',
leaveApplicantInfo: '申請人資訊',
leaveInfo: '請假資訊',
notSelected: '未選擇',
leaveFillerTitle: '填單人職務',
leaveFillerDept: '填單人部門',
leaveFillerCompany: '填單人公司',
leaveApplicantTitle: '申請人職務',
leaveApplicantDept: '申請人部門',
leaveApplicantCompany: '申請人公司',
leaveAgentTitle: '代理人職務',
leaveAgentDept: '代理人部門',
leaveAgentCompany: '代理人公司',
backToEdit: '返回修改',
confirming: '確認中...',
confirmed: '已確認',
confirm: '確認',
oaSubmitResult: 'OA 提交結果',
oaSubmitFailed: 'OA 提交失敗',
leaveResultPrefix: '請假單已推送到 OA,具體單據請',
leaveResultLinkText: '【 登入OA系統查看提交】',
requestNo: '單據編號',
submitTime: '提交時間',
sourceDocs: '源文件',
attributionParts: '生成內容歸屬部分',
selectWho: '選擇{role}',
oaDataConnected: '已接入 OA 資料庫視圖查詢。',
searchByNameOrEmployeeId: '輸入姓名或工號搜尋,按 Enter 查詢',
name: '姓名',
employeeIdRequired: '工號不能為空。'
},
profile: {
title: '個人資料',
@@ -2712,9 +3087,9 @@ const messages = {
},
landing: {
hero: {
prefix: 'ปลดปล่อยพลังของ',
highlight: 'Generative AI',
subtitle: 'เข้าถึงชุดผู้ช่วย AI ที่ทรงพลังซึ่งปรับแต่งมาเพื่อความต้องการขององค์กรของคุณ ปลอดภัย ปรับขนาดได้ และชาญฉลาด'
prefix: '和信精密',
highlight: 'แพลตฟอร์มแอปพลิเคชัน AI Agent',
subtitle: 'ในโลกของ AI เราหวังว่าคุณจะทำงานอย่างมีความสุข และใช้ชีวิตอย่างสนุกสนาน'
},
agent: {
role: 'ผู้ช่วย AI'
@@ -2840,6 +3215,7 @@ const messages = {
users: 'การจัดการผู้ใช้',
departments: 'การจัดการแผนก',
agents: 'การจัดการตัวแทน',
knowledgeBase: 'การจัดการคลังความรู้',
announcements: 'การจัดการประกาศ',
questions: 'คำถามทั่วไป',
wecom: 'WeCom',
@@ -3423,6 +3799,57 @@ const messages = {
loadingAgent: 'กำลังโหลดตัวแทน...',
thinking: 'กำลังสร้างคำตอบ...',
disclaimer: 'AI อาจทำผิดพลาดได้ โปรดตรวจสอบข้อมูลสำคัญ',
createNewChat: 'แชทใหม่',
clearAll: 'ล้างทั้งหมด',
clearOneRecord: 'ลบรายการนี้',
agents: 'ตัวแทน',
noOtherAgents: 'ไม่มีตัวแทนอื่น',
noAvailableAgents: 'ไม่มีตัวแทนที่ใช้ได้',
collapseAgents: 'ย่อตัวแทน',
expandAgents: 'ขยายตัวแทน',
generalFeedback: 'ข้อเสนอแนะ',
language: 'ภาษา',
langZhCn: '简体中文',
langEn: 'English',
langZhTw: '繁體中文',
langTh: 'ไทย',
logout: 'ออกจากระบบ',
welcomeTitle: 'สวัสดี ฉันคือ AI Digital Human ของ Hexin',
askAnything: 'ถามฉันได้ทุกเรื่อง...',
voiceFeature: 'ฟีเจอร์เสียง',
collapseBrowser: 'ย่อเบราว์เซอร์',
openBrowser: 'เปิดเบราว์เซอร์',
browser: 'เบราว์เซอร์',
closeBrowser: 'ปิดเบราว์เซอร์',
browserInputPlaceholder: 'ใส่ URL เช่น https://example.com',
open: 'เปิด',
refresh: 'รีเฟรช',
openInNewTab: 'เปิดในแท็บใหม่',
browserHint1: 'เปิดเว็บได้ที่นี่พร้อมคุยไปด้วย',
browserHint2: 'รองรับ https://, localhost และ IP ภายในเครือข่าย',
feedbackSubmitSuccess: 'ส่งข้อเสนอแนะสำเร็จ',
noData: 'ไม่มีข้อมูล',
loading: 'กำลังโหลด...',
loadMore: 'โหลดเพิ่ม',
loadAll: 'โหลดทั้งหมด',
noMoreData: 'ไม่มีข้อมูลเพิ่มเติมแล้ว',
loginOaSystem: 'เข้าสู่ระบบ OA',
employeeId: 'รหัสพนักงาน',
enterOaPassword: 'กรอกรหัสผ่าน OA',
confirmLogin: 'ยืนยันการเข้าสู่ระบบ',
currentUser: 'ผู้ใช้ปัจจุบัน',
dayUnit: 'วัน',
hourUnit: 'ชั่วโมง',
leaveBalanceInsufficient: '**ยอด{label}ไม่เพียงพอ**',
leaveBalanceTableLeaveType: 'ประเภทลา',
leaveBalanceTableYear: 'ปี',
leaveBalanceTableAvailable: 'คงเหลือที่ใช้ได้',
leaveBalanceTableUsed: 'ใช้ไปแล้ว',
leaveBalanceTableRemaining: 'คงเหลือปัจจุบัน',
leaveBalanceContactHr: 'หากมีข้อสงสัย โปรดติดต่อฝ่ายบุคคลเพื่อตรวจสอบข้อมูลวันลา',
leaveConfirmPrompt: 'โปรดยืนยันข้อมูลการลาพนักงานก่อนส่งไปยัง OA',
oaLeaveSubmitFailed: 'ส่งคำขอลา OA ไม่สำเร็จ กรุณาลองใหม่อีกครั้ง',
leaveSubmitFailedPrefix: 'ส่งใบลาล้มเหลว: {error}',
suggestions: {
whatCanYouDo: 'คุณทำอะไรได้บ้าง?',
helpWriteReport: 'ช่วยฉันเขียนรายงาน',
@@ -3437,7 +3864,80 @@ const messages = {
selectRating: 'กรุณาเลือกคะแนนก่อน',
commentPlaceholder: 'เพิ่มความคิดเห็น (ไม่บังคับ)...',
sent: 'ส่งแล้ว'
}
},
oaPopupBlocked: 'เบราว์เซอร์บล็อกหน้าต่าง OA กรุณาอนุญาตป๊อปอัปแล้วลองใหม่',
oaLoggingTitle: 'กำลังเข้าสู่ระบบ OA...',
oaLoggingBody: 'กำลังเข้าสู่ระบบ OA โปรดรอสักครู่...',
noEmployeeId: 'ไม่มีรหัสพนักงาน ไม่สามารถเข้าสู่ OA ได้',
oaPasswordRequired: 'กรุณากรอกรหัสผ่าน OA',
oaRequestMissing: 'ยังไม่ได้รับเลขเอกสาร OA จึงไม่สามารถเปิดรายละเอียดได้',
devComingSoon: 'ฟีเจอร์นี้กำลังพัฒนา',
previewUnavailable: 'ยังไม่สามารถพรีวิวไฟล์ต้นทางได้ชั่วคราว',
invalidBrowserUrl: 'กรุณาใส่ URL ที่ถูกต้อง เช่น https://example.com หรือ localhost:8891',
enterBrowserUrl: 'กรุณาใส่ URL ก่อน',
queryLeaveBalance: 'กำลังตรวจสอบยอดสิทธิ์ลาของคุณ โปรดรอสักครู่...',
leaveFormIntro: 'ระบบได้สร้างแบบฟอร์มลางานให้แล้ว กรุณากรอกและส่งด้านล่าง หรือ',
oaLeaveDirectLink: 'ยื่นคำขอโดยตรงใน OA',
oaLeaveDirectHintKey: 'หรือยื่นคำขอโดยตรงใน OA',
leaveApplicantRequired: 'ผู้ขอลาห้ามว่าง',
leaveTypeRequired: 'กรุณาเลือกประเภทการลา',
leaveAgentRequired: 'กรุณาเลือกผู้แทน',
startTimeRequired: 'กรุณาเลือกเวลาเริ่มต้นที่ถูกต้อง',
endTimeRequired: 'กรุณาเลือกเวลาสิ้นสุดที่ถูกต้อง',
durationInvalid: 'ระยะเวลาต้องมากกว่า 0 ชั่วโมง',
leaveResultSubmitted: 'ส่งใบลางานไปยัง OA แล้ว กรุณาตรวจสอบที่ 【 ดูการส่งใน OA 】',
confirmClearHistory: 'ยืนยันล้างประวัติแชททั้งหมด? การกระทำนี้ย้อนกลับไม่ได้',
confirmDeleteHistoryItem: 'ยืนยันลบประวัติแชทรายการนี้?',
leaveFiller: 'ผู้กรอก',
createdAt: 'เวลาสร้าง',
leaveType: 'ประเภทการลา',
selectLeaveType: 'กรุณาเลือกประเภทการลา',
leaveApplicant: 'ผู้ขอลา',
selectLeaveApplicant: 'กรุณาเลือกผู้ขอลา',
pickLeaveApplicant: 'เลือกผู้ขอลา',
leaveAgent: 'ผู้แทน',
selectLeaveAgent: 'กรุณาเลือกผู้แทน',
pickLeaveAgent: 'เลือกผู้แทน',
startTime: 'เวลาเริ่มต้น',
endTime: 'เวลาสิ้นสุด',
duration: 'ระยะเวลา',
isOutOfOffice: 'ออกนอกสถานที่หรือไม่',
isWorkInjury: 'เป็นอุบัติเหตุจากงานหรือไม่',
yes: 'ใช่',
no: 'ไม่',
leaveConfirmGenerated: 'สร้างใบยืนยันแล้ว หากต้องการแก้ไขให้แก้ฟอร์มแล้วส่งอีกครั้ง',
submitting: 'กำลังส่ง...',
submit: 'ส่ง',
leaveFillerInfo: 'ข้อมูลผู้กรอก',
leaveApplicantInfo: 'ข้อมูลผู้ขอลา',
leaveInfo: 'ข้อมูลการลา',
notSelected: 'ยังไม่เลือก',
leaveFillerTitle: 'ตำแหน่งผู้กรอก',
leaveFillerDept: 'แผนกผู้กรอก',
leaveFillerCompany: 'บริษัทผู้กรอก',
leaveApplicantTitle: 'ตำแหน่งผู้ขอลา',
leaveApplicantDept: 'แผนกผู้ขอลา',
leaveApplicantCompany: 'บริษัทผู้ขอลา',
leaveAgentTitle: 'ตำแหน่งผู้แทน',
leaveAgentDept: 'แผนกผู้แทน',
leaveAgentCompany: 'บริษัทผู้แทน',
backToEdit: 'กลับไปแก้ไข',
confirming: 'กำลังยืนยัน...',
confirmed: 'ยืนยันแล้ว',
confirm: 'ยืนยัน',
oaSubmitResult: 'ผลการส่ง OA',
oaSubmitFailed: 'ส่ง OA ล้มเหลว',
leaveResultPrefix: 'ส่งใบลางานไปยัง OA แล้ว กรุณาตรวจสอบที่',
leaveResultLinkText: '【 ดูการส่งใน OA 】',
requestNo: 'เลขที่เอกสาร',
submitTime: 'เวลาส่ง',
sourceDocs: 'เอกสารต้นทาง',
attributionParts: 'ส่วนแสดงแหล่งที่มา',
selectWho: 'เลือก{role}',
oaDataConnected: 'เชื่อมต่อการค้นหามุมมองฐานข้อมูล OA แล้ว',
searchByNameOrEmployeeId: 'ค้นหาด้วยชื่อหรือรหัสพนักงาน แล้วกด Enter',
name: 'ชื่อ',
employeeIdRequired: 'รหัสพนักงานห้ามว่าง'
},
profile: {
title: 'โปรไฟล์',
@@ -3479,4 +3979,3 @@ const i18n = createI18n({
});
export default i18n;
+1 -4
View File
@@ -6,7 +6,6 @@ import ChatView from '../views/ChatView.vue';
import AdminView from '../views/AdminView.vue';
import ResetPasswordView from '../views/ResetPasswordView.vue';
import KbWorkspaceView from '../views/KbWorkspaceView.vue';
import KbAdminView from '../views/KbAdminView.vue';
import { config } from '../config';
import { getStoredAuthUser } from '../utils/auth';
@@ -50,9 +49,7 @@ const routes = [
},
{
path: '/kb/admin',
name: 'KbAdmin',
component: KbAdminView,
meta: { title: '知识库管理台' }
redirect: { path: '/admin', query: { module: 'knowledge_base' } }
},
];
+28 -127
View File
@@ -11,7 +11,8 @@
* - 该页面后续可继续优化按模块懒加载数据
*/
import { ref, onMounted, watch, computed } from 'vue';
import { useRouter } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
import KbAdminPanel from '../components/kb/KbAdminPanel.vue';
import { useI18n } from 'vue-i18n';
import { config } from '../config';
import ThemeToggleButton from '../components/ThemeToggleButton.vue';
@@ -21,7 +22,6 @@ import { useGlobalMessageDialog } from '../composables/useGlobalMessageDialog';
import { buildWecomAuditMeta, formatWecomAuditReason } from '../utils/wecom';
import { getAuthHeaders } from '../utils/auth';
import { listAdminSchedules, createAdminSchedule, updateAdminSchedule, deleteAdminSchedule, toggleAdminSchedule, runAdminSchedule, listAdminScheduleRuns, getAdminScheduleTaskConfig, testAdminScheduleSql, testAdminScheduleRun, type ScheduleTask, type ScheduleRun, type TestScheduleRunResult } from '../api/schedule';
import { exportAdminScheduleUrl, importAdminSchedules } from '../api/schedule';
import {
ArrowLeft,
// Save,
@@ -38,7 +38,6 @@ import {
MessageSquare,
Globe,
Download,
ArrowUpFromLine,
UserCog,
Building,
MessageCircleQuestion,
@@ -70,6 +69,7 @@ const sidebarItems = computed(() => {
{ id: 'users', icon: UserCog, label: t('admin.nav.users') },
{ id: 'departments', icon: Building, label: t('admin.nav.departments') },
{ id: 'agents', icon: Bot, label: t('admin.nav.agents') },
{ id: 'knowledge_base', icon: FileText, label: t('admin.nav.knowledgeBase') },
{ id: 'schedules', icon: Settings2, label: '排程管理' },
{ id: 'announcements', icon: Megaphone, label: t('admin.nav.announcements') },
{ id: 'questions', icon: MessageCircleQuestion, label: t('admin.nav.questions') },
@@ -237,9 +237,10 @@ interface WecomIntegrationManifest {
// 获取路由实例,用于页面跳转
const router = useRouter();
const route = useRoute();
// 当前左侧菜单激活的模块:dashboard / agents / permissions
const activeModule = ref<'dashboard' | 'agents' | 'announcements' | 'permissions' | 'requests' | 'reports' | 'approvals' | 'users' | 'departments' | 'questions' | 'wecom' | 'schedules'>('dashboard');
const activeModule = ref<'dashboard' | 'agents' | 'announcements' | 'permissions' | 'requests' | 'reports' | 'approvals' | 'users' | 'departments' | 'questions' | 'wecom' | 'schedules' | 'knowledge_base'>('dashboard');
const expandedReports = ref(true);
// agents:管理员视角下的所有 Agent 列表
@@ -725,8 +726,6 @@ const openScheduleCreateModal = async () => {
const openScheduleEditModal = async (task: ScheduleTask) => {
await Promise.all([loadAgents(), loadUsers()]);
scheduleConfigCollapsed.value = true;
scheduleNotifyFilterText.value = '';
scheduleNotifyDropdownOpen.value = false;
scheduleEditingId.value = task.id;
scheduleCreateForm.value = {
name: task.name || '',
@@ -739,31 +738,6 @@ const openScheduleEditModal = async (task: ScheduleTask) => {
enabled: !!task.enabled,
data_source_type: (task.data_source_type || 'database') as 'database' | 'external_api',
};
scheduleSqlEditForm.value = {
base_fetch_sql: '',
fetch_where_conditions: '',
fetch_order_by: '',
detail_sql: '',
writeback_sql: '',
row_id_key: 'id',
log_prefix: '',
alias_order_str: '',
detail_alias_order_str: '',
header_labels_str: '{}',
ds_db_type: 'sqlserver',
ds_host: '',
ds_port: '',
ds_database: '',
ds_username: '',
ds_password: '',
ds_driver: '',
ds_encrypt: '',
ds_trust_cert: '',
api_url: '',
api_method: 'POST',
api_headers_str: '{}',
api_body_template: '',
};
try {
const result = await getAdminScheduleTaskConfig(task.id);
@@ -950,7 +924,6 @@ const selectedScheduleLatestRunAt = computed(
const scheduleEnabledCount = computed(() => schedules.value.filter((item) => item.enabled).length);
const scheduleDisabledCount = computed(() => schedules.value.filter((item) => !item.enabled).length);
const scheduleRunningCount = computed(() => schedules.value.filter((item) => item.last_status === 'running').length);
const scheduleImportInputRef = ref<HTMLInputElement | null>(null);
const loadSchedules = async () => {
scheduleLoading.value = true;
@@ -975,38 +948,6 @@ const loadSchedules = async () => {
}
};
const exportSchedule = async (taskId: number) => {
const res = await fetch(exportAdminScheduleUrl(taskId), { headers: getAuthHeaders() });
if (!res.ok) {
showMessageDialog('error', '导出失败');
return;
}
const blob = await res.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `schedule_${taskId}_${new Date().toISOString().slice(0, 19).replace(/[:T]/g, '-')}.json`;
a.click();
URL.revokeObjectURL(url);
};
const importSchedulesFromFile = async (event: Event) => {
const input = event.target as HTMLInputElement;
const file = input.files?.[0];
if (!file) return;
try {
const text = await file.text();
const payload = JSON.parse(text);
const result = await importAdminSchedules(payload);
showMessageDialog('success', `导入完成:${result.imported} 条,跳过 ${result.skipped} 条`);
await loadSchedules();
} catch (e: any) {
showMessageDialog('error', e?.message || '导入失败');
} finally {
input.value = '';
}
};
const scheduleSqlEditForm = ref({
base_fetch_sql: '',
fetch_where_conditions: '',
@@ -1057,24 +998,6 @@ const handleTestScheduleSql = async () => {
};
const scheduleNotifyDropdownOpen = ref(false);
const scheduleNotifyFilterText = ref('');
const filteredScheduleNotifyUsers = computed(() => {
const keyword = scheduleNotifyFilterText.value.trim().toLowerCase();
if (!keyword) return users.value;
return users.value.filter((u) => {
const fields = [
u.real_name,
u.username,
u.employee_id,
u.email,
u.phone_number,
]
.filter(Boolean)
.map(v => String(v).toLowerCase());
return fields.some(v => v.includes(keyword));
});
});
const getUserName = (uid: number) => {
const u = users.value.find(x => x.id === uid);
@@ -2219,6 +2142,15 @@ onMounted(async () => {
return;
}
const moduleQuery = typeof route.query.module === 'string' ? route.query.module : '';
const allowedModules = sidebarItems.value.map((item) => item.id);
if (moduleQuery && allowedModules.includes(moduleQuery)) {
activeModule.value = moduleQuery as typeof activeModule.value;
if (route.query.module) {
router.replace({ path: '/admin' });
}
}
isLoading.value = true;
await Promise.all([
loadAgents(),
@@ -3456,13 +3388,6 @@ const handlePermissionImport = async (event: Event) => {
</div>
</div>
<div class="flex items-center gap-4">
<button
@click="router.push('/kb/admin')"
class="hidden md:inline-flex items-center gap-2 rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50 hover:text-slate-900 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800 dark:hover:text-slate-100"
>
<Settings2 class="w-4 h-4" />
<span>知识库管理</span>
</button>
<ThemeToggleButton />
<!-- Language Selector -->
<div class="flex items-center gap-2">
@@ -3889,6 +3814,11 @@ const handlePermissionImport = async (event: Event) => {
</div>
</section>
<!-- Knowledge Base Management -->
<section v-else-if="activeModule === 'knowledge_base'" class="overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-sm animate-fade-in-up dark:border-slate-700 dark:bg-slate-900">
<KbAdminPanel />
</section>
<!-- Agent Management -->
<section v-else-if="activeModule === 'agents'" class="bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden animate-fade-in-up">
<div class="px-8 py-6 border-b border-gray-100 flex flex-col md:flex-row justify-between items-start md:items-center gap-4 bg-white">
@@ -4344,7 +4274,7 @@ const handlePermissionImport = async (event: Event) => {
<template v-if="scheduleViewMode === 'overview'">
<div class="rounded-3xl border border-slate-200 bg-white p-6 shadow-sm">
<div class="mb-5 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4">
<div class="mb-5 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4">
<div class="rounded-2xl bg-slate-50 px-4 py-3">
<div class="text-xl font-bold text-slate-900">{{ schedules.length }}</div>
<div class="text-sm text-slate-500">排程总数</div>
@@ -4375,13 +4305,6 @@ const handlePermissionImport = async (event: Event) => {
<Settings2 class="h-4 w-4" />
</div>
<div class="font-semibold text-slate-900">新增排程</div>
<button
class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border border-violet-200 text-violet-700 transition hover:bg-violet-50"
title="汇入"
@click="scheduleImportInputRef?.click()"
>
<ArrowUpFromLine class="h-4 w-4" />
</button>
</div>
<div class="text-sm text-slate-500">
点击按钮后弹窗录入排程字段。
@@ -4394,13 +4317,6 @@ const handlePermissionImport = async (event: Event) => {
<Plus class="h-4 w-4" />
新增排程
</button>
<input
ref="scheduleImportInputRef"
type="file"
accept=".json,application/json"
class="hidden"
@change="importSchedulesFromFile"
/>
</div>
</div>
@@ -4412,16 +4328,7 @@ const handlePermissionImport = async (event: Event) => {
<button class="w-full text-left" @click="openScheduleRunSubmenu(s.id)">
<div class="min-h-[96px]">
<div class="flex items-center justify-between gap-3">
<div class="flex min-w-0 items-center gap-2">
<div class="truncate text-base font-semibold text-slate-900">{{ s.name }}</div>
<button
class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border border-emerald-200 text-emerald-700 transition hover:bg-emerald-50"
title="汇出"
@click.stop="exportSchedule(s.id)"
>
<Download class="h-4 w-4" />
</button>
</div>
<div class="truncate text-base font-semibold text-slate-900">{{ s.name }}</div>
<span class="inline-flex shrink-0 items-center whitespace-nowrap rounded-full px-2.5 py-1 text-xs font-semibold"
:class="s.enabled ? 'bg-emerald-100 text-emerald-700' : 'bg-slate-200 text-slate-600'">
{{ s.enabled ? '启用' : '停用' }}
@@ -4429,6 +4336,12 @@ const handlePermissionImport = async (event: Event) => {
</div>
<div class="mt-2 text-sm text-slate-500">编号:{{ s.schedule_no }}</div>
<div class="mt-1 text-sm text-slate-500">Cron:{{ s.cron_expr }}</div>
<div
v-if="s.schedule_type === 'platform_app' && s.platform_api_path"
class="mt-1 text-sm text-slate-500"
>
配置:{{ s.platform_api_path }}
</div>
<div class="mt-1 text-sm text-slate-500">所有者:{{ s.owner_username || s.owner_user_id }}</div>
</div>
</button>
@@ -6194,17 +6107,8 @@ const handlePermissionImport = async (event: Event) => {
v-if="scheduleNotifyDropdownOpen"
class="absolute z-50 mt-1 max-h-52 w-full overflow-auto rounded-xl border border-slate-200 bg-white shadow-lg"
>
<div class="sticky top-0 z-10 border-b border-slate-100 bg-white p-2">
<input
v-model.trim="scheduleNotifyFilterText"
type="text"
class="input-field !h-8 !rounded-lg !px-2.5 !py-1 !text-xs"
placeholder="输入姓名 / 工号 / 用户名筛选"
@click.stop
/>
</div>
<div
v-for="u in filteredScheduleNotifyUsers"
v-for="u in users"
:key="u.id"
class="flex cursor-pointer items-center gap-2 px-3 py-2 text-sm transition hover:bg-slate-50"
:class="scheduleCreateForm.notify_user_ids_json.includes(u.id) ? 'bg-blue-50/50' : ''"
@@ -6220,9 +6124,6 @@ const handlePermissionImport = async (event: Event) => {
/>
<span class="text-slate-700">{{ u.real_name || u.username }}{{ u.employee_id ? '(' + u.employee_id + ')' : '' }}</span>
</div>
<div v-if="filteredScheduleNotifyUsers.length === 0" class="px-3 py-3 text-xs text-slate-400">
未找到匹配人员
</div>
</div>
</div>
</div>
+161 -146
View File
@@ -13,7 +13,7 @@
import { ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import { useChat } from '../composables/useChat';
import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Heart, Bell, Mail, Settings, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, History } from 'lucide-vue-next';
import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Mail, Settings, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, History, Sun, Moon } from 'lucide-vue-next';
import { marked } from 'marked';
import { useRoute, useRouter } from 'vue-router';
import { config } from '../config';
@@ -21,9 +21,11 @@ import FilePreviewModal from '../components/FilePreviewModal.vue';
import GeneralFeedbackDialog from '../components/GeneralFeedbackDialog.vue';
import { useGlobalMessageDialog } from '../composables/useGlobalMessageDialog';
import { useIsMobile } from '../composables/useIsMobile';
import { useTheme } from '../composables/useTheme';
import { getAuthHeaders, getStoredAuthUser, clearAuthUser } from '../utils/auth';
const { t } = useI18n();
const { t, locale } = useI18n();
const { appliedTheme, toggleLightDark } = useTheme();
const { showMessageDialog } = useGlobalMessageDialog();
const { isMobile } = useIsMobile();
const showMobileAgentPopover = ref(false);
@@ -91,8 +93,12 @@ const handleLogout = () => {
router.push('/');
};
watch(locale, (newLang) => {
localStorage.setItem('hxops_lang', String(newLang));
});
const handleVoiceFeatureClick = () => {
showMessageDialog('info', '该功能正在开发中');
showMessageDialog('info', t('chat.devComingSoon'));
};
const stripReasoningPrelude = (text: string) => {
@@ -563,7 +569,7 @@ const openPreview = async (file: SourceFileLink) => {
previewFile.value = resolvedFile;
filePreviewVisible.value = true;
} catch (error: any) {
showMessageDialog('warning', error?.message || '当前源文件暂时无法预览');
showMessageDialog('warning', error?.message || t('chat.previewUnavailable'));
}
};
@@ -611,16 +617,16 @@ const openOAAutoLoginPage = (gopage: string, username: string, password: string,
// 直接在弹出窗口内写入自动提交表单,避免跨窗口时序问题
const popup = window.open('about:blank', target);
if (!popup) {
showMessageDialog('warning', '浏览器拦截了 OA 页面,请允许弹出窗口后重试。');
showMessageDialog('warning', t('chat.oaPopupBlocked'));
return;
}
const formHtml = `
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>正在登录OA系统...</title></head>
<head><meta charset="utf-8"><title>${t('chat.oaLoggingTitle')}</title></head>
<body>
<p style="text-align:center;margin-top:100px;font-family:sans-serif;color:#666;">正在登录OA系统,请稍候...</p>
<p style="text-align:center;margin-top:100px;font-family:sans-serif;color:#666;">${t('chat.oaLoggingBody')}</p>
<form id="oaLoginForm" action="${OA_VERIFY_LOGIN_URL}" method="POST">
<input type="hidden" name="loginid" value="${username}" />
<input type="hidden" name="userpassword" value="${password.replace(/"/g, '&quot;')}" />
@@ -640,7 +646,7 @@ const openOAAutoLoginPage = (gopage: string, username: string, password: string,
const openOALeaveRequestDirectly = () => {
const employeeId = currentUserEmployeeId.value;
if (!employeeId || employeeId === '-') {
showMessageDialog('warning', '没有工号信息无法登录OA系统!');
showMessageDialog('warning', t('chat.noEmployeeId'));
return;
}
oaLoginEmployeeId.value = employeeId;
@@ -652,7 +658,7 @@ const openOALeaveRequestDirectly = () => {
const confirmOALogin = () => {
if (!oaLoginPassword.value.trim()) {
showMessageDialog('warning', '请输入OA登录密码!');
showMessageDialog('warning', t('chat.oaPasswordRequired'));
return;
}
// 记住密码到 localStorage
@@ -668,12 +674,12 @@ const cancelOALogin = () => {
const openOARequestDirectly = (requestId: string) => {
const normalizedRequestId = String(requestId || '').trim();
if (!normalizedRequestId || normalizedRequestId === '-') {
showMessageDialog('warning', '当前未获取到 OA 单据编号,暂时无法打开单据详情。');
showMessageDialog('warning', t('chat.oaRequestMissing'));
return;
}
const employeeId = currentUserEmployeeId.value;
if (!employeeId || employeeId === '-') {
showMessageDialog('warning', '没有工号信息无法登录OA系统!');
showMessageDialog('warning', t('chat.noEmployeeId'));
return;
}
oaLoginEmployeeId.value = employeeId;
@@ -887,12 +893,12 @@ const calculateDurationHours = (startTime: string, endTime: string) => {
};
const formatDurationLabel = (hours: number) => {
if (!hours) return '0 小时';
if (!hours) return `0 ${t('chat.hourUnit')}`;
if (hours >= 8 && Number.isInteger((hours / 8) * 10) && (hours / 8) >= 1) {
const days = Number((hours / 8).toFixed(2));
return `${days} 天 / ${hours} 小时`;
return `${days} ${t('chat.dayUnit')} / ${hours} ${t('chat.hourUnit')}`;
}
return `${hours} 小时`;
return `${hours} ${t('chat.hourUnit')}`;
};
const extractLeaveTypeFromIntent = (content: string) => {
@@ -999,7 +1005,7 @@ const saveLocalMessageToBackend = async (msg: any, userQuery: string = '') => {
const NEED_BALANCE_CHECK_TYPES = new Set(['010', '408']);
const formatLeaveBalanceNumber = (value: any) => {
if (value === null || value === undefined) return '暂无数据';
if (value === null || value === undefined) return t('chat.noData');
const num = Number(value);
if (Number.isNaN(num)) return String(value);
return Number.isInteger(num) ? String(num) : num.toFixed(2);
@@ -1034,7 +1040,7 @@ const startLocalLeaveFlow = async (content: string) => {
const thinkingMsg = {
role: 'assistant' as const,
type: 'text' as const,
content: '正在查询您的假期余额,请稍候...',
content: t('chat.queryLeaveBalance'),
};
messages.value.push(thinkingMsg);
@@ -1046,15 +1052,15 @@ const startLocalLeaveFlow = async (content: string) => {
}
if (balance && !balance.has_balance) {
const unit = initialLeaveType === '010' ? '天' : '小时';
const unit = initialLeaveType === '010' ? t('chat.dayUnit') : t('chat.hourUnit');
const detailLines = [
`**${balance.leave_type_label}余额不足,暂无可用假期。**`,
t('chat.leaveBalanceInsufficient', { label: balance.leave_type_label }),
'',
`| 假别 | 年度 | 可休 | 已休 | 当前剩余 |`,
`| ${t('chat.leaveBalanceTableLeaveType')} | ${t('chat.leaveBalanceTableYear')} | ${t('chat.leaveBalanceTableAvailable')} | ${t('chat.leaveBalanceTableUsed')} | ${t('chat.leaveBalanceTableRemaining')} |`,
`| :---: | :---: | :---: | :---: | :---: |`,
`| ${balance.leave_type_label} | ${balance.year} | ${formatLeaveBalanceNumber(balance.total_hours)}${unit} | ${formatLeaveBalanceNumber(balance.used_hours)}${unit} | ${formatLeaveBalanceNumber(balance.remaining_hours)}${unit} |`,
'',
'如有疑问,请联系人事部门确认假期数据。',
t('chat.leaveBalanceContactHr'),
];
const noBalanceMsg = {
role: 'assistant' as const,
@@ -1085,7 +1091,7 @@ const startLocalLeaveFlow = async (content: string) => {
const formMsg = {
role: 'assistant' as const,
type: 'leave-form' as const,
content: '已为你生成请假申请表,请直接在下方填写并提交。或登录OA系统直接申请',
content: t('chat.leaveFormIntro'),
payload,
local_id: formId,
local_only: true,
@@ -1304,7 +1310,7 @@ const toggleBrowserPanel = () => {
const loadBrowserPage = () => {
const normalized = normalizeBrowserInput(browserDraftUrl.value);
if (!normalized) {
showMessageDialog('warning', '请输入有效的网址,例如 `https://example.com` 或 `localhost:8891`。');
showMessageDialog('warning', t('chat.invalidBrowserUrl'));
return;
}
browserCurrentUrl.value = normalized;
@@ -1324,7 +1330,7 @@ const refreshBrowserPage = () => {
const openBrowserInNewTab = () => {
const normalized = browserCurrentUrl.value || normalizeBrowserInput(browserDraftUrl.value);
if (!normalized) {
showMessageDialog('warning', '请先输入可打开的网址。');
showMessageDialog('warning', t('chat.enterBrowserUrl'));
return;
}
window.open(normalized, '_blank', 'noopener,noreferrer');
@@ -1435,13 +1441,13 @@ const handleSend = async (textOrEvent?: string | Event) => {
};
const validateLeaveForm = (form: LeaveRequestFormData) => {
if (!form.applicantName.trim()) return '请假人不能为空。';
if (!form.employeeId.trim()) return '工号不能为空。';
if (!form.leaveType.trim()) return '请选择假别。';
if (!form.agentUid.trim()) return '请选择代理人。';
if (!parseDateTime(form.startTime)) return '请选择正确的开始时间。';
if (!parseDateTime(form.endTime)) return '请选择正确的结束时间。';
if (calculateDurationHours(form.startTime, form.endTime) <= 0) return '时长必须大于0小时,请检查开始时间和结束时间。';
if (!form.applicantName.trim()) return t('chat.leaveApplicantRequired');
if (!form.employeeId.trim()) return t('chat.employeeIdRequired');
if (!form.leaveType.trim()) return t('chat.leaveTypeRequired');
if (!form.agentUid.trim()) return t('chat.leaveAgentRequired');
if (!parseDateTime(form.startTime)) return t('chat.startTimeRequired');
if (!parseDateTime(form.endTime)) return t('chat.endTimeRequired');
if (calculateDurationHours(form.startTime, form.endTime) <= 0) return t('chat.durationInvalid');
return '';
};
@@ -1465,7 +1471,7 @@ const submitLeaveForm = (msg: any) => {
const confirmMsg = {
role: 'assistant' as const,
type: 'leave-confirmation' as const,
content: '请确认以下请假信息,确认无误后再提交到 OA。',
content: t('chat.leaveConfirmPrompt'),
payload: {
formId: payload.formId,
form: summary,
@@ -1525,13 +1531,13 @@ const confirmLeaveSubmission = async (msg: any) => {
});
const data = await res.json().catch(() => ({}));
if (!res.ok) {
throw new Error(data?.error || 'OA 请假提交失败,请稍后重试。');
throw new Error(data?.error || t('chat.oaLeaveSubmitFailed'));
}
const resultMsg = {
role: 'assistant' as const,
type: 'leave-result' as const,
content: '请假单已推送到 OA,具体单据请 【 登录OA系统查看提交】',
content: t('chat.leaveResultSubmitted'),
payload: {
formId: payload.formId,
success: true,
@@ -1548,12 +1554,12 @@ const confirmLeaveSubmission = async (msg: any) => {
saveLocalMessageToBackend(msg);
saveLocalMessageToBackend(resultMsg);
} catch (error: any) {
const errorMessage = error?.message || 'OA 请假提交失败,请稍后重试。';
const errorMessage = error?.message || t('chat.oaLeaveSubmitFailed');
showMessageDialog('error', errorMessage);
const resultMsg = {
role: 'assistant' as const,
type: 'leave-result' as const,
content: `请假单提交失败:${errorMessage}`,
content: t('chat.leaveSubmitFailedPrefix', { error: errorMessage }),
payload: {
formId: payload.formId,
success: false,
@@ -1609,7 +1615,7 @@ const loadHistory = async () => {
};
const clearAllHistory = async () => {
if (!confirm('确定要清除全部聊天历史记录吗?此操作不可恢复。')) return;
if (!confirm(t('chat.confirmClearHistory'))) return;
try {
const res = await fetch(`/api/chat/sessions?agent_id=${agentId}`, {
method: 'DELETE',
@@ -1628,7 +1634,7 @@ const clearAllHistory = async () => {
const deleteHistoryItem = async (id: string, event: Event) => {
event.stopPropagation();
if (!confirm('确定要删除这条聊天记录吗?')) return;
if (!confirm(t('chat.confirmDeleteHistoryItem'))) return;
try {
const res = await fetch(`/api/chat/sessions/${id}?agent_id=${agentId}`, {
method: 'DELETE',
@@ -1801,7 +1807,7 @@ const showChatRating = ref(false);
<Sparkles class="h-5 w-5" />
</div>
<button @click="startNewChat(); isSidebarOpen = false;" class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-slate-50 text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700" title="创建新对话">
<button @click="startNewChat(); isSidebarOpen = false;" class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-slate-50 text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700" :title="$t('chat.createNewChat')">
<Plus class="h-5 w-5" />
</button>
@@ -1810,7 +1816,7 @@ const showChatRating = ref(false);
<div class="flex h-8 w-8 items-center justify-center rounded-full bg-brand-600 text-sm font-bold text-white shadow-sm shadow-brand-500/20">
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
</div>
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" title="意见反馈"><Mail class="h-5 w-5" /></button>
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><Mail class="h-5 w-5" /></button>
<button @click="router.push('/workspace?no_redirect=1')" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Settings class="h-5 w-5" /></button>
</div>
</div>
@@ -1829,14 +1835,14 @@ const showChatRating = ref(false);
<div class="px-4 pb-4">
<button @click="startNewChat(); isSidebarOpen = false;" class="flex w-full items-center justify-center gap-2 rounded-xl border border-slate-200 bg-slate-50 py-3 text-sm font-medium text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700">
<Plus class="h-4 w-4" /> 创建新对话
<Plus class="h-4 w-4" /> {{ $t('chat.createNewChat') }}
</button>
</div>
<div class="flex items-center justify-between px-4 py-2">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">聊天记录</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.history') }}</span>
<button v-if="history.length > 0" @click="clearAllHistory" class="text-xs text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
清空全部
{{ $t('chat.clearAll') }}
</button>
</div>
@@ -1861,7 +1867,7 @@ const showChatRating = ref(false);
<button
@click="deleteHistoryItem(item.conversation_id, $event)"
class="absolute right-2 p-1.5 text-slate-400 opacity-0 transition-opacity hover:text-red-500 group-hover:opacity-100 dark:hover:text-red-400"
title="清除该记录"
:title="$t('chat.clearOneRecord')"
>
<X class="h-4 w-4" />
</button>
@@ -1872,18 +1878,18 @@ const showChatRating = ref(false);
<div class="mt-auto flex flex-col p-4">
<div v-if="userAgents.length > 0 && showAgentPanel" class="mb-4 rounded-2xl border border-slate-200 bg-slate-50/70 p-3 dark:border-slate-700 dark:bg-slate-800/60">
<div class="mb-2 flex items-center gap-1.5 text-xs font-semibold text-slate-500 dark:text-slate-400">
<LayoutGrid class="h-3.5 w-3.5" /> 智能体
<LayoutGrid class="h-3.5 w-3.5" /> {{ $t('chat.agents') }}
</div>
<div class="grid grid-cols-2 gap-1.5">
<div class="grid grid-cols-2 gap-x-2 gap-y-1.5">
<button
v-for="agent in userAgents"
:key="agent.id"
@click="switchToAgent(agent)"
class="flex items-center justify-center gap-1.5 rounded-xl px-2 py-2 text-xs font-medium text-slate-600 transition-colors hover:bg-white hover:shadow-sm dark:text-slate-200 dark:hover:bg-slate-700/50 truncate"
class="grid w-full min-w-0 grid-cols-[1rem_1fr] items-center gap-1.5 rounded-xl px-2 py-2 text-left text-xs font-medium text-slate-600 transition-colors hover:bg-white hover:shadow-sm dark:text-slate-200 dark:hover:bg-slate-700/50"
>
<div v-if="agent.icon_url" class="h-4 w-4 shrink-0 rounded bg-contain bg-center bg-no-repeat" :style="{ backgroundImage: `url(${agent.icon_url})` }"></div>
<div v-else class="flex h-4 w-4 shrink-0 items-center justify-center rounded bg-brand-100 text-[9px] font-bold text-brand-600 dark:bg-brand-900/30 dark:text-brand-400">{{ agent.name.charAt(0) }}</div>
<span class="truncate">{{ agent.name }}</span>
<span class="min-w-0 truncate">{{ agent.name }}</span>
</button>
</div>
</div>
@@ -1902,22 +1908,36 @@ const showChatRating = ref(false);
</div>
<div class="overflow-hidden">
<div class="text-sm font-bold text-slate-900 dark:text-slate-100 truncate">{{ currentUser?.username || 'User' }}</div>
<div v-if="(currentUser as any)?.employee_id" class="text-xs text-slate-500 dark:text-slate-400 truncate">工号: {{ (currentUser as any).employee_id }}</div>
<div v-if="(currentUser as any)?.employee_id" class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ $t('chat.employeeId') }}: {{ (currentUser as any).employee_id }}</div>
<div v-else class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ currentUser?.role }}</div>
</div>
</div>
<div class="px-4 pt-3 pb-1 text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('chat.language') }}</div>
<div class="px-4 pb-2">
<select v-model="locale" class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-brand-400 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-200">
<option value="zh-CN">简体中文</option>
<option value="en">English</option>
<option value="zh-TW">繁體中文</option>
<option value="th">ไทย</option>
</select>
</div>
<button @click="handleLogout" class="w-full text-left px-4 py-2 text-sm text-red-600 hover:bg-red-50 flex items-center gap-2 transition-colors mt-1">
<LogOut class="w-4 h-4" />
退出登录
{{ $t('chat.logout') }}
</button>
</div>
<div class="flex gap-3">
<button @click="userAgents.length === 0 ? undefined : (showAgentPanel = !showAgentPanel)" :class="showAgentPanel && userAgents.length > 0 ? 'text-brand-600 dark:text-brand-400' : ''" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="userAgents.length === 0 ? '暂无可用智能体' : (showAgentPanel ? '收起智能体' : '展开智能体')"><LayoutGrid class="h-4 w-4" /></button>
<button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Heart class="h-4 w-4" /></button>
<button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Bell class="h-4 w-4" /></button>
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" title="意见反馈"><Mail class="h-4 w-4" /></button>
<button @click="userAgents.length === 0 ? undefined : (showAgentPanel = !showAgentPanel)" :class="showAgentPanel && userAgents.length > 0 ? 'text-brand-600 dark:text-brand-400' : ''" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="userAgents.length === 0 ? $t('chat.noAvailableAgents') : (showAgentPanel ? $t('chat.collapseAgents') : $t('chat.expandAgents'))"><LayoutGrid class="h-4 w-4" /></button>
<!-- <button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Heart class="h-4 w-4" /></button> -->
<!-- <button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Bell class="h-4 w-4" /></button> -->
<button @click="toggleLightDark" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="appliedTheme === 'dark' ? ($t('theme.switchToLight') || 'Switch to light mode') : ($t('theme.switchToDark') || 'Switch to dark mode')">
<Sun v-if="appliedTheme === 'dark'" class="h-4 w-4" />
<Moon v-else class="h-4 w-4" />
</button>
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><Mail class="h-4 w-4" /></button>
<button @click="router.push('/workspace?no_redirect=1')" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Settings class="h-4 w-4" /></button>
</div>
</div>
@@ -1933,15 +1953,15 @@ const showChatRating = ref(false);
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ currentAgent?.name || 'AI' }}</span>
</div>
<div class="flex items-center gap-1">
<button @click="toggleMobileAgentPopover" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" title="智能体">
<button @click="toggleMobileAgentPopover" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" :title="$t('chat.agents')">
<LayoutGrid class="h-5 w-5" />
</button>
<button @click="router.push('/workspace?view=history')" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" title="历史记录">
<button @click="router.push('/workspace?view=history')" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" :title="$t('chat.history')">
<History class="h-5 w-5" />
</button>
</div>
<div v-if="showMobileAgentPopover" ref="mobileAgentPopoverRef" class="absolute right-4 top-12 z-50 w-72 rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-slate-700 dark:bg-slate-800">
<div class="mb-2 text-xs font-medium text-slate-400">智能体</div>
<div class="mb-2 text-xs font-medium text-slate-400">{{ $t('chat.agents') }}</div>
<div class="grid grid-cols-2 gap-2">
<button
v-for="agent in userAgents"
@@ -1955,7 +1975,7 @@ const showChatRating = ref(false);
<span class="w-full truncate text-xs font-medium text-slate-700 dark:text-slate-200">{{ agent.name }}</span>
</button>
</div>
<div v-if="userAgents.length === 0" class="py-3 text-center text-xs text-slate-400">暂无其他智能体</div>
<div v-if="userAgents.length === 0" class="py-3 text-center text-xs text-slate-400">{{ $t('chat.noOtherAgents') }}</div>
</div>
</header>
@@ -1987,7 +2007,7 @@ const showChatRating = ref(false);
<div class="mb-6 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-2xl font-bold text-white shadow-lg shadow-brand-500/20">
AI
</div>
<h2 class="text-center text-xl font-medium text-slate-800 dark:text-slate-100 md:text-2xl">你好,我是和信AI数字人</h2>
<h2 class="text-center text-xl font-medium text-slate-800 dark:text-slate-100 md:text-2xl">{{ $t('chat.welcomeTitle') }}</h2>
</div>
<template v-for="(msg, index) in messages" :key="index">
@@ -2014,16 +2034,11 @@ const showChatRating = ref(false);
<div v-else>
<div v-if="msg.type === 'leave-form'" class="space-y-4">
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">
<template v-if="msg.content.includes('或登录OA系统直接申请')">
已为你生成请假申请表,请直接在下方填写并提交。或 <a href="#" @click.prevent="openOALeaveRequestDirectly" class="text-brand-600 font-bold hover:underline">登录OA系统直接申请</a>
</template>
<template v-else>
{{ msg.content }}
</template>
{{ $t('chat.leaveFormIntro') }} <a href="#" @click.prevent="openOALeaveRequestDirectly" class="text-brand-600 font-bold hover:underline">{{ $t('chat.oaLeaveDirectLink') }}</a>
</div>
<div v-if="getLeaveFormPayload(msg)" class="grid gap-4 md:grid-cols-2">
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">填单人</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFiller') }}</span>
<input
v-model="getLeaveFormPayload(msg)!.form.fillerName"
type="text"
@@ -2032,7 +2047,7 @@ const showChatRating = ref(false);
/>
</label>
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">工号</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.employeeId') }}</span>
<input
v-model="getLeaveFormPayload(msg)!.form.employeeId"
type="text"
@@ -2041,7 +2056,7 @@ const showChatRating = ref(false);
/>
</label>
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">创建时间</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.createdAt') }}</span>
<input
:value="getLeaveFormPayload(msg)!.form.applyTime.replace('T', ' ')"
type="text"
@@ -2050,23 +2065,23 @@ const showChatRating = ref(false);
/>
</label>
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">假别</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveType') }}</span>
<select
v-model="getLeaveFormPayload(msg)!.form.leaveType"
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
>
<option value="" disabled>请选择假别</option>
<option value="" disabled>{{ $t('chat.selectLeaveType') }}</option>
<option v-for="leaveType in LEAVE_TYPES" :key="leaveType.value" :value="leaveType.value">{{ leaveType.label }}</option>
</select>
</label>
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">请假人</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicant') }}</span>
<div class="relative">
<input
:value="getLeaveFormPayload(msg)!.form.applicantName ? `${getLeaveFormPayload(msg)!.form.applicantName} / ${getLeaveFormPayload(msg)!.form.employeeId}` : ''"
type="text"
placeholder="请选择请假人"
:placeholder="$t('chat.selectLeaveApplicant')"
readonly
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 pr-11 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
@@ -2077,19 +2092,19 @@ const showChatRating = ref(false);
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-slate-400 transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
@click="openLeaveAgentDialog(msg, 'applicant')"
title="选择请假人"
:title="$t('chat.pickLeaveApplicant')"
>
<Search class="h-4 w-4" />
</button>
</div>
</label>
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">代理人</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgent') }}</span>
<div class="relative">
<input
:value="getLeaveAgentDisplayValue(getLeaveFormPayload(msg)!.form)"
type="text"
placeholder="请选择代理人"
:placeholder="$t('chat.selectLeaveAgent')"
readonly
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 pr-11 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
@@ -2100,14 +2115,14 @@ const showChatRating = ref(false);
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-slate-400 transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
@click="openLeaveAgentDialog(msg)"
title="选择代理人"
:title="$t('chat.pickLeaveAgent')"
>
<Search class="h-4 w-4" />
</button>
</div>
</label>
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">开始时间</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.startTime') }}</span>
<input
v-model="getLeaveFormPayload(msg)!.form.startTime"
type="datetime-local"
@@ -2117,7 +2132,7 @@ const showChatRating = ref(false);
/>
</label>
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">结束时间</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.endTime') }}</span>
<input
v-model="getLeaveFormPayload(msg)!.form.endTime"
type="datetime-local"
@@ -2127,7 +2142,7 @@ const showChatRating = ref(false);
/>
</label>
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">时长</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.duration') }}</span>
<input
:value="formatDurationLabel(getLeaveFormPayload(msg)!.form.durationHours)"
type="text"
@@ -2136,30 +2151,30 @@ const showChatRating = ref(false);
/>
</label>
<label class="space-y-1.5">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">是否外出</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.isOutOfOffice') }}</span>
<select
v-model="getLeaveFormPayload(msg)!.form.isOutOfOffice"
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
>
<option :value="1">否</option>
<option :value="0">是</option>
<option :value="1">{{ $t('chat.no') }}</option>
<option :value="0">{{ $t('chat.yes') }}</option>
</select>
</label>
<label class="space-y-1.5 md:col-span-2">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">是否为工伤</span>
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.isWorkInjury') }}</span>
<select
v-model="getLeaveFormPayload(msg)!.form.isWorkInjury"
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
>
<option :value="1">否</option>
<option :value="0">是</option>
<option :value="1">{{ $t('chat.no') }}</option>
<option :value="0">{{ $t('chat.yes') }}</option>
</select>
</label>
</div>
<div v-if="getLeaveFormPayload(msg)?.confirmationGenerated" class="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200">
已生成确认单,如需调整可直接修改表单后再次点击提交。
{{ $t('chat.leaveConfirmGenerated') }}
</div>
<div class="flex justify-end">
<button
@@ -2167,42 +2182,42 @@ const showChatRating = ref(false);
:disabled="getLeaveFormPayload(msg)?.submitting || getLeaveFormPayload(msg)?.confirmationGenerated"
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60"
>
{{ getLeaveFormPayload(msg)?.submitting ? '提交中...' : '提交' }}
{{ getLeaveFormPayload(msg)?.submitting ? $t('chat.submitting') : $t('chat.submit') }}
</button>
</div>
</div>
<div v-else-if="msg.type === 'leave-confirmation' && getLeaveConfirmationPayload(msg)" class="space-y-4">
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">{{ msg.content }}</div>
<div class="rounded-2xl border border-slate-200 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/60">
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">填单人信息</div>
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveFillerInfo') }}</div>
<div class="grid gap-3 text-sm md:grid-cols-2">
<div><span class="text-slate-500 dark:text-slate-400">填单人:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerName || '暂无数据' }}</div>
<div><span class="text-slate-500 dark:text-slate-400">创建时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle"><span class="text-slate-500 dark:text-slate-400">填单人职务:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId"><span class="text-slate-500 dark:text-slate-400">填单人部门:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">填单人公司:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1 }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFiller') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerName || $t('chat.noData') }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.createdAt') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1 }}</div>
</div>
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></div>
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">申请人信息</div>
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveApplicantInfo') }}</div>
<div class="grid gap-3 text-sm md:grid-cols-2">
<div><span class="text-slate-500 dark:text-slate-400">请假人:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantName }}({{ getLeaveConfirmationPayload(msg)!.form.employeeId }})</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle"><span class="text-slate-500 dark:text-slate-400">申请人职务:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId"><span class="text-slate-500 dark:text-slate-400">申请人部门:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">申请人公司:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1 }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicant') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantName }}({{ getLeaveConfirmationPayload(msg)!.form.employeeId }})</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1 }}</div>
</div>
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></div>
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">请假信息</div>
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveInfo') }}</div>
<div class="grid gap-3 text-sm md:grid-cols-2">
<div><span class="text-slate-500 dark:text-slate-400">代理人:</span>{{ getLeaveAgentDisplayValue(getLeaveConfirmationPayload(msg)!.form) || '未选择' }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle"><span class="text-slate-500 dark:text-slate-400">代理人职务:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId"><span class="text-slate-500 dark:text-slate-400">代理人部门:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">代理人公司:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1 }}</div>
<div><span class="text-slate-500 dark:text-slate-400">假别:</span>{{ getLeaveTypeLabel(getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
<div><span class="text-slate-500 dark:text-slate-400">时长:</span>{{ formatDurationLabel(getLeaveConfirmationPayload(msg)!.form.durationHours) }}</div>
<div><span class="text-slate-500 dark:text-slate-400">开始时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.startTime.replace('T', ' ') }}</div>
<div><span class="text-slate-500 dark:text-slate-400">结束时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.endTime.replace('T', ' ') }}</div>
<div><span class="text-slate-500 dark:text-slate-400">是否外出:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isOutOfOffice) }}</div>
<div><span class="text-slate-500 dark:text-slate-400">是否为工伤:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgent') }}:</span>{{ getLeaveAgentDisplayValue(getLeaveConfirmationPayload(msg)!.form) || $t('chat.notSelected') }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId }}</div>
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1 }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveType') }}:</span>{{ getLeaveTypeLabel(getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.duration') }}:</span>{{ formatDurationLabel(getLeaveConfirmationPayload(msg)!.form.durationHours) }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.startTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.startTime.replace('T', ' ') }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.endTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.endTime.replace('T', ' ') }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.isOutOfOffice') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isOutOfOffice) }}</div>
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.isWorkInjury') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
</div>
</div>
<div class="flex justify-end gap-3">
@@ -2211,14 +2226,14 @@ const showChatRating = ref(false);
@click="editLeaveConfirmation(msg, index)"
class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
>
返回修改
{{ $t('chat.backToEdit') }}
</button>
<button
@click="confirmLeaveSubmission(msg)"
:disabled="getLeaveConfirmationPayload(msg)?.submitting || getLeaveConfirmationPayload(msg)?.confirmed"
class="rounded-xl bg-emerald-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-emerald-700 disabled:cursor-not-allowed disabled:opacity-60"
>
{{ getLeaveConfirmationPayload(msg)?.submitting ? '确认中...' : (getLeaveConfirmationPayload(msg)?.confirmed ? '已确认' : '确认') }}
{{ getLeaveConfirmationPayload(msg)?.submitting ? $t('chat.confirming') : (getLeaveConfirmationPayload(msg)?.confirmed ? $t('chat.confirmed') : $t('chat.confirm')) }}
</button>
</div>
</div>
@@ -2229,20 +2244,20 @@ const showChatRating = ref(false);
? 'border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-100'
: 'border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-100'"
>
<div class="text-sm font-semibold">{{ getLeaveResultPayload(msg)!.success ? 'OA 提交结果' : 'OA 提交失败' }}</div>
<div class="text-sm font-semibold">{{ getLeaveResultPayload(msg)!.success ? $t('chat.oaSubmitResult') : $t('chat.oaSubmitFailed') }}</div>
<div v-if="getLeaveResultPayload(msg)!.success" class="mt-2 whitespace-pre-wrap text-sm leading-7">
请假单已推送到 OA,具体单据请
{{ $t('chat.leaveResultPrefix') }}
<a
href="#"
@click.prevent="openOARequestDirectly(getLeaveResultPayload(msg)!.referenceNo)"
class="ml-1 inline-flex items-center rounded-full border border-brand-200 bg-brand-50 px-3 py-0.5 font-bold text-brand-700 transition hover:bg-brand-100 hover:underline dark:border-brand-500/30 dark:bg-brand-500/10 dark:text-brand-200 dark:hover:bg-brand-500/20"
>
【 登录OA系统查看提交】
{{ $t('chat.leaveResultLinkText') }}
</a>
</div>
<div v-else class="mt-2 whitespace-pre-wrap text-sm leading-7">{{ msg.content }}</div>
<div class="mt-3 text-xs opacity-80">单据编号:{{ getLeaveResultPayload(msg)!.referenceNo }}</div>
<div class="mt-1 text-xs opacity-80">提交时间:{{ getLeaveResultPayload(msg)!.submittedAt }}</div>
<div class="mt-3 text-xs opacity-80">{{ $t('chat.requestNo') }}:{{ getLeaveResultPayload(msg)!.referenceNo }}</div>
<div class="mt-1 text-xs opacity-80">{{ $t('chat.submitTime') }}:{{ getLeaveResultPayload(msg)!.submittedAt }}</div>
</div>
</div>
<div
@@ -2276,7 +2291,7 @@ const showChatRating = ref(false);
:open="shouldExpandSourceDetails(msg)"
>
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
源文档 ({{ getDisplayRetrieverResources(msg).length }})
{{ $t('chat.sourceDocs') }} ({{ getDisplayRetrieverResources(msg).length }})
</summary>
<div class="mt-3 space-y-2">
<div
@@ -2297,7 +2312,7 @@ const showChatRating = ref(false);
open
>
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
生成内容归属部分
{{ $t('chat.attributionParts') }}
</summary>
<ul class="mt-3 space-y-2">
<li
@@ -2355,7 +2370,7 @@ const showChatRating = ref(false);
v-if="showChatRating && !isThinking && !(msg as any).rated"
@click="handleOpenFeedback(index)"
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
title="评价回答"
:title="$t('chat.rate')"
>
<MessageSquareText class="h-3.5 w-3.5" />
</button>
@@ -2387,7 +2402,7 @@ const showChatRating = ref(false);
v-model="input"
@keydown.enter.prevent="handleSend"
rows="1"
placeholder="问我任何事..."
:placeholder="$t('chat.askAnything')"
class="w-full resize-none border-none bg-transparent px-3 py-2 text-[15px] leading-relaxed text-slate-800 placeholder-slate-400 focus:outline-none focus:ring-0 focus:border-transparent dark:text-slate-100"
style="min-height: 44px; max-height: 220px;"
:disabled="isThinking"
@@ -2401,7 +2416,7 @@ const showChatRating = ref(false);
<button
@click="handleVoiceFeatureClick"
type="button"
title="语音功能"
:title="$t('chat.voiceFeature')"
class="text-slate-400 transition-colors hover:text-brand-600 dark:hover:text-brand-300"
>
<Mic class="h-5 w-5" />
@@ -2435,7 +2450,7 @@ const showChatRating = ref(false);
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
>
<Globe class="h-3.5 w-3.5 text-brand-500" />
{{ browserPanelOpen ? '收起浏览器' : '打开浏览器' }}
{{ browserPanelOpen ? $t('chat.collapseBrowser') : $t('chat.openBrowser') }}
</button>
</div>
<button
@@ -2451,7 +2466,7 @@ const showChatRating = ref(false);
</div>
</div>
<div class="mt-3 text-center text-[11px] text-slate-400">
AI 可能会犯错,请核实重要信息。
{{ $t('chat.disclaimer') }}
</div>
</div>
</footer>
@@ -2482,12 +2497,12 @@ const showChatRating = ref(false);
<div class="flex items-center justify-between border-b border-slate-200 px-4 py-3 dark:border-slate-800">
<div class="flex items-center gap-2 text-sm font-semibold text-slate-700 dark:text-slate-100">
<Globe class="h-4 w-4 text-brand-500" />
浏览器
{{ $t('chat.browser') }}
</div>
<button
@click="browserPanelOpen = false"
class="rounded-md p-1.5 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-800 dark:hover:text-slate-200"
title="关闭浏览器"
:title="$t('chat.closeBrowser')"
>
<X class="h-4 w-4" />
</button>
@@ -2497,7 +2512,7 @@ const showChatRating = ref(false);
<input
v-model="browserDraftUrl"
type="text"
placeholder="输入网址,例如 https://example.com"
:placeholder="$t('chat.browserInputPlaceholder')"
class="flex-1 rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-800 outline-none transition focus:border-brand-400 focus:bg-white dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:focus:bg-slate-950"
@keydown="handleBrowserUrlEnter"
/>
@@ -2505,19 +2520,19 @@ const showChatRating = ref(false);
@click="loadBrowserPage"
class="rounded-xl bg-brand-600 px-3 py-2 text-xs font-medium text-white transition-colors hover:bg-brand-500"
>
打开
{{ $t('chat.open') }}
</button>
<button
@click="refreshBrowserPage"
class="rounded-xl border border-slate-200 p-2 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-700 dark:border-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200"
title="刷新"
:title="$t('chat.refresh')"
>
<RotateCw class="h-4 w-4" />
</button>
<button
@click="openBrowserInNewTab"
class="rounded-xl border border-slate-200 p-2 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-700 dark:border-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200"
title="新标签打开"
:title="$t('chat.openInNewTab')"
>
<ExternalLink class="h-4 w-4" />
</button>
@@ -2529,8 +2544,8 @@ const showChatRating = ref(false);
class="flex h-full flex-col items-center justify-center gap-3 px-8 text-center text-sm text-slate-500 dark:text-slate-400"
>
<Globe class="h-8 w-8 text-brand-500" />
<div>在这里直接打开网页,边聊天边查看内容。</div>
<div class="text-xs">支持输入 `https://`、`localhost` 或内网 IP 地址。</div>
<div>{{ $t('chat.browserHint1') }}</div>
<div class="text-xs">{{ $t('chat.browserHint2') }}</div>
</div>
<iframe
v-else
@@ -2561,7 +2576,7 @@ const showChatRating = ref(false);
if (activeFeedbackMessageIndex !== null && messages[activeFeedbackMessageIndex]) {
(messages[activeFeedbackMessageIndex] as any).rated = true;
}
showMessageDialog('success', '\u53cd\u9988\u63d0\u4ea4\u6210\u529f');
showMessageDialog('success', t('chat.feedbackSubmitSuccess'));
showGeneralFeedbackDialog = false;
}"
/>
@@ -2573,8 +2588,8 @@ const showChatRating = ref(false);
<div class="flex w-full max-w-2xl max-h-[80vh] flex-col rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-900">
<div class="mb-4 flex items-center justify-between">
<div>
<h3 class="text-lg font-bold text-slate-800 dark:text-slate-100">选择{{ leaveUserSelectRole === 'agent' ? '代理人' : '请假人' }}</h3>
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">已接入 OA 数据库视图查询。</p>
<h3 class="text-lg font-bold text-slate-800 dark:text-slate-100">{{ $t('chat.selectWho', { role: leaveUserSelectRole === 'agent' ? $t('chat.leaveAgent') : $t('chat.leaveApplicant') }) }}</h3>
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ $t('chat.oaDataConnected') }}</p>
</div>
<button @click="closeLeaveAgentDialog" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200">
<X class="h-5 w-5" />
@@ -2586,7 +2601,7 @@ const showChatRating = ref(false);
v-model="leaveAgentKeyword"
@keydown.enter="handleAgentSearch"
type="text"
placeholder="输入姓名或工号搜索,按回车键查询"
:placeholder="$t('chat.searchByNameOrEmployeeId')"
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 pr-10 text-sm outline-none transition focus:border-brand-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
/>
<button @click="handleAgentSearch" class="absolute inset-y-0 right-0 flex w-10 items-center justify-center text-slate-400 hover:text-brand-600">
@@ -2599,7 +2614,7 @@ const showChatRating = ref(false);
<Loader2 class="h-6 w-6 animate-spin text-brand-500" />
</div>
<div v-else-if="leaveAgentOptions.length === 0" class="py-8 text-center text-sm text-slate-400">
暂无数据
{{ $t('chat.noData') }}
</div>
<template v-else>
<button
@@ -2614,8 +2629,8 @@ const showChatRating = ref(false);
<div class="text-xs text-slate-500 dark:text-slate-400">UID:{{ option.uid }}</div>
</div>
<div class="text-right text-xs text-slate-500 dark:text-slate-400">
<div>工号:{{ option.employeeId }}</div>
<div>姓名:{{ option.name }}</div>
<div>{{ $t('chat.employeeId') }}:{{ option.employeeId }}</div>
<div>{{ $t('chat.name') }}:{{ option.name }}</div>
</div>
</button>
@@ -2625,17 +2640,17 @@ const showChatRating = ref(false);
:disabled="leaveAgentLoading"
class="text-xs text-slate-500 hover:text-slate-700 disabled:opacity-50 dark:text-slate-400 dark:hover:text-slate-300"
>
加载全部
{{ $t('chat.loadAll') }}
</button>
<button
@click="loadMoreAgents"
:disabled="leaveAgentLoading"
class="text-xs text-brand-600 hover:text-brand-700 disabled:opacity-50"
>
{{ leaveAgentLoading ? '加载中...' : '加载更多' }}
{{ leaveAgentLoading ? $t('chat.loading') : $t('chat.loadMore') }}
</button>
</div>
<div v-else class="py-4 text-center text-xs text-slate-400">没有更多数据了</div>
<div v-else class="py-4 text-center text-xs text-slate-400">{{ $t('chat.noMoreData') }}</div>
</template>
</div>
</div>
@@ -2646,10 +2661,10 @@ const showChatRating = ref(false);
<div v-if="showOALoginDialog" class="fixed inset-0 z-[9999] flex items-center justify-center">
<div class="absolute inset-0 bg-black/40" @click="cancelOALogin"></div>
<div class="relative w-full max-w-sm rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-800">
<h3 class="mb-4 text-center text-lg font-bold text-slate-800 dark:text-slate-100">登录OA系统</h3>
<h3 class="mb-4 text-center text-lg font-bold text-slate-800 dark:text-slate-100">{{ $t('chat.loginOaSystem') }}</h3>
<div class="space-y-4">
<label class="block space-y-1.5">
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">工号</span>
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">{{ $t('chat.employeeId') }}</span>
<input
v-model="oaLoginEmployeeId"
type="text"
@@ -2658,11 +2673,11 @@ const showChatRating = ref(false);
/>
</label>
<label class="block space-y-1.5">
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">密码</span>
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">{{ $t('login.password') }}</span>
<input
v-model="oaLoginPassword"
type="password"
placeholder="请输入OA登录密码"
:placeholder="$t('chat.enterOaPassword')"
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-800 outline-none focus:border-brand-400 focus:ring-2 focus:ring-brand-100 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100 dark:focus:border-brand-500 dark:focus:ring-brand-500/20"
@keyup.enter="confirmOALogin"
/>
@@ -2673,13 +2688,13 @@ const showChatRating = ref(false);
@click="cancelOALogin"
class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-700"
>
取消
{{ $t('profile.cancel') }}
</button>
<button
@click="confirmOALogin"
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-brand-700 dark:bg-brand-500 dark:hover:bg-brand-600"
>
确认登录
{{ $t('chat.confirmLogin') }}
</button>
</div>
</div>
-360
View File
@@ -1,360 +0,0 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { ArrowLeft, FolderPlus, Pencil, Play, RefreshCw, Settings, Trash2, Wrench, X } from 'lucide-vue-next';
import DifyHealthDialog from '../components/kb/DifyHealthDialog.vue';
import DifySettingsDialog from '../components/kb/DifySettingsDialog.vue';
import {
createKbGroup,
deleteKbGroup,
getKbGroupsSafe,
getKbJobsSafe,
runKbJob,
updateKbGroup,
type KbGroup,
type KbJob,
} from '../api/kb';
const router = useRouter();
const groups = ref<KbGroup[]>([]);
const jobs = ref<KbJob[]>([]);
const isSubmitting = ref(false);
const isRefreshing = ref(false);
const editingGroupId = ref<number | null>(null);
const form = ref({
name: '',
description: '',
});
const feedback = ref('');
const feedbackType = ref<'success' | 'error' | ''>('');
const runningJobId = ref<number | string | null>(null);
const settingsDialogOpen = ref(false);
const healthDialogOpen = ref(false);
const formTitle = computed(() => editingGroupId.value ? '编辑知识库分组' : '新建知识库分组');
const formDescription = computed(() => editingGroupId.value
? '修改知识库分组名称和描述,保存后会立即刷新列表。'
: '用于验证主平台里的知识库管理入口和基础接口壳。');
const submitText = computed(() => {
if (isSubmitting.value) return editingGroupId.value ? '保存中...' : '提交中...';
return editingGroupId.value ? '保存修改' : '创建分组';
});
const loadData = async () => {
isRefreshing.value = true;
const [groupsResult, jobsResult] = await Promise.all([getKbGroupsSafe(), getKbJobsSafe()]);
if (groupsResult.ok) {
groups.value = groupsResult.data;
} else {
feedback.value = groupsResult.error || '加载知识库分组失败';
feedbackType.value = 'error';
}
if (jobsResult.ok) {
jobs.value = jobsResult.data;
} else {
feedback.value = jobsResult.error || '加载任务列表失败';
feedbackType.value = 'error';
}
isRefreshing.value = false;
};
const resetForm = () => {
editingGroupId.value = null;
form.value = { name: '', description: '' };
};
const handleCreateGroup = async () => {
if (!form.value.name.trim()) {
feedback.value = '请输入知识库分组名称';
feedbackType.value = 'error';
return;
}
isSubmitting.value = true;
const payload = {
name: form.value.name.trim(),
description: form.value.description.trim(),
};
const result = editingGroupId.value
? await updateKbGroup(editingGroupId.value, payload)
: await createKbGroup(payload);
isSubmitting.value = false;
if (!result.ok) {
feedback.value = result.error || '创建失败';
feedbackType.value = 'error';
return;
}
feedback.value = editingGroupId.value ? '知识库分组已更新' : '知识库分组创建成功';
feedbackType.value = 'success';
resetForm();
await loadData();
};
const handleEditGroup = (group: KbGroup) => {
editingGroupId.value = group.id;
form.value = {
name: group.name,
description: group.description || '',
};
feedback.value = '';
feedbackType.value = '';
};
const handleDeleteGroup = async (group: KbGroup) => {
const confirmed = window.confirm(`确认删除知识库分组「${group.name}」吗?`);
if (!confirmed) return;
const result = await deleteKbGroup(group.id);
if (!result.ok) {
feedback.value = result.error || '删除失败';
feedbackType.value = 'error';
return;
}
if (editingGroupId.value === group.id) {
resetForm();
}
feedback.value = '知识库分组已删除';
feedbackType.value = 'success';
await loadData();
};
const handleRunJob = async (job: KbJob) => {
runningJobId.value = job.id;
const result = await runKbJob(job.id);
runningJobId.value = null;
if (!result.ok) {
feedback.value = result.error || '任务执行失败';
feedbackType.value = 'error';
return;
}
feedback.value = result.run_result || '任务已执行';
feedbackType.value = 'success';
await loadData();
};
onMounted(async () => {
await loadData();
});
</script>
<template>
<div class="min-h-screen bg-gray-50 dark:bg-slate-950 text-slate-800 dark:text-slate-200">
<div class="mx-auto max-w-7xl px-4 py-6 md:px-6 lg:px-8">
<div class="mb-6 flex flex-col gap-4 rounded-3xl border border-slate-200 bg-white p-6 shadow-sm md:flex-row md:items-center md:justify-between dark:border-slate-700 dark:bg-slate-900">
<div class="flex items-start gap-4">
<button
@click="router.push('/admin')"
class="rounded-2xl border border-slate-200 p-3 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-900 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800 dark:hover:text-white"
title="返回管理后台"
>
<ArrowLeft class="h-5 w-5" />
</button>
<div class="flex items-center gap-3">
<div class="flex h-12 w-12 items-center justify-center rounded-2xl bg-brand-50 text-brand-600 dark:bg-brand-500/10">
<Settings class="h-6 w-6" />
</div>
<div>
<h1 class="text-2xl font-bold text-slate-900 dark:text-slate-100">知识库管理台</h1>
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">
第一阶段先承接分组、任务和 Dify 管理入口,后续再接入清洗链路。
</p>
</div>
</div>
</div>
<div class="flex items-center gap-3">
<button
@click="loadData"
class="inline-flex items-center gap-2 rounded-2xl border border-slate-200 px-4 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
>
<RefreshCw class="h-4 w-4" />
刷新数据
</button>
<button
@click="settingsDialogOpen = true"
class="inline-flex items-center gap-2 rounded-2xl border border-slate-200 px-4 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
>
<Settings class="h-4 w-4" />
Dify 设置
</button>
<button
@click="healthDialogOpen = true"
class="inline-flex items-center gap-2 rounded-2xl border border-slate-200 px-4 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
>
<RefreshCw class="h-4 w-4" />
健康检查
</button>
<button
@click="router.push('/kb/workspace')"
class="inline-flex items-center gap-2 rounded-2xl bg-brand-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-brand-700"
>
<Wrench class="h-4 w-4" />
前往工作台
</button>
</div>
</div>
<div class="grid grid-cols-1 gap-6 xl:grid-cols-[420px_minmax(0,1fr)]">
<section class="rounded-3xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-700 dark:bg-slate-900">
<div class="mb-5 flex items-center gap-3">
<div class="flex h-10 w-10 items-center justify-center rounded-2xl bg-brand-50 text-brand-600 dark:bg-brand-500/10">
<FolderPlus class="h-5 w-5" />
</div>
<div>
<h2 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ formTitle }}</h2>
<p class="text-sm text-slate-500 dark:text-slate-400">{{ formDescription }}</p>
</div>
</div>
<div class="space-y-4">
<div>
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">分组名称</label>
<input v-model="form.name" class="input-field" placeholder="例如:财务制度库" />
</div>
<div>
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">分组描述</label>
<textarea
v-model="form.description"
rows="4"
class="input-field"
placeholder="描述该知识库分组的业务范围或清洗目标"
/>
</div>
<button
@click="handleCreateGroup"
:disabled="isSubmitting"
class="inline-flex w-full items-center justify-center gap-2 rounded-2xl bg-brand-600 px-4 py-3 text-sm font-medium text-white transition-colors hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60"
>
<FolderPlus class="h-4 w-4" />
{{ submitText }}
</button>
<button
v-if="editingGroupId"
@click="resetForm"
type="button"
class="inline-flex w-full items-center justify-center gap-2 rounded-2xl border border-slate-200 px-4 py-3 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
>
<X class="h-4 w-4" />
取消编辑
</button>
<p
v-if="feedback"
class="text-sm"
:class="feedbackType === 'error' ? 'text-rose-500' : 'text-emerald-600 dark:text-emerald-400'"
>
{{ feedback }}
</p>
</div>
</section>
<div class="space-y-6">
<section class="rounded-3xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-700 dark:bg-slate-900">
<div class="mb-4 flex items-center justify-between">
<h2 class="text-lg font-semibold text-slate-900 dark:text-slate-100">知识库分组概览</h2>
<span class="text-xs text-slate-400">{{ isRefreshing ? '加载中...' : '`/api/kb/groups`' }}</span>
</div>
<div v-if="groups.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
当前暂无分组,或知识库接口尚未联调完成。
</div>
<div v-else class="grid grid-cols-1 gap-3 md:grid-cols-2">
<div
v-for="group in groups"
:key="group.id"
class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"
>
<div class="flex items-start justify-between gap-3">
<div class="min-w-0">
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ group.name }}</div>
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ group.description || '暂无描述' }}</div>
</div>
<div class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
{{ group.document_count ?? 0 }} 文档
</div>
</div>
<div class="mt-4 flex flex-wrap items-center justify-between gap-3">
<div class="text-xs text-slate-400">
更新时间:{{ group.updated_at || '--' }}
</div>
<div class="flex items-center gap-2">
<button
@click="handleEditGroup(group)"
class="inline-flex items-center gap-1 rounded-xl border border-slate-200 px-3 py-2 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
>
<Pencil class="h-3.5 w-3.5" />
编辑
</button>
<button
@click="handleDeleteGroup(group)"
class="inline-flex items-center gap-1 rounded-xl border border-rose-200 px-3 py-2 text-xs font-medium text-rose-600 transition-colors hover:bg-rose-50 dark:border-rose-500/30 dark:text-rose-400 dark:hover:bg-rose-500/10"
>
<Trash2 class="h-3.5 w-3.5" />
删除
</button>
</div>
</div>
</div>
</div>
</section>
<section class="rounded-3xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-700 dark:bg-slate-900">
<div class="mb-4 flex items-center justify-between">
<h2 class="text-lg font-semibold text-slate-900 dark:text-slate-100">任务队列占位</h2>
<span class="text-xs text-slate-400">`/api/kb/jobs`</span>
</div>
<div v-if="jobs.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
暂无任务。第二阶段会在这里接入清洗、同步和重试任务。
</div>
<div v-else class="space-y-3">
<div
v-for="job in jobs"
:key="job.id"
class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"
>
<div class="flex items-start justify-between gap-3">
<div class="min-w-0">
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ job.job_type }}</div>
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ job.created_at || '--' }}</div>
<div class="mt-2 text-sm text-slate-500 dark:text-slate-400">
{{ job.message || '暂无任务说明' }}
</div>
<div class="mt-2 text-xs text-slate-400">
文档:{{ job.document_id ?? '--' }} · 版本:{{ job.document_version_id ?? '--' }} · 进度:{{ job.progress ?? 0 }}%
</div>
</div>
<span class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
{{ job.status }}
</span>
</div>
<div class="mt-3 flex justify-end" v-if="['clean', 'sync_dify'].includes(job.job_type) && job.status !== 'success'">
<button
@click="handleRunJob(job)"
:disabled="runningJobId === job.id"
class="inline-flex items-center gap-1 rounded-xl border border-brand-200 px-3 py-2 text-xs font-medium text-brand-700 transition-colors hover:bg-brand-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-brand-500/30 dark:text-brand-300 dark:hover:bg-brand-500/10"
>
<Play class="h-3.5 w-3.5" />
{{ runningJobId === job.id ? '执行中...' : '执行任务' }}
</button>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
<DifySettingsDialog
:open="settingsDialogOpen"
@close="settingsDialogOpen = false"
@saved="(message) => { feedback = message; feedbackType = 'success'; void loadData(); }"
@error="(message) => { feedback = message; feedbackType = 'error'; }"
/>
<DifyHealthDialog
:open="healthDialogOpen"
@close="healthDialogOpen = false"
@error="(message) => { feedback = message; feedbackType = 'error'; }"
/>
</template>
+8 -8
View File
@@ -1578,6 +1578,14 @@ onMounted(async () => {
<User class="h-4 w-4" />
<span>个人中心</span>
</button>
<button
v-if="currentUser?.role === 'admin'"
@click="openAdminPanel"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
>
<Settings class="h-4 w-4" />
<span>管理后台</span>
</button>
<button
@click="navigateToApplications"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
@@ -1630,14 +1638,6 @@ onMounted(async () => {
<Bot class="h-4 w-4" />
<span>返回聊天</span>
</button>
<button
v-if="currentUser?.role === 'admin'"
@click="openAdminPanel"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
>
<Settings class="h-4 w-4" />
<span>管理后台</span>
</button>
<button
@click="handleLogout"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-red-500 transition-all hover:bg-red-50 hover:text-red-600"