Merge branch 'test' into prod
This commit is contained in:
commit
23e058e662
24 files changed
+1609
-577
No files matched your search
@@ -35,3 +35,6 @@ CASDOOR_WECOM_PROVIDER_HINT=wecom
|
|||||||
|
|
||||||
# Gunicorn配置
|
# Gunicorn配置
|
||||||
GUNICORN_WORKERS=6
|
GUNICORN_WORKERS=6
|
||||||
|
|
||||||
|
# 企业微信通知配置(如果不使用企业微信通知,留空即可)
|
||||||
|
WECOM_NOTIFY_BASE_URL=http://ait.well-trust.com:8890/
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# 供 pre-commit / pre-push 引用;勿直接执行。
|
||||||
|
|
||||||
|
hook_should_skip() {
|
||||||
|
[[ "${SKIP_GIT_HOOKS:-}" == "1" ]] || [[ "${SKIP_FRONTEND_HOOKS:-}" == "1" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
frontend_paths_in() {
|
||||||
|
local file_list="${1:-}"
|
||||||
|
echo "${file_list}" | grep -qE '^frontend/'
|
||||||
|
}
|
||||||
|
|
||||||
|
ensure_frontend_deps() {
|
||||||
|
local frontend_dir="${1}/frontend"
|
||||||
|
if [[ ! -d "${frontend_dir}/node_modules" ]]; then
|
||||||
|
echo "[git-hook] frontend/node_modules 不存在,请先执行:"
|
||||||
|
echo " cd frontend && npm install"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
run_frontend_typecheck() {
|
||||||
|
local root_dir="${1}"
|
||||||
|
echo "[pre-commit] 检测到 frontend/ 变更,运行 vue-tsc 类型检查..."
|
||||||
|
if ! ensure_frontend_deps "${root_dir}"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
(
|
||||||
|
cd "${root_dir}/frontend"
|
||||||
|
npx vue-tsc -b --pretty false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
run_frontend_build() {
|
||||||
|
local root_dir="${1}"
|
||||||
|
echo "[pre-push] 检测到将要推送的提交包含 frontend/ 变更,运行 npm run build..."
|
||||||
|
if ! ensure_frontend_deps "${root_dir}"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
(
|
||||||
|
cd "${root_dir}/frontend"
|
||||||
|
npm run build
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ set -euo pipefail
|
|||||||
|
|
||||||
ROOT_DIR="$(git rev-parse --show-toplevel)"
|
ROOT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
cd "${ROOT_DIR}"
|
cd "${ROOT_DIR}"
|
||||||
|
# shellcheck source=_common.sh
|
||||||
|
source "${ROOT_DIR}/.githooks/_common.sh"
|
||||||
|
|
||||||
STAGED_FILES="$(git diff --cached --name-only --diff-filter=ACMR || true)"
|
STAGED_FILES="$(git diff --cached --name-only --diff-filter=ACMR || true)"
|
||||||
if [[ -z "${STAGED_FILES}" ]]; then
|
if [[ -z "${STAGED_FILES}" ]]; then
|
||||||
@@ -30,4 +32,18 @@ if [[ "${MODELS_CHANGED}" -eq 1 && "${MIGRATION_CHANGED}" -eq 0 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if hook_should_skip; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if frontend_paths_in "${STAGED_FILES}"; then
|
||||||
|
if ! run_frontend_typecheck "${ROOT_DIR}"; then
|
||||||
|
echo "[pre-commit] vue-tsc 失败,已阻止提交。"
|
||||||
|
echo "[pre-commit] 跳过前端检查: SKIP_FRONTEND_HOOKS=1 git commit"
|
||||||
|
echo "[pre-commit] 或跳过全部 hook: git commit --no-verify"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "[pre-commit] frontend 类型检查通过。"
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
|
# shellcheck source=_common.sh
|
||||||
|
source "${ROOT_DIR}/.githooks/_common.sh"
|
||||||
|
|
||||||
|
if hook_should_skip; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
zero="0000000000000000000000000000000000000000"
|
||||||
|
need_frontend_build=0
|
||||||
|
|
||||||
|
while read -r local_ref local_sha remote_ref remote_sha; do
|
||||||
|
[[ "${local_sha}" == "${zero}" ]] && continue
|
||||||
|
|
||||||
|
changed_files=""
|
||||||
|
if [[ "${remote_sha}" == "${zero}" ]]; then
|
||||||
|
upstream_ref="$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null || true)"
|
||||||
|
if [[ -n "${upstream_ref}" ]]; then
|
||||||
|
remote_branch="${upstream_ref#*/}"
|
||||||
|
remote_name="${upstream_ref%%/*}"
|
||||||
|
merge_base="$(git merge-base "${local_sha}" "${remote_name}/${remote_branch}" 2>/dev/null || true)"
|
||||||
|
if [[ -n "${merge_base}" ]]; then
|
||||||
|
changed_files="$(git diff --name-only --diff-filter=ACMR "${merge_base}" "${local_sha}" || true)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ -z "${changed_files}" ]]; then
|
||||||
|
changed_files="$(git diff-tree --no-commit-id --name-only --diff-filter=ACMR -r "${local_sha}" || true)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
changed_files="$(git diff --name-only --diff-filter=ACMR "${remote_sha}" "${local_sha}" || true)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if frontend_paths_in "${changed_files}"; then
|
||||||
|
need_frontend_build=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${need_frontend_build}" -eq 0 ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! run_frontend_build "${ROOT_DIR}"; then
|
||||||
|
echo "[pre-push] 前端 build 失败,已阻止 push。"
|
||||||
|
echo "[pre-push] 跳过检查可设置: SKIP_FRONTEND_HOOKS=1 git push"
|
||||||
|
echo "[pre-push] 或跳过全部 hook: git push --no-verify"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[pre-push] 前端 build 通过。"
|
||||||
|
exit 0
|
||||||
Vendored
+16
@@ -329,6 +329,22 @@ 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('Deploy Dev') {
|
stage('Deploy Dev') {
|
||||||
when {
|
when {
|
||||||
expression {
|
expression {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ def _serialize_agent_row(row) -> dict:
|
|||||||
'name': row.name,
|
'name': row.name,
|
||||||
'description': row.description,
|
'description': row.description,
|
||||||
'icon_url': row.icon_url,
|
'icon_url': row.icon_url,
|
||||||
|
'dify_app_type': (row.extra_config or {}).get('dify_app_type') if hasattr(row, 'extra_config') else None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ def list_user_agents():
|
|||||||
# 管理员:返回所有激活的 Agent
|
# 管理员:返回所有激活的 Agent
|
||||||
if user.role == 'admin':
|
if user.role == 'admin':
|
||||||
agent_rows = (
|
agent_rows = (
|
||||||
db.session.query(Agent.id, Agent.name, Agent.description, Agent.icon_url)
|
db.session.query(Agent.id, Agent.name, Agent.description, Agent.icon_url, Agent.extra_config)
|
||||||
.filter(Agent.is_active.is_(True))
|
.filter(Agent.is_active.is_(True))
|
||||||
.order_by(Agent.id.asc())
|
.order_by(Agent.id.asc())
|
||||||
.all()
|
.all()
|
||||||
@@ -48,6 +49,7 @@ def list_user_agents():
|
|||||||
'name': a.name,
|
'name': a.name,
|
||||||
'description': a.description,
|
'description': a.description,
|
||||||
'icon_url': a.icon_url,
|
'icon_url': a.icon_url,
|
||||||
|
'extra_config': a.extra_config,
|
||||||
})()
|
})()
|
||||||
for a in user.agents
|
for a in user.agents
|
||||||
if a.is_active
|
if a.is_active
|
||||||
@@ -64,7 +66,7 @@ def list_public_agents():
|
|||||||
"""
|
"""
|
||||||
# 返回所有激活的 Agent,包含基本信息
|
# 返回所有激活的 Agent,包含基本信息
|
||||||
agent_rows = (
|
agent_rows = (
|
||||||
db.session.query(Agent.id, Agent.name, Agent.description, Agent.icon_url)
|
db.session.query(Agent.id, Agent.name, Agent.description, Agent.icon_url, Agent.extra_config)
|
||||||
.filter(Agent.is_active.is_(True))
|
.filter(Agent.is_active.is_(True))
|
||||||
.order_by(Agent.id.asc())
|
.order_by(Agent.id.asc())
|
||||||
.all()
|
.all()
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import threading
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from flask import Blueprint, current_app, jsonify, request, send_file
|
from flask import Blueprint, current_app, jsonify, request, send_file
|
||||||
|
from flask import Response
|
||||||
|
from io import BytesIO
|
||||||
|
import json
|
||||||
|
|
||||||
from app.decorators import require_admin
|
from app.decorators import require_admin
|
||||||
from app import db
|
from app import db
|
||||||
@@ -24,6 +27,12 @@ from app.services.schedule.srm_service import _fetch_records
|
|||||||
schedule_admin_bp = Blueprint('schedule_admin', __name__)
|
schedule_admin_bp = Blueprint('schedule_admin', __name__)
|
||||||
|
|
||||||
|
|
||||||
|
def _serialize_task_for_export(task: ScheduleTask, cfg_model: ScheduleTaskConfig | None) -> dict:
|
||||||
|
payload = serialize_task(task)
|
||||||
|
payload['config'] = _serialize_task_config(cfg_model) if cfg_model else None
|
||||||
|
return payload
|
||||||
|
|
||||||
|
|
||||||
def _serialize_task_config(cfg_model: ScheduleTaskConfig) -> dict:
|
def _serialize_task_config(cfg_model: ScheduleTaskConfig) -> dict:
|
||||||
return {
|
return {
|
||||||
"row_id_key": cfg_model.row_id_key or "id",
|
"row_id_key": cfg_model.row_id_key or "id",
|
||||||
@@ -372,6 +381,108 @@ def get_schedules():
|
|||||||
return jsonify(list_tasks())
|
return jsonify(list_tasks())
|
||||||
|
|
||||||
|
|
||||||
|
@schedule_admin_bp.route('/schedules/<int:task_id>/export', methods=['GET'])
|
||||||
|
@require_admin
|
||||||
|
def export_schedule(task_id: int):
|
||||||
|
task = db.session.get(ScheduleTask, task_id)
|
||||||
|
if not task:
|
||||||
|
return jsonify({'error': 'Not found'}), 404
|
||||||
|
cfg_model = ScheduleTaskConfig.query.filter_by(schedule_task_id=task_id).first()
|
||||||
|
payload = {
|
||||||
|
"schema_version": 1,
|
||||||
|
"exported_at": datetime.utcnow().isoformat(),
|
||||||
|
"schedules": [_serialize_task_for_export(task, cfg_model)],
|
||||||
|
}
|
||||||
|
body = json.dumps(payload, ensure_ascii=False, indent=2)
|
||||||
|
filename = f"{(task.schedule_no or f'schedule_{task.id}')}_export_{datetime.utcnow().strftime('%Y%m%d_%H%M%S')}.json"
|
||||||
|
return Response(
|
||||||
|
body,
|
||||||
|
mimetype='application/json; charset=utf-8',
|
||||||
|
headers={'Content-Disposition': f'attachment; filename="{filename}"'},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@schedule_admin_bp.route('/schedules/import', methods=['POST'])
|
||||||
|
@require_admin
|
||||||
|
def import_schedules():
|
||||||
|
data = request.get_json(silent=True) or {}
|
||||||
|
schedules = data.get('schedules')
|
||||||
|
if not isinstance(schedules, list):
|
||||||
|
return jsonify({'error': 'Invalid import file: schedules missing'}), 400
|
||||||
|
|
||||||
|
user = get_current_user()
|
||||||
|
imported = 0
|
||||||
|
skipped = 0
|
||||||
|
errors: list[str] = []
|
||||||
|
|
||||||
|
for item in schedules:
|
||||||
|
if not isinstance(item, dict):
|
||||||
|
skipped += 1
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
name = str(item.get('name') or '').strip()
|
||||||
|
cron_expr = str(item.get('cron_expr') or '').strip()
|
||||||
|
owner_user_id = int(item.get('owner_user_id'))
|
||||||
|
if not name or not cron_expr:
|
||||||
|
raise ValueError('name or cron_expr missing')
|
||||||
|
|
||||||
|
existing = None
|
||||||
|
schedule_no = str(item.get('schedule_no') or '').strip()
|
||||||
|
if schedule_no:
|
||||||
|
existing = db.session.query(ScheduleTask).filter_by(schedule_no=schedule_no).first()
|
||||||
|
|
||||||
|
task_payload = {
|
||||||
|
'name': name,
|
||||||
|
'schedule_type': str(item.get('schedule_type') or 'platform_app'),
|
||||||
|
'owner_user_id': owner_user_id,
|
||||||
|
'cron_expr': cron_expr,
|
||||||
|
'wait_seconds': int(item.get('wait_seconds') or 0),
|
||||||
|
'dify_agent_id': item.get('dify_agent_id'),
|
||||||
|
'platform_api_path': item.get('platform_api_path'),
|
||||||
|
'notify_user_ids_json': item.get('notify_user_ids_json') if isinstance(item.get('notify_user_ids_json'), list) else [],
|
||||||
|
'notify_enabled': bool(item.get('notify_enabled', True)),
|
||||||
|
'enabled': bool(item.get('enabled', True)),
|
||||||
|
'data_source_type': str(item.get('data_source_type') or 'database'),
|
||||||
|
}
|
||||||
|
cfg = item.get('config') if isinstance(item.get('config'), dict) else None
|
||||||
|
|
||||||
|
if existing:
|
||||||
|
update_task(existing, payload=task_payload, actor_id=getattr(user, 'id', None))
|
||||||
|
existing.data_source_type = task_payload['data_source_type']
|
||||||
|
if cfg:
|
||||||
|
upsert_schedule_task_config(existing.id, cfg)
|
||||||
|
else:
|
||||||
|
task = create_task(
|
||||||
|
name=name,
|
||||||
|
schedule_type=task_payload['schedule_type'],
|
||||||
|
owner_user_id=owner_user_id,
|
||||||
|
cron_expr=cron_expr,
|
||||||
|
wait_seconds=task_payload['wait_seconds'],
|
||||||
|
dify_agent_id=task_payload['dify_agent_id'],
|
||||||
|
platform_api_path=task_payload['platform_api_path'],
|
||||||
|
notify_user_ids_json=task_payload['notify_user_ids_json'],
|
||||||
|
notify_enabled=task_payload['notify_enabled'],
|
||||||
|
enabled=task_payload['enabled'],
|
||||||
|
actor_id=getattr(user, 'id', None),
|
||||||
|
)
|
||||||
|
task.data_source_type = task_payload['data_source_type']
|
||||||
|
db.session.commit()
|
||||||
|
if cfg:
|
||||||
|
upsert_schedule_task_config(task.id, cfg)
|
||||||
|
imported += 1
|
||||||
|
except Exception as exc:
|
||||||
|
errors.append(str(exc))
|
||||||
|
skipped += 1
|
||||||
|
|
||||||
|
db.session.commit()
|
||||||
|
return jsonify({
|
||||||
|
'ok': True,
|
||||||
|
'imported': imported,
|
||||||
|
'skipped': skipped,
|
||||||
|
'errors': errors[:20],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
@schedule_admin_bp.route('/schedules', methods=['POST'])
|
@schedule_admin_bp.route('/schedules', methods=['POST'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def post_schedule():
|
def post_schedule():
|
||||||
|
|||||||
@@ -1887,7 +1887,7 @@ def home():
|
|||||||
# Get all agents available to user (including public ones)
|
# Get all agents available to user (including public ones)
|
||||||
if user.role == 'admin':
|
if user.role == 'admin':
|
||||||
agent_rows = (
|
agent_rows = (
|
||||||
db.session.query(Agent.id, Agent.name, Agent.description, Agent.icon_url)
|
db.session.query(Agent.id, Agent.name, Agent.description, Agent.icon_url, Agent.extra_config)
|
||||||
.filter(Agent.is_active.is_(True))
|
.filter(Agent.is_active.is_(True))
|
||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
@@ -1898,6 +1898,7 @@ def home():
|
|||||||
'name': agent.name,
|
'name': agent.name,
|
||||||
'description': agent.description,
|
'description': agent.description,
|
||||||
'icon_url': agent.icon_url,
|
'icon_url': agent.icon_url,
|
||||||
|
'extra_config': agent.extra_config,
|
||||||
} for agent in user.agents]
|
} for agent in user.agents]
|
||||||
|
|
||||||
favorites = db.session.query(UserFavoriteAgent).filter_by(user_id=user.id).all()
|
favorites = db.session.query(UserFavoriteAgent).filter_by(user_id=user.id).all()
|
||||||
@@ -1934,7 +1935,12 @@ def home():
|
|||||||
'id': a.id if hasattr(a, 'id') else a['id'],
|
'id': a.id if hasattr(a, 'id') else a['id'],
|
||||||
'name': a.name if hasattr(a, 'name') else a['name'],
|
'name': a.name if hasattr(a, 'name') else a['name'],
|
||||||
'description': a.description if hasattr(a, 'description') else a['description'],
|
'description': a.description if hasattr(a, 'description') else a['description'],
|
||||||
'icon_url': a.icon_url if hasattr(a, 'icon_url') else a['icon_url']
|
'icon_url': a.icon_url if hasattr(a, 'icon_url') else a['icon_url'],
|
||||||
|
'dify_app_type': (
|
||||||
|
(a.extra_config or {}).get('dify_app_type')
|
||||||
|
if hasattr(a, 'extra_config')
|
||||||
|
else (a.get('extra_config') or {}).get('dify_app_type')
|
||||||
|
) or 'chatflow'
|
||||||
} for a in agent_rows],
|
} for a in agent_rows],
|
||||||
'favorite_agent_ids': favorite_ids,
|
'favorite_agent_ids': favorite_ids,
|
||||||
'quick_questions': [{
|
'quick_questions': [{
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ def serialize_task(task: ScheduleTask, *, last_status: str | None = None) -> dic
|
|||||||
'wait_seconds': task.wait_seconds,
|
'wait_seconds': task.wait_seconds,
|
||||||
'dify_agent_id': task.dify_agent_id,
|
'dify_agent_id': task.dify_agent_id,
|
||||||
'platform_api_path': task.platform_api_path,
|
'platform_api_path': task.platform_api_path,
|
||||||
|
'data_source_type': task.data_source_type,
|
||||||
'notify_user_ids_json': task.notify_user_ids_json or [],
|
'notify_user_ids_json': task.notify_user_ids_json or [],
|
||||||
'notify_enabled': bool(task.notify_enabled),
|
'notify_enabled': bool(task.notify_enabled),
|
||||||
'enabled': bool(task.enabled),
|
'enabled': bool(task.enabled),
|
||||||
|
|||||||
@@ -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 构建步骤后,请同步更新本文档。
|
||||||
+21
-2
@@ -48,6 +48,7 @@
|
|||||||
4. 提交信息建议规范化:`feat:`、`fix:`、`refactor:`、`docs:`、`chore:`
|
4. 提交信息建议规范化:`feat:`、`fix:`、`refactor:`、`docs:`、`chore:`
|
||||||
5. 合并前必须完成最少检查:
|
5. 合并前必须完成最少检查:
|
||||||
- 能启动前后端
|
- 能启动前后端
|
||||||
|
- 改动了 `frontend/` 时本地 `cd frontend && npm run build` 通过(或已安装 Git Hooks,由 pre-push 自动检查)
|
||||||
- 关键页面可访问
|
- 关键页面可访问
|
||||||
- 登录流程可用
|
- 登录流程可用
|
||||||
6. 任何涉及数据库结构变更的提交,必须包含迁移脚本或升级说明
|
6. 任何涉及数据库结构变更的提交,必须包含迁移脚本或升级说明
|
||||||
@@ -62,7 +63,25 @@ git clone https://gitee.com/justop/hxops.git
|
|||||||
cd hxops
|
cd hxops
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4.2 常用 Git 操作示例
|
### 4.2 安装 Git Hooks(推荐,每人 clone 后执行一次)
|
||||||
|
|
||||||
|
完整说明见 **[Git Hooks 团队启用指南](./GIT_HOOKS.md)**(策略、安装步骤、验证、跳过方式、常见问题)。
|
||||||
|
|
||||||
|
快速安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Git Bash / WSL
|
||||||
|
./scripts/install_git_hooks.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# PowerShell
|
||||||
|
git config core.hooksPath .githooks
|
||||||
|
```
|
||||||
|
|
||||||
|
验证:`git config --get core.hooksPath` → `.githooks`;前置:`cd frontend && npm install`。
|
||||||
|
|
||||||
|
### 4.3 常用 Git 操作示例
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 拉取远程分支
|
# 拉取远程分支
|
||||||
@@ -81,7 +100,7 @@ git commit -m "feat: your change summary"
|
|||||||
git push origin feature/your-feature-name
|
git push origin feature/your-feature-name
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4.3 关键目录
|
### 4.4 关键目录
|
||||||
|
|
||||||
- `frontend/`:Vue 3 + TypeScript + Vite
|
- `frontend/`:Vue 3 + TypeScript + Vite
|
||||||
- `backend/`:Flask + SQLAlchemy + Flask-Migrate
|
- `backend/`:Flask + SQLAlchemy + Flask-Migrate
|
||||||
|
|||||||
Vendored
-19
@@ -1,19 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
||||||
<meta name="theme-color" content="#0284c7" />
|
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
|
||||||
<meta name="apple-mobile-web-app-title" content="AI工作台" />
|
|
||||||
<link rel="manifest" href="/manifest.webmanifest" />
|
|
||||||
<title>AI工作台</title>
|
|
||||||
<script type="module" crossorigin src="/assets/index-CRyzfl76.js"></script>
|
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-BKu7TAYA.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>␍
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -68,6 +68,21 @@ async function getJson<T>(url: string): Promise<T> {
|
|||||||
export const listAdminSchedules = () =>
|
export const listAdminSchedules = () =>
|
||||||
getJson<ScheduleTask[]>('/api/admin/schedules');
|
getJson<ScheduleTask[]>('/api/admin/schedules');
|
||||||
|
|
||||||
|
export const exportAdminScheduleUrl = (taskId: number) => `/api/admin/schedules/${taskId}/export`;
|
||||||
|
|
||||||
|
export const importAdminSchedules = async (payload: any) => {
|
||||||
|
const res = await fetch('/api/admin/schedules/import', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
});
|
||||||
|
if (!res.ok) {
|
||||||
|
const data = await res.json().catch(() => ({}));
|
||||||
|
throw new Error(data.error || 'Import failed');
|
||||||
|
}
|
||||||
|
return res.json();
|
||||||
|
};
|
||||||
|
|
||||||
export const getAdminScheduleTaskConfig = (taskId: number) =>
|
export const getAdminScheduleTaskConfig = (taskId: number) =>
|
||||||
getJson<{ data_source_type: string; config: Record<string, any> | null }>(`/api/admin/schedule-config/${taskId}`);
|
getJson<{ data_source_type: string; config: Record<string, any> | null }>(`/api/admin/schedule-config/${taskId}`);
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -54,6 +54,7 @@ export const config = {
|
|||||||
users: true, // 用户管理
|
users: true, // 用户管理
|
||||||
departments: true, // 部门管理
|
departments: true, // 部门管理
|
||||||
agents: true, // 应用管理
|
agents: true, // 应用管理
|
||||||
|
knowledge_base: true, // 知识库管理
|
||||||
announcements: true, // 公告管理
|
announcements: true, // 公告管理
|
||||||
questions: true, // 常用问题
|
questions: true, // 常用问题
|
||||||
wecom: true, // 企业微信
|
wecom: true, // 企业微信
|
||||||
|
|||||||
+513
-14
@@ -112,9 +112,9 @@ const messages = {
|
|||||||
},
|
},
|
||||||
landing: {
|
landing: {
|
||||||
hero: {
|
hero: {
|
||||||
prefix: 'Unleash the Power of',
|
prefix: 'Hexin Precision',
|
||||||
highlight: 'Generative AI',
|
highlight: 'AI Agent Application Platform',
|
||||||
subtitle: 'Access a suite of powerful AI agents tailored for your enterprise needs. Secure, scalable, and intelligent.'
|
subtitle: 'In the world of AI, we hope you enjoy your work and live happily.'
|
||||||
},
|
},
|
||||||
agent: {
|
agent: {
|
||||||
role: 'AI Assistant'
|
role: 'AI Assistant'
|
||||||
@@ -245,6 +245,7 @@ const messages = {
|
|||||||
users: 'User Maintenance',
|
users: 'User Maintenance',
|
||||||
departments: 'Departments',
|
departments: 'Departments',
|
||||||
agents: 'Agent Management',
|
agents: 'Agent Management',
|
||||||
|
knowledgeBase: 'Knowledge Base',
|
||||||
announcements: 'Announcements',
|
announcements: 'Announcements',
|
||||||
questions: 'Common Questions',
|
questions: 'Common Questions',
|
||||||
wecom: 'WeCom',
|
wecom: 'WeCom',
|
||||||
@@ -844,6 +845,57 @@ const messages = {
|
|||||||
loadingAgent: 'Loading agent...',
|
loadingAgent: 'Loading agent...',
|
||||||
thinking: 'Generating response...',
|
thinking: 'Generating response...',
|
||||||
disclaimer: 'AI can make mistakes. Please verify important information.',
|
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: {
|
suggestions: {
|
||||||
whatCanYouDo: 'What can you do?',
|
whatCanYouDo: 'What can you do?',
|
||||||
helpWriteReport: 'Help me write a report',
|
helpWriteReport: 'Help me write a report',
|
||||||
@@ -858,8 +910,81 @@ const messages = {
|
|||||||
selectRating: 'Please select a rating first',
|
selectRating: 'Please select a rating first',
|
||||||
commentPlaceholder: 'Add a comment (optional)...',
|
commentPlaceholder: 'Add a comment (optional)...',
|
||||||
sent: 'Sent'
|
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: {
|
profile: {
|
||||||
title: 'Profile',
|
title: 'Profile',
|
||||||
personalInfo: 'Personal Information',
|
personalInfo: 'Personal Information',
|
||||||
@@ -1133,6 +1258,7 @@ const messages = {
|
|||||||
users: '用户管理',
|
users: '用户管理',
|
||||||
departments: '部门管理',
|
departments: '部门管理',
|
||||||
agents: '应用管理',
|
agents: '应用管理',
|
||||||
|
knowledgeBase: '知识库管理',
|
||||||
announcements: '公告管理',
|
announcements: '公告管理',
|
||||||
questions: '常用问题',
|
questions: '常用问题',
|
||||||
wecom: '企业微信',
|
wecom: '企业微信',
|
||||||
@@ -1711,6 +1837,57 @@ const messages = {
|
|||||||
loadingAgent: '正在加载应用...',
|
loadingAgent: '正在加载应用...',
|
||||||
thinking: '正在生成回答...',
|
thinking: '正在生成回答...',
|
||||||
disclaimer: 'AI 可能会犯错,请核实重要信息。',
|
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: {
|
suggestions: {
|
||||||
whatCanYouDo: '你能做什么?',
|
whatCanYouDo: '你能做什么?',
|
||||||
helpWriteReport: '帮我写一份报告',
|
helpWriteReport: '帮我写一份报告',
|
||||||
@@ -1725,7 +1902,80 @@ const messages = {
|
|||||||
selectRating: '请先选择评分',
|
selectRating: '请先选择评分',
|
||||||
commentPlaceholder: '添加评论(可选)...',
|
commentPlaceholder: '添加评论(可选)...',
|
||||||
sent: '已发送'
|
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: {
|
profile: {
|
||||||
title: '个人资料',
|
title: '个人资料',
|
||||||
@@ -1856,9 +2106,9 @@ const messages = {
|
|||||||
},
|
},
|
||||||
landing: {
|
landing: {
|
||||||
hero: {
|
hero: {
|
||||||
prefix: '釋放',
|
prefix: '和信精密',
|
||||||
highlight: '生成式 AI 的力量',
|
highlight: 'AI 智能體 應用平台',
|
||||||
subtitle: '訪問為您企業量身定制的強大 AI 助手套件。安全、可擴展、智能。'
|
subtitle: 'AI 的世界,期望讓你開心工作,快樂生活。'
|
||||||
},
|
},
|
||||||
agent: {
|
agent: {
|
||||||
role: 'AI 助手'
|
role: 'AI 助手'
|
||||||
@@ -1984,6 +2234,7 @@ const messages = {
|
|||||||
users: '用戶管理',
|
users: '用戶管理',
|
||||||
departments: '部門管理',
|
departments: '部門管理',
|
||||||
agents: '應用管理',
|
agents: '應用管理',
|
||||||
|
knowledgeBase: '知識庫管理',
|
||||||
announcements: '公告管理',
|
announcements: '公告管理',
|
||||||
questions: '常用問題',
|
questions: '常用問題',
|
||||||
wecom: '企業微信',
|
wecom: '企業微信',
|
||||||
@@ -2567,6 +2818,57 @@ const messages = {
|
|||||||
loadingAgent: '正在加載應用...',
|
loadingAgent: '正在加載應用...',
|
||||||
thinking: '正在生成回答...',
|
thinking: '正在生成回答...',
|
||||||
disclaimer: 'AI 可能會犯錯,請核實重要信息。',
|
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: {
|
suggestions: {
|
||||||
whatCanYouDo: '你能做什麼?',
|
whatCanYouDo: '你能做什麼?',
|
||||||
helpWriteReport: '幫我寫一份報告',
|
helpWriteReport: '幫我寫一份報告',
|
||||||
@@ -2581,7 +2883,80 @@ const messages = {
|
|||||||
selectRating: '請先選擇評分',
|
selectRating: '請先選擇評分',
|
||||||
commentPlaceholder: '添加評論(可選)...',
|
commentPlaceholder: '添加評論(可選)...',
|
||||||
sent: '已發送'
|
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: {
|
profile: {
|
||||||
title: '個人資料',
|
title: '個人資料',
|
||||||
@@ -2712,9 +3087,9 @@ const messages = {
|
|||||||
},
|
},
|
||||||
landing: {
|
landing: {
|
||||||
hero: {
|
hero: {
|
||||||
prefix: 'ปลดปล่อยพลังของ',
|
prefix: '和信精密',
|
||||||
highlight: 'Generative AI',
|
highlight: 'แพลตฟอร์มแอปพลิเคชัน AI Agent',
|
||||||
subtitle: 'เข้าถึงชุดผู้ช่วย AI ที่ทรงพลังซึ่งปรับแต่งมาเพื่อความต้องการขององค์กรของคุณ ปลอดภัย ปรับขนาดได้ และชาญฉลาด'
|
subtitle: 'ในโลกของ AI เราหวังว่าคุณจะทำงานอย่างมีความสุข และใช้ชีวิตอย่างสนุกสนาน'
|
||||||
},
|
},
|
||||||
agent: {
|
agent: {
|
||||||
role: 'ผู้ช่วย AI'
|
role: 'ผู้ช่วย AI'
|
||||||
@@ -2840,6 +3215,7 @@ const messages = {
|
|||||||
users: 'การจัดการผู้ใช้',
|
users: 'การจัดการผู้ใช้',
|
||||||
departments: 'การจัดการแผนก',
|
departments: 'การจัดการแผนก',
|
||||||
agents: 'การจัดการตัวแทน',
|
agents: 'การจัดการตัวแทน',
|
||||||
|
knowledgeBase: 'การจัดการคลังความรู้',
|
||||||
announcements: 'การจัดการประกาศ',
|
announcements: 'การจัดการประกาศ',
|
||||||
questions: 'คำถามทั่วไป',
|
questions: 'คำถามทั่วไป',
|
||||||
wecom: 'WeCom',
|
wecom: 'WeCom',
|
||||||
@@ -3423,6 +3799,57 @@ const messages = {
|
|||||||
loadingAgent: 'กำลังโหลดตัวแทน...',
|
loadingAgent: 'กำลังโหลดตัวแทน...',
|
||||||
thinking: 'กำลังสร้างคำตอบ...',
|
thinking: 'กำลังสร้างคำตอบ...',
|
||||||
disclaimer: 'AI อาจทำผิดพลาดได้ โปรดตรวจสอบข้อมูลสำคัญ',
|
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: {
|
suggestions: {
|
||||||
whatCanYouDo: 'คุณทำอะไรได้บ้าง?',
|
whatCanYouDo: 'คุณทำอะไรได้บ้าง?',
|
||||||
helpWriteReport: 'ช่วยฉันเขียนรายงาน',
|
helpWriteReport: 'ช่วยฉันเขียนรายงาน',
|
||||||
@@ -3437,7 +3864,80 @@ const messages = {
|
|||||||
selectRating: 'กรุณาเลือกคะแนนก่อน',
|
selectRating: 'กรุณาเลือกคะแนนก่อน',
|
||||||
commentPlaceholder: 'เพิ่มความคิดเห็น (ไม่บังคับ)...',
|
commentPlaceholder: 'เพิ่มความคิดเห็น (ไม่บังคับ)...',
|
||||||
sent: 'ส่งแล้ว'
|
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: {
|
profile: {
|
||||||
title: 'โปรไฟล์',
|
title: 'โปรไฟล์',
|
||||||
@@ -3479,4 +3979,3 @@ const i18n = createI18n({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
|
||||||
@@ -6,7 +6,6 @@ import ChatView from '../views/ChatView.vue';
|
|||||||
import AdminView from '../views/AdminView.vue';
|
import AdminView from '../views/AdminView.vue';
|
||||||
import ResetPasswordView from '../views/ResetPasswordView.vue';
|
import ResetPasswordView from '../views/ResetPasswordView.vue';
|
||||||
import KbWorkspaceView from '../views/KbWorkspaceView.vue';
|
import KbWorkspaceView from '../views/KbWorkspaceView.vue';
|
||||||
import KbAdminView from '../views/KbAdminView.vue';
|
|
||||||
import { config } from '../config';
|
import { config } from '../config';
|
||||||
import { getStoredAuthUser } from '../utils/auth';
|
import { getStoredAuthUser } from '../utils/auth';
|
||||||
|
|
||||||
@@ -50,9 +49,7 @@ const routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/kb/admin',
|
path: '/kb/admin',
|
||||||
name: 'KbAdmin',
|
redirect: { path: '/admin', query: { module: 'knowledge_base' } }
|
||||||
component: KbAdminView,
|
|
||||||
meta: { title: '知识库管理台' }
|
|
||||||
},
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
* - 该页面后续可继续优化按模块懒加载数据
|
* - 该页面后续可继续优化按模块懒加载数据
|
||||||
*/
|
*/
|
||||||
import { ref, onMounted, watch, computed } from 'vue';
|
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 { useI18n } from 'vue-i18n';
|
||||||
import { config } from '../config';
|
import { config } from '../config';
|
||||||
import ThemeToggleButton from '../components/ThemeToggleButton.vue';
|
import ThemeToggleButton from '../components/ThemeToggleButton.vue';
|
||||||
@@ -68,6 +69,7 @@ const sidebarItems = computed(() => {
|
|||||||
{ id: 'users', icon: UserCog, label: t('admin.nav.users') },
|
{ id: 'users', icon: UserCog, label: t('admin.nav.users') },
|
||||||
{ id: 'departments', icon: Building, label: t('admin.nav.departments') },
|
{ id: 'departments', icon: Building, label: t('admin.nav.departments') },
|
||||||
{ id: 'agents', icon: Bot, label: t('admin.nav.agents') },
|
{ 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: 'schedules', icon: Settings2, label: '排程管理' },
|
||||||
{ id: 'announcements', icon: Megaphone, label: t('admin.nav.announcements') },
|
{ id: 'announcements', icon: Megaphone, label: t('admin.nav.announcements') },
|
||||||
{ id: 'questions', icon: MessageCircleQuestion, label: t('admin.nav.questions') },
|
{ id: 'questions', icon: MessageCircleQuestion, label: t('admin.nav.questions') },
|
||||||
@@ -235,9 +237,10 @@ interface WecomIntegrationManifest {
|
|||||||
|
|
||||||
// 获取路由实例,用于页面跳转
|
// 获取路由实例,用于页面跳转
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
// 当前左侧菜单激活的模块:dashboard / agents / permissions
|
// 当前左侧菜单激活的模块: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);
|
const expandedReports = ref(true);
|
||||||
|
|
||||||
// agents:管理员视角下的所有 Agent 列表
|
// agents:管理员视角下的所有 Agent 列表
|
||||||
@@ -2106,6 +2109,15 @@ onMounted(async () => {
|
|||||||
return;
|
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;
|
isLoading.value = true;
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
loadAgents(),
|
loadAgents(),
|
||||||
@@ -3343,13 +3355,6 @@ const handlePermissionImport = async (event: Event) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-4">
|
<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 />
|
<ThemeToggleButton />
|
||||||
<!-- Language Selector -->
|
<!-- Language Selector -->
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
@@ -3776,6 +3781,11 @@ const handlePermissionImport = async (event: Event) => {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</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 -->
|
<!-- 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">
|
<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">
|
<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">
|
||||||
|
|||||||
+156
-145
@@ -23,7 +23,7 @@ import { useGlobalMessageDialog } from '../composables/useGlobalMessageDialog';
|
|||||||
import { useIsMobile } from '../composables/useIsMobile';
|
import { useIsMobile } from '../composables/useIsMobile';
|
||||||
import { getAuthHeaders, getStoredAuthUser, clearAuthUser } from '../utils/auth';
|
import { getAuthHeaders, getStoredAuthUser, clearAuthUser } from '../utils/auth';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const { showMessageDialog } = useGlobalMessageDialog();
|
const { showMessageDialog } = useGlobalMessageDialog();
|
||||||
const { isMobile } = useIsMobile();
|
const { isMobile } = useIsMobile();
|
||||||
const showMobileAgentPopover = ref(false);
|
const showMobileAgentPopover = ref(false);
|
||||||
@@ -91,8 +91,12 @@ const handleLogout = () => {
|
|||||||
router.push('/');
|
router.push('/');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(locale, (newLang) => {
|
||||||
|
localStorage.setItem('hxops_lang', String(newLang));
|
||||||
|
});
|
||||||
|
|
||||||
const handleVoiceFeatureClick = () => {
|
const handleVoiceFeatureClick = () => {
|
||||||
showMessageDialog('info', '该功能正在开发中');
|
showMessageDialog('info', t('chat.devComingSoon'));
|
||||||
};
|
};
|
||||||
|
|
||||||
const stripReasoningPrelude = (text: string) => {
|
const stripReasoningPrelude = (text: string) => {
|
||||||
@@ -563,7 +567,7 @@ const openPreview = async (file: SourceFileLink) => {
|
|||||||
previewFile.value = resolvedFile;
|
previewFile.value = resolvedFile;
|
||||||
filePreviewVisible.value = true;
|
filePreviewVisible.value = true;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
showMessageDialog('warning', error?.message || '当前源文件暂时无法预览');
|
showMessageDialog('warning', error?.message || t('chat.previewUnavailable'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -589,7 +593,7 @@ const copiedIndex = ref<number | null>(null);
|
|||||||
const { messages, isThinking, conversationId, sendMessage } = useChat();
|
const { messages, isThinking, conversationId, sendMessage } = useChat();
|
||||||
const input = ref('');
|
const input = ref('');
|
||||||
const currentAgent = ref<any>(null);
|
const currentAgent = ref<any>(null);
|
||||||
const userAgents = ref<Array<{ id: number; name: string; description: string; icon_url?: string }>>([]);
|
const userAgents = ref<Array<{ id: number; name: string; description: string; icon_url?: string; dify_app_type?: 'chatflow' | 'workflow' }>>([]);
|
||||||
const showGeneralFeedbackDialog = ref(false);
|
const showGeneralFeedbackDialog = ref(false);
|
||||||
const showAgentPanel = ref(true);
|
const showAgentPanel = ref(true);
|
||||||
|
|
||||||
@@ -611,16 +615,16 @@ const openOAAutoLoginPage = (gopage: string, username: string, password: string,
|
|||||||
// 直接在弹出窗口内写入自动提交表单,避免跨窗口时序问题
|
// 直接在弹出窗口内写入自动提交表单,避免跨窗口时序问题
|
||||||
const popup = window.open('about:blank', target);
|
const popup = window.open('about:blank', target);
|
||||||
if (!popup) {
|
if (!popup) {
|
||||||
showMessageDialog('warning', '浏览器拦截了 OA 页面,请允许弹出窗口后重试。');
|
showMessageDialog('warning', t('chat.oaPopupBlocked'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const formHtml = `
|
const formHtml = `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head><meta charset="utf-8"><title>正在登录OA系统...</title></head>
|
<head><meta charset="utf-8"><title>${t('chat.oaLoggingTitle')}</title></head>
|
||||||
<body>
|
<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">
|
<form id="oaLoginForm" action="${OA_VERIFY_LOGIN_URL}" method="POST">
|
||||||
<input type="hidden" name="loginid" value="${username}" />
|
<input type="hidden" name="loginid" value="${username}" />
|
||||||
<input type="hidden" name="userpassword" value="${password.replace(/"/g, '"')}" />
|
<input type="hidden" name="userpassword" value="${password.replace(/"/g, '"')}" />
|
||||||
@@ -640,7 +644,7 @@ const openOAAutoLoginPage = (gopage: string, username: string, password: string,
|
|||||||
const openOALeaveRequestDirectly = () => {
|
const openOALeaveRequestDirectly = () => {
|
||||||
const employeeId = currentUserEmployeeId.value;
|
const employeeId = currentUserEmployeeId.value;
|
||||||
if (!employeeId || employeeId === '-') {
|
if (!employeeId || employeeId === '-') {
|
||||||
showMessageDialog('warning', '没有工号信息无法登录OA系统!');
|
showMessageDialog('warning', t('chat.noEmployeeId'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
oaLoginEmployeeId.value = employeeId;
|
oaLoginEmployeeId.value = employeeId;
|
||||||
@@ -652,7 +656,7 @@ const openOALeaveRequestDirectly = () => {
|
|||||||
|
|
||||||
const confirmOALogin = () => {
|
const confirmOALogin = () => {
|
||||||
if (!oaLoginPassword.value.trim()) {
|
if (!oaLoginPassword.value.trim()) {
|
||||||
showMessageDialog('warning', '请输入OA登录密码!');
|
showMessageDialog('warning', t('chat.oaPasswordRequired'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 记住密码到 localStorage
|
// 记住密码到 localStorage
|
||||||
@@ -668,12 +672,12 @@ const cancelOALogin = () => {
|
|||||||
const openOARequestDirectly = (requestId: string) => {
|
const openOARequestDirectly = (requestId: string) => {
|
||||||
const normalizedRequestId = String(requestId || '').trim();
|
const normalizedRequestId = String(requestId || '').trim();
|
||||||
if (!normalizedRequestId || normalizedRequestId === '-') {
|
if (!normalizedRequestId || normalizedRequestId === '-') {
|
||||||
showMessageDialog('warning', '当前未获取到 OA 单据编号,暂时无法打开单据详情。');
|
showMessageDialog('warning', t('chat.oaRequestMissing'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const employeeId = currentUserEmployeeId.value;
|
const employeeId = currentUserEmployeeId.value;
|
||||||
if (!employeeId || employeeId === '-') {
|
if (!employeeId || employeeId === '-') {
|
||||||
showMessageDialog('warning', '没有工号信息无法登录OA系统!');
|
showMessageDialog('warning', t('chat.noEmployeeId'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
oaLoginEmployeeId.value = employeeId;
|
oaLoginEmployeeId.value = employeeId;
|
||||||
@@ -887,12 +891,12 @@ const calculateDurationHours = (startTime: string, endTime: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formatDurationLabel = (hours: number) => {
|
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) {
|
if (hours >= 8 && Number.isInteger((hours / 8) * 10) && (hours / 8) >= 1) {
|
||||||
const days = Number((hours / 8).toFixed(2));
|
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) => {
|
const extractLeaveTypeFromIntent = (content: string) => {
|
||||||
@@ -999,7 +1003,7 @@ const saveLocalMessageToBackend = async (msg: any, userQuery: string = '') => {
|
|||||||
const NEED_BALANCE_CHECK_TYPES = new Set(['010', '408']);
|
const NEED_BALANCE_CHECK_TYPES = new Set(['010', '408']);
|
||||||
|
|
||||||
const formatLeaveBalanceNumber = (value: any) => {
|
const formatLeaveBalanceNumber = (value: any) => {
|
||||||
if (value === null || value === undefined) return '暂无数据';
|
if (value === null || value === undefined) return t('chat.noData');
|
||||||
const num = Number(value);
|
const num = Number(value);
|
||||||
if (Number.isNaN(num)) return String(value);
|
if (Number.isNaN(num)) return String(value);
|
||||||
return Number.isInteger(num) ? String(num) : num.toFixed(2);
|
return Number.isInteger(num) ? String(num) : num.toFixed(2);
|
||||||
@@ -1034,7 +1038,7 @@ const startLocalLeaveFlow = async (content: string) => {
|
|||||||
const thinkingMsg = {
|
const thinkingMsg = {
|
||||||
role: 'assistant' as const,
|
role: 'assistant' as const,
|
||||||
type: 'text' as const,
|
type: 'text' as const,
|
||||||
content: '正在查询您的假期余额,请稍候...',
|
content: t('chat.queryLeaveBalance'),
|
||||||
};
|
};
|
||||||
messages.value.push(thinkingMsg);
|
messages.value.push(thinkingMsg);
|
||||||
|
|
||||||
@@ -1046,15 +1050,15 @@ const startLocalLeaveFlow = async (content: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (balance && !balance.has_balance) {
|
if (balance && !balance.has_balance) {
|
||||||
const unit = initialLeaveType === '010' ? '天' : '小时';
|
const unit = initialLeaveType === '010' ? t('chat.dayUnit') : t('chat.hourUnit');
|
||||||
const detailLines = [
|
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} |`,
|
`| ${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 = {
|
const noBalanceMsg = {
|
||||||
role: 'assistant' as const,
|
role: 'assistant' as const,
|
||||||
@@ -1085,7 +1089,7 @@ const startLocalLeaveFlow = async (content: string) => {
|
|||||||
const formMsg = {
|
const formMsg = {
|
||||||
role: 'assistant' as const,
|
role: 'assistant' as const,
|
||||||
type: 'leave-form' as const,
|
type: 'leave-form' as const,
|
||||||
content: '已为你生成请假申请表,请直接在下方填写并提交。或登录OA系统直接申请',
|
content: t('chat.leaveFormIntro'),
|
||||||
payload,
|
payload,
|
||||||
local_id: formId,
|
local_id: formId,
|
||||||
local_only: true,
|
local_only: true,
|
||||||
@@ -1304,7 +1308,7 @@ const toggleBrowserPanel = () => {
|
|||||||
const loadBrowserPage = () => {
|
const loadBrowserPage = () => {
|
||||||
const normalized = normalizeBrowserInput(browserDraftUrl.value);
|
const normalized = normalizeBrowserInput(browserDraftUrl.value);
|
||||||
if (!normalized) {
|
if (!normalized) {
|
||||||
showMessageDialog('warning', '请输入有效的网址,例如 `https://example.com` 或 `localhost:8891`。');
|
showMessageDialog('warning', t('chat.invalidBrowserUrl'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
browserCurrentUrl.value = normalized;
|
browserCurrentUrl.value = normalized;
|
||||||
@@ -1324,7 +1328,7 @@ const refreshBrowserPage = () => {
|
|||||||
const openBrowserInNewTab = () => {
|
const openBrowserInNewTab = () => {
|
||||||
const normalized = browserCurrentUrl.value || normalizeBrowserInput(browserDraftUrl.value);
|
const normalized = browserCurrentUrl.value || normalizeBrowserInput(browserDraftUrl.value);
|
||||||
if (!normalized) {
|
if (!normalized) {
|
||||||
showMessageDialog('warning', '请先输入可打开的网址。');
|
showMessageDialog('warning', t('chat.enterBrowserUrl'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.open(normalized, '_blank', 'noopener,noreferrer');
|
window.open(normalized, '_blank', 'noopener,noreferrer');
|
||||||
@@ -1435,13 +1439,13 @@ const handleSend = async (textOrEvent?: string | Event) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const validateLeaveForm = (form: LeaveRequestFormData) => {
|
const validateLeaveForm = (form: LeaveRequestFormData) => {
|
||||||
if (!form.applicantName.trim()) return '请假人不能为空。';
|
if (!form.applicantName.trim()) return t('chat.leaveApplicantRequired');
|
||||||
if (!form.employeeId.trim()) return '工号不能为空。';
|
if (!form.employeeId.trim()) return t('chat.employeeIdRequired');
|
||||||
if (!form.leaveType.trim()) return '请选择假别。';
|
if (!form.leaveType.trim()) return t('chat.leaveTypeRequired');
|
||||||
if (!form.agentUid.trim()) return '请选择代理人。';
|
if (!form.agentUid.trim()) return t('chat.leaveAgentRequired');
|
||||||
if (!parseDateTime(form.startTime)) return '请选择正确的开始时间。';
|
if (!parseDateTime(form.startTime)) return t('chat.startTimeRequired');
|
||||||
if (!parseDateTime(form.endTime)) return '请选择正确的结束时间。';
|
if (!parseDateTime(form.endTime)) return t('chat.endTimeRequired');
|
||||||
if (calculateDurationHours(form.startTime, form.endTime) <= 0) return '时长必须大于0小时,请检查开始时间和结束时间。';
|
if (calculateDurationHours(form.startTime, form.endTime) <= 0) return t('chat.durationInvalid');
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1465,7 +1469,7 @@ const submitLeaveForm = (msg: any) => {
|
|||||||
const confirmMsg = {
|
const confirmMsg = {
|
||||||
role: 'assistant' as const,
|
role: 'assistant' as const,
|
||||||
type: 'leave-confirmation' as const,
|
type: 'leave-confirmation' as const,
|
||||||
content: '请确认以下请假信息,确认无误后再提交到 OA。',
|
content: t('chat.leaveConfirmPrompt'),
|
||||||
payload: {
|
payload: {
|
||||||
formId: payload.formId,
|
formId: payload.formId,
|
||||||
form: summary,
|
form: summary,
|
||||||
@@ -1525,13 +1529,13 @@ const confirmLeaveSubmission = async (msg: any) => {
|
|||||||
});
|
});
|
||||||
const data = await res.json().catch(() => ({}));
|
const data = await res.json().catch(() => ({}));
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(data?.error || 'OA 请假提交失败,请稍后重试。');
|
throw new Error(data?.error || t('chat.oaLeaveSubmitFailed'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultMsg = {
|
const resultMsg = {
|
||||||
role: 'assistant' as const,
|
role: 'assistant' as const,
|
||||||
type: 'leave-result' as const,
|
type: 'leave-result' as const,
|
||||||
content: '请假单已推送到 OA,具体单据请 【 登录OA系统查看提交】',
|
content: t('chat.leaveResultSubmitted'),
|
||||||
payload: {
|
payload: {
|
||||||
formId: payload.formId,
|
formId: payload.formId,
|
||||||
success: true,
|
success: true,
|
||||||
@@ -1548,12 +1552,12 @@ const confirmLeaveSubmission = async (msg: any) => {
|
|||||||
saveLocalMessageToBackend(msg);
|
saveLocalMessageToBackend(msg);
|
||||||
saveLocalMessageToBackend(resultMsg);
|
saveLocalMessageToBackend(resultMsg);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
const errorMessage = error?.message || 'OA 请假提交失败,请稍后重试。';
|
const errorMessage = error?.message || t('chat.oaLeaveSubmitFailed');
|
||||||
showMessageDialog('error', errorMessage);
|
showMessageDialog('error', errorMessage);
|
||||||
const resultMsg = {
|
const resultMsg = {
|
||||||
role: 'assistant' as const,
|
role: 'assistant' as const,
|
||||||
type: 'leave-result' as const,
|
type: 'leave-result' as const,
|
||||||
content: `请假单提交失败:${errorMessage}`,
|
content: t('chat.leaveSubmitFailedPrefix', { error: errorMessage }),
|
||||||
payload: {
|
payload: {
|
||||||
formId: payload.formId,
|
formId: payload.formId,
|
||||||
success: false,
|
success: false,
|
||||||
@@ -1609,7 +1613,7 @@ const loadHistory = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const clearAllHistory = async () => {
|
const clearAllHistory = async () => {
|
||||||
if (!confirm('确定要清除全部聊天历史记录吗?此操作不可恢复。')) return;
|
if (!confirm(t('chat.confirmClearHistory'))) return;
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`/api/chat/sessions?agent_id=${agentId}`, {
|
const res = await fetch(`/api/chat/sessions?agent_id=${agentId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
@@ -1628,7 +1632,7 @@ const clearAllHistory = async () => {
|
|||||||
|
|
||||||
const deleteHistoryItem = async (id: string, event: Event) => {
|
const deleteHistoryItem = async (id: string, event: Event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (!confirm('确定要删除这条聊天记录吗?')) return;
|
if (!confirm(t('chat.confirmDeleteHistoryItem'))) return;
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`/api/chat/sessions/${id}?agent_id=${agentId}`, {
|
const res = await fetch(`/api/chat/sessions/${id}?agent_id=${agentId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
@@ -1689,7 +1693,9 @@ const loadUserAgents = async () => {
|
|||||||
const res = await fetch('/api/agents', { headers: getAuthHeaders() });
|
const res = await fetch('/api/agents', { headers: getAuthHeaders() });
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const agents = await res.json();
|
const agents = await res.json();
|
||||||
userAgents.value = Array.isArray(agents) ? agents.filter((a: any) => a.id !== agentId) : [];
|
userAgents.value = Array.isArray(agents)
|
||||||
|
? agents.filter((a: any) => a.id !== agentId && (a.dify_app_type || 'chatflow') === 'chatflow')
|
||||||
|
: [];
|
||||||
if (userAgents.value.length === 0) {
|
if (userAgents.value.length === 0) {
|
||||||
showAgentPanel.value = false;
|
showAgentPanel.value = false;
|
||||||
}
|
}
|
||||||
@@ -1799,7 +1805,7 @@ const showChatRating = ref(false);
|
|||||||
<Sparkles class="h-5 w-5" />
|
<Sparkles class="h-5 w-5" />
|
||||||
</div>
|
</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" />
|
<Plus class="h-5 w-5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -1808,7 +1814,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">
|
<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() }}
|
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
||||||
</div>
|
</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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
@@ -1827,14 +1833,14 @@ const showChatRating = ref(false);
|
|||||||
|
|
||||||
<div class="px-4 pb-4">
|
<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">
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center justify-between px-4 py-2">
|
<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">
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1859,7 +1865,7 @@ const showChatRating = ref(false);
|
|||||||
<button
|
<button
|
||||||
@click="deleteHistoryItem(item.conversation_id, $event)"
|
@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"
|
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" />
|
<X class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
@@ -1870,18 +1876,18 @@ const showChatRating = ref(false);
|
|||||||
<div class="mt-auto flex flex-col p-4">
|
<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 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">
|
<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>
|
||||||
<div class="grid grid-cols-2 gap-1.5">
|
<div class="grid grid-cols-2 gap-x-2 gap-y-1.5">
|
||||||
<button
|
<button
|
||||||
v-for="agent in userAgents"
|
v-for="agent in userAgents"
|
||||||
:key="agent.id"
|
:key="agent.id"
|
||||||
@click="switchToAgent(agent)"
|
@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-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>
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1900,22 +1906,32 @@ const showChatRating = ref(false);
|
|||||||
</div>
|
</div>
|
||||||
<div class="overflow-hidden">
|
<div class="overflow-hidden">
|
||||||
<div class="text-sm font-bold text-slate-900 dark:text-slate-100 truncate">{{ currentUser?.username || 'User' }}</div>
|
<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 v-else class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ currentUser?.role }}</div>
|
||||||
</div>
|
</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">{{ $t('chat.langZhCn') }}</option>
|
||||||
|
<option value="en">{{ $t('chat.langEn') }}</option>
|
||||||
|
<option value="zh-TW">{{ $t('chat.langZhTw') }}</option>
|
||||||
|
<option value="th">{{ $t('chat.langTh') }}</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">
|
<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" />
|
<LogOut class="w-4 h-4" />
|
||||||
退出登录
|
{{ $t('chat.logout') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex gap-3">
|
<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 @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"><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 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="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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
@@ -1931,15 +1947,15 @@ const showChatRating = ref(false);
|
|||||||
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ currentAgent?.name || 'AI' }}</span>
|
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ currentAgent?.name || 'AI' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1">
|
<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" />
|
<LayoutGrid class="h-5 w-5" />
|
||||||
</button>
|
</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" />
|
<History class="h-5 w-5" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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 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">
|
<div class="grid grid-cols-2 gap-2">
|
||||||
<button
|
<button
|
||||||
v-for="agent in userAgents"
|
v-for="agent in userAgents"
|
||||||
@@ -1953,7 +1969,7 @@ const showChatRating = ref(false);
|
|||||||
<span class="w-full truncate text-xs font-medium text-slate-700 dark:text-slate-200">{{ agent.name }}</span>
|
<span class="w-full truncate text-xs font-medium text-slate-700 dark:text-slate-200">{{ agent.name }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@@ -1985,7 +2001,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">
|
<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
|
AI
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
||||||
<template v-for="(msg, index) in messages" :key="index">
|
<template v-for="(msg, index) in messages" :key="index">
|
||||||
@@ -2012,16 +2028,11 @@ const showChatRating = ref(false);
|
|||||||
<div v-else>
|
<div v-else>
|
||||||
<div v-if="msg.type === 'leave-form'" class="space-y-4">
|
<div v-if="msg.type === 'leave-form'" class="space-y-4">
|
||||||
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">
|
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">
|
||||||
<template v-if="msg.content.includes('或登录OA系统直接申请')">
|
{{ $t('chat.leaveFormIntro') }} <a href="#" @click.prevent="openOALeaveRequestDirectly" class="text-brand-600 font-bold hover:underline">{{ $t('chat.oaLeaveDirectLink') }}</a>
|
||||||
已为你生成请假申请表,请直接在下方填写并提交。或 <a href="#" @click.prevent="openOALeaveRequestDirectly" class="text-brand-600 font-bold hover:underline">登录OA系统直接申请</a>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ msg.content }}
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="getLeaveFormPayload(msg)" class="grid gap-4 md:grid-cols-2">
|
<div v-if="getLeaveFormPayload(msg)" class="grid gap-4 md:grid-cols-2">
|
||||||
<label class="space-y-1.5">
|
<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
|
<input
|
||||||
v-model="getLeaveFormPayload(msg)!.form.fillerName"
|
v-model="getLeaveFormPayload(msg)!.form.fillerName"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -2030,7 +2041,7 @@ const showChatRating = ref(false);
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5">
|
<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
|
<input
|
||||||
v-model="getLeaveFormPayload(msg)!.form.employeeId"
|
v-model="getLeaveFormPayload(msg)!.form.employeeId"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -2039,7 +2050,7 @@ const showChatRating = ref(false);
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5">
|
<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
|
<input
|
||||||
:value="getLeaveFormPayload(msg)!.form.applyTime.replace('T', ' ')"
|
:value="getLeaveFormPayload(msg)!.form.applyTime.replace('T', ' ')"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -2048,23 +2059,23 @@ const showChatRating = ref(false);
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5">
|
<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
|
<select
|
||||||
v-model="getLeaveFormPayload(msg)!.form.leaveType"
|
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"
|
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"
|
: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>
|
<option v-for="leaveType in LEAVE_TYPES" :key="leaveType.value" :value="leaveType.value">{{ leaveType.label }}</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5">
|
<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">
|
<div class="relative">
|
||||||
<input
|
<input
|
||||||
:value="getLeaveFormPayload(msg)!.form.applicantName ? `${getLeaveFormPayload(msg)!.form.applicantName} / ${getLeaveFormPayload(msg)!.form.employeeId}` : ''"
|
:value="getLeaveFormPayload(msg)!.form.applicantName ? `${getLeaveFormPayload(msg)!.form.applicantName} / ${getLeaveFormPayload(msg)!.form.employeeId}` : ''"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请选择请假人"
|
:placeholder="$t('chat.selectLeaveApplicant')"
|
||||||
readonly
|
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"
|
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"
|
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||||
@@ -2075,19 +2086,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"
|
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"
|
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||||
@click="openLeaveAgentDialog(msg, 'applicant')"
|
@click="openLeaveAgentDialog(msg, 'applicant')"
|
||||||
title="选择请假人"
|
:title="$t('chat.pickLeaveApplicant')"
|
||||||
>
|
>
|
||||||
<Search class="h-4 w-4" />
|
<Search class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5">
|
<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">
|
<div class="relative">
|
||||||
<input
|
<input
|
||||||
:value="getLeaveAgentDisplayValue(getLeaveFormPayload(msg)!.form)"
|
:value="getLeaveAgentDisplayValue(getLeaveFormPayload(msg)!.form)"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请选择代理人"
|
:placeholder="$t('chat.selectLeaveAgent')"
|
||||||
readonly
|
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"
|
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"
|
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||||
@@ -2098,14 +2109,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"
|
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"
|
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||||
@click="openLeaveAgentDialog(msg)"
|
@click="openLeaveAgentDialog(msg)"
|
||||||
title="选择代理人"
|
:title="$t('chat.pickLeaveAgent')"
|
||||||
>
|
>
|
||||||
<Search class="h-4 w-4" />
|
<Search class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5">
|
<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
|
<input
|
||||||
v-model="getLeaveFormPayload(msg)!.form.startTime"
|
v-model="getLeaveFormPayload(msg)!.form.startTime"
|
||||||
type="datetime-local"
|
type="datetime-local"
|
||||||
@@ -2115,7 +2126,7 @@ const showChatRating = ref(false);
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5">
|
<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
|
<input
|
||||||
v-model="getLeaveFormPayload(msg)!.form.endTime"
|
v-model="getLeaveFormPayload(msg)!.form.endTime"
|
||||||
type="datetime-local"
|
type="datetime-local"
|
||||||
@@ -2125,7 +2136,7 @@ const showChatRating = ref(false);
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5">
|
<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
|
<input
|
||||||
:value="formatDurationLabel(getLeaveFormPayload(msg)!.form.durationHours)"
|
:value="formatDurationLabel(getLeaveFormPayload(msg)!.form.durationHours)"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -2134,30 +2145,30 @@ const showChatRating = ref(false);
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5">
|
<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
|
<select
|
||||||
v-model="getLeaveFormPayload(msg)!.form.isOutOfOffice"
|
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"
|
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"
|
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||||
>
|
>
|
||||||
<option :value="1">否</option>
|
<option :value="1">{{ $t('chat.no') }}</option>
|
||||||
<option :value="0">是</option>
|
<option :value="0">{{ $t('chat.yes') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="space-y-1.5 md:col-span-2">
|
<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
|
<select
|
||||||
v-model="getLeaveFormPayload(msg)!.form.isWorkInjury"
|
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"
|
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"
|
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||||
>
|
>
|
||||||
<option :value="1">否</option>
|
<option :value="1">{{ $t('chat.no') }}</option>
|
||||||
<option :value="0">是</option>
|
<option :value="0">{{ $t('chat.yes') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</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">
|
<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>
|
||||||
<div class="flex justify-end">
|
<div class="flex justify-end">
|
||||||
<button
|
<button
|
||||||
@@ -2165,42 +2176,42 @@ const showChatRating = ref(false);
|
|||||||
:disabled="getLeaveFormPayload(msg)?.submitting || getLeaveFormPayload(msg)?.confirmationGenerated"
|
: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"
|
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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="msg.type === 'leave-confirmation' && getLeaveConfirmationPayload(msg)" class="space-y-4">
|
<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="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="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 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">{{ $t('chat.leaveFiller') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerName || $t('chat.noData') }}</div>
|
||||||
<div><span class="text-slate-500 dark:text-slate-400">创建时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</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">填单人职务:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle }}</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">填单人部门:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId }}</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">填单人公司:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1 }}</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>
|
||||||
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></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 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><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">申请人职务:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle }}</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">申请人部门:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId }}</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">申请人公司:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1 }}</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>
|
||||||
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></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 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><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">代理人职务:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle }}</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">代理人部门:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId }}</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">代理人公司:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1 }}</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">假别:</span>{{ getLeaveTypeLabel(getLeaveConfirmationPayload(msg)!.form.leaveType) }}</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">时长:</span>{{ formatDurationLabel(getLeaveConfirmationPayload(msg)!.form.durationHours) }}</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">开始时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.startTime.replace('T', ' ') }}</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">结束时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.endTime.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">是否外出:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isOutOfOffice) }}</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">是否为工伤:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
|
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.isWorkInjury') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-end gap-3">
|
<div class="flex justify-end gap-3">
|
||||||
@@ -2209,14 +2220,14 @@ const showChatRating = ref(false);
|
|||||||
@click="editLeaveConfirmation(msg, index)"
|
@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"
|
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>
|
||||||
<button
|
<button
|
||||||
@click="confirmLeaveSubmission(msg)"
|
@click="confirmLeaveSubmission(msg)"
|
||||||
:disabled="getLeaveConfirmationPayload(msg)?.submitting || getLeaveConfirmationPayload(msg)?.confirmed"
|
: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"
|
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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2227,20 +2238,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-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'"
|
: '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">
|
<div v-if="getLeaveResultPayload(msg)!.success" class="mt-2 whitespace-pre-wrap text-sm leading-7">
|
||||||
请假单已推送到 OA,具体单据请
|
{{ $t('chat.leaveResultPrefix') }}
|
||||||
<a
|
<a
|
||||||
href="#"
|
href="#"
|
||||||
@click.prevent="openOARequestDirectly(getLeaveResultPayload(msg)!.referenceNo)"
|
@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"
|
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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="mt-2 whitespace-pre-wrap text-sm leading-7">{{ msg.content }}</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-3 text-xs opacity-80">{{ $t('chat.requestNo') }}:{{ getLeaveResultPayload(msg)!.referenceNo }}</div>
|
||||||
<div class="mt-1 text-xs opacity-80">提交时间:{{ getLeaveResultPayload(msg)!.submittedAt }}</div>
|
<div class="mt-1 text-xs opacity-80">{{ $t('chat.submitTime') }}:{{ getLeaveResultPayload(msg)!.submittedAt }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -2274,7 +2285,7 @@ const showChatRating = ref(false);
|
|||||||
:open="shouldExpandSourceDetails(msg)"
|
:open="shouldExpandSourceDetails(msg)"
|
||||||
>
|
>
|
||||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
|
<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>
|
</summary>
|
||||||
<div class="mt-3 space-y-2">
|
<div class="mt-3 space-y-2">
|
||||||
<div
|
<div
|
||||||
@@ -2295,7 +2306,7 @@ const showChatRating = ref(false);
|
|||||||
open
|
open
|
||||||
>
|
>
|
||||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
|
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
|
||||||
生成内容归属部分
|
{{ $t('chat.attributionParts') }}
|
||||||
</summary>
|
</summary>
|
||||||
<ul class="mt-3 space-y-2">
|
<ul class="mt-3 space-y-2">
|
||||||
<li
|
<li
|
||||||
@@ -2353,7 +2364,7 @@ const showChatRating = ref(false);
|
|||||||
v-if="showChatRating && !isThinking && !(msg as any).rated"
|
v-if="showChatRating && !isThinking && !(msg as any).rated"
|
||||||
@click="handleOpenFeedback(index)"
|
@click="handleOpenFeedback(index)"
|
||||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
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" />
|
<MessageSquareText class="h-3.5 w-3.5" />
|
||||||
</button>
|
</button>
|
||||||
@@ -2385,7 +2396,7 @@ const showChatRating = ref(false);
|
|||||||
v-model="input"
|
v-model="input"
|
||||||
@keydown.enter.prevent="handleSend"
|
@keydown.enter.prevent="handleSend"
|
||||||
rows="1"
|
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"
|
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;"
|
style="min-height: 44px; max-height: 220px;"
|
||||||
:disabled="isThinking"
|
:disabled="isThinking"
|
||||||
@@ -2399,7 +2410,7 @@ const showChatRating = ref(false);
|
|||||||
<button
|
<button
|
||||||
@click="handleVoiceFeatureClick"
|
@click="handleVoiceFeatureClick"
|
||||||
type="button"
|
type="button"
|
||||||
title="语音功能"
|
:title="$t('chat.voiceFeature')"
|
||||||
class="text-slate-400 transition-colors hover:text-brand-600 dark:hover:text-brand-300"
|
class="text-slate-400 transition-colors hover:text-brand-600 dark:hover:text-brand-300"
|
||||||
>
|
>
|
||||||
<Mic class="h-5 w-5" />
|
<Mic class="h-5 w-5" />
|
||||||
@@ -2433,7 +2444,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"
|
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" />
|
<Globe class="h-3.5 w-3.5 text-brand-500" />
|
||||||
{{ browserPanelOpen ? '收起浏览器' : '打开浏览器' }}
|
{{ browserPanelOpen ? $t('chat.collapseBrowser') : $t('chat.openBrowser') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@@ -2449,7 +2460,7 @@ const showChatRating = ref(false);
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3 text-center text-[11px] text-slate-400">
|
<div class="mt-3 text-center text-[11px] text-slate-400">
|
||||||
AI 可能会犯错,请核实重要信息。
|
{{ $t('chat.disclaimer') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
@@ -2480,12 +2491,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 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">
|
<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" />
|
<Globe class="h-4 w-4 text-brand-500" />
|
||||||
浏览器
|
{{ $t('chat.browser') }}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@click="browserPanelOpen = false"
|
@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"
|
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" />
|
<X class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
@@ -2495,7 +2506,7 @@ const showChatRating = ref(false);
|
|||||||
<input
|
<input
|
||||||
v-model="browserDraftUrl"
|
v-model="browserDraftUrl"
|
||||||
type="text"
|
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"
|
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"
|
@keydown="handleBrowserUrlEnter"
|
||||||
/>
|
/>
|
||||||
@@ -2503,19 +2514,19 @@ const showChatRating = ref(false);
|
|||||||
@click="loadBrowserPage"
|
@click="loadBrowserPage"
|
||||||
class="rounded-xl bg-brand-600 px-3 py-2 text-xs font-medium text-white transition-colors hover:bg-brand-500"
|
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>
|
||||||
<button
|
<button
|
||||||
@click="refreshBrowserPage"
|
@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"
|
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" />
|
<RotateCw class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@click="openBrowserInNewTab"
|
@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"
|
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" />
|
<ExternalLink class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
@@ -2527,8 +2538,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"
|
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" />
|
<Globe class="h-8 w-8 text-brand-500" />
|
||||||
<div>在这里直接打开网页,边聊天边查看内容。</div>
|
<div>{{ $t('chat.browserHint1') }}</div>
|
||||||
<div class="text-xs">支持输入 `https://`、`localhost` 或内网 IP 地址。</div>
|
<div class="text-xs">{{ $t('chat.browserHint2') }}</div>
|
||||||
</div>
|
</div>
|
||||||
<iframe
|
<iframe
|
||||||
v-else
|
v-else
|
||||||
@@ -2559,7 +2570,7 @@ const showChatRating = ref(false);
|
|||||||
if (activeFeedbackMessageIndex !== null && messages[activeFeedbackMessageIndex]) {
|
if (activeFeedbackMessageIndex !== null && messages[activeFeedbackMessageIndex]) {
|
||||||
(messages[activeFeedbackMessageIndex] as any).rated = true;
|
(messages[activeFeedbackMessageIndex] as any).rated = true;
|
||||||
}
|
}
|
||||||
showMessageDialog('success', '\u53cd\u9988\u63d0\u4ea4\u6210\u529f');
|
showMessageDialog('success', t('chat.feedbackSubmitSuccess'));
|
||||||
showGeneralFeedbackDialog = false;
|
showGeneralFeedbackDialog = false;
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
@@ -2571,8 +2582,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="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 class="mb-4 flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="text-lg font-bold text-slate-800 dark:text-slate-100">选择{{ leaveUserSelectRole === 'agent' ? '代理人' : '请假人' }}</h3>
|
<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">已接入 OA 数据库视图查询。</p>
|
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ $t('chat.oaDataConnected') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<button @click="closeLeaveAgentDialog" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200">
|
<button @click="closeLeaveAgentDialog" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200">
|
||||||
<X class="h-5 w-5" />
|
<X class="h-5 w-5" />
|
||||||
@@ -2584,7 +2595,7 @@ const showChatRating = ref(false);
|
|||||||
v-model="leaveAgentKeyword"
|
v-model="leaveAgentKeyword"
|
||||||
@keydown.enter="handleAgentSearch"
|
@keydown.enter="handleAgentSearch"
|
||||||
type="text"
|
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"
|
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">
|
<button @click="handleAgentSearch" class="absolute inset-y-0 right-0 flex w-10 items-center justify-center text-slate-400 hover:text-brand-600">
|
||||||
@@ -2597,7 +2608,7 @@ const showChatRating = ref(false);
|
|||||||
<Loader2 class="h-6 w-6 animate-spin text-brand-500" />
|
<Loader2 class="h-6 w-6 animate-spin text-brand-500" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="leaveAgentOptions.length === 0" class="py-8 text-center text-sm text-slate-400">
|
<div v-else-if="leaveAgentOptions.length === 0" class="py-8 text-center text-sm text-slate-400">
|
||||||
暂无数据
|
{{ $t('chat.noData') }}
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<button
|
<button
|
||||||
@@ -2612,8 +2623,8 @@ const showChatRating = ref(false);
|
|||||||
<div class="text-xs text-slate-500 dark:text-slate-400">UID:{{ option.uid }}</div>
|
<div class="text-xs text-slate-500 dark:text-slate-400">UID:{{ option.uid }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right text-xs text-slate-500 dark:text-slate-400">
|
<div class="text-right text-xs text-slate-500 dark:text-slate-400">
|
||||||
<div>工号:{{ option.employeeId }}</div>
|
<div>{{ $t('chat.employeeId') }}:{{ option.employeeId }}</div>
|
||||||
<div>姓名:{{ option.name }}</div>
|
<div>{{ $t('chat.name') }}:{{ option.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -2623,17 +2634,17 @@ const showChatRating = ref(false);
|
|||||||
:disabled="leaveAgentLoading"
|
:disabled="leaveAgentLoading"
|
||||||
class="text-xs text-slate-500 hover:text-slate-700 disabled:opacity-50 dark:text-slate-400 dark:hover:text-slate-300"
|
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>
|
||||||
<button
|
<button
|
||||||
@click="loadMoreAgents"
|
@click="loadMoreAgents"
|
||||||
:disabled="leaveAgentLoading"
|
:disabled="leaveAgentLoading"
|
||||||
class="text-xs text-brand-600 hover:text-brand-700 disabled:opacity-50"
|
class="text-xs text-brand-600 hover:text-brand-700 disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{{ leaveAgentLoading ? '加载中...' : '加载更多' }}
|
{{ leaveAgentLoading ? $t('chat.loading') : $t('chat.loadMore') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2644,10 +2655,10 @@ const showChatRating = ref(false);
|
|||||||
<div v-if="showOALoginDialog" class="fixed inset-0 z-[9999] flex items-center justify-center">
|
<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="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">
|
<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">
|
<div class="space-y-4">
|
||||||
<label class="block space-y-1.5">
|
<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
|
<input
|
||||||
v-model="oaLoginEmployeeId"
|
v-model="oaLoginEmployeeId"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -2656,11 +2667,11 @@ const showChatRating = ref(false);
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class="block space-y-1.5">
|
<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
|
<input
|
||||||
v-model="oaLoginPassword"
|
v-model="oaLoginPassword"
|
||||||
type="password"
|
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"
|
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"
|
@keyup.enter="confirmOALogin"
|
||||||
/>
|
/>
|
||||||
@@ -2671,13 +2682,13 @@ const showChatRating = ref(false);
|
|||||||
@click="cancelOALogin"
|
@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"
|
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>
|
||||||
<button
|
<button
|
||||||
@click="confirmOALogin"
|
@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"
|
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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -89,6 +89,7 @@ interface Agent {
|
|||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
icon_url?: string;
|
icon_url?: string;
|
||||||
|
dify_app_type?: 'chatflow' | 'workflow';
|
||||||
}
|
}
|
||||||
|
|
||||||
interface QuickQuestion {
|
interface QuickQuestion {
|
||||||
@@ -244,9 +245,10 @@ const favoriteAgents = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const otherAgents = computed(() => {
|
const otherAgents = computed(() => {
|
||||||
if (!searchQuery.value.trim()) return agents.value;
|
const chatflowAgents = agents.value.filter((a) => (a.dify_app_type || 'chatflow') === 'chatflow');
|
||||||
|
if (!searchQuery.value.trim()) return chatflowAgents;
|
||||||
const q = searchQuery.value.toLowerCase();
|
const q = searchQuery.value.toLowerCase();
|
||||||
return agents.value.filter(
|
return chatflowAgents.filter(
|
||||||
(a) => a.name.toLowerCase().includes(q) || a.description.toLowerCase().includes(q)
|
(a) => a.name.toLowerCase().includes(q) || a.description.toLowerCase().includes(q)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -1576,6 +1578,14 @@ onMounted(async () => {
|
|||||||
<User class="h-4 w-4" />
|
<User class="h-4 w-4" />
|
||||||
<span>个人中心</span>
|
<span>个人中心</span>
|
||||||
</button>
|
</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
|
<button
|
||||||
@click="navigateToApplications"
|
@click="navigateToApplications"
|
||||||
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
|
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
|
||||||
@@ -1628,14 +1638,6 @@ onMounted(async () => {
|
|||||||
<Bot class="h-4 w-4" />
|
<Bot class="h-4 w-4" />
|
||||||
<span>返回聊天</span>
|
<span>返回聊天</span>
|
||||||
</button>
|
</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
|
<button
|
||||||
@click="handleLogout"
|
@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"
|
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"
|
||||||
|
|||||||
+3
-3
@@ -666,7 +666,7 @@ run_ci_migration_check() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_precommit_hook() {
|
install_precommit_hook() {
|
||||||
echo "=== 安装 Git pre-commit Hook ==="
|
echo "=== 安装 Git Hooks(pre-commit + pre-push)==="
|
||||||
local install_script="${ROOT_DIR}/scripts/install_git_hooks.sh"
|
local install_script="${ROOT_DIR}/scripts/install_git_hooks.sh"
|
||||||
if [[ ! -x "${install_script}" ]]; then
|
if [[ ! -x "${install_script}" ]]; then
|
||||||
echo "未找到可执行脚本: ${install_script}"
|
echo "未找到可执行脚本: ${install_script}"
|
||||||
@@ -695,7 +695,7 @@ show_help() {
|
|||||||
branches或 34 -> 查看本地所有分支及默认分支、远端所有分支及默认分支
|
branches或 34 -> 查看本地所有分支及默认分支、远端所有分支及默认分支
|
||||||
dbdrift或 41 -> 检查当前数据库结构与 SQLAlchemy 模型是否一致
|
dbdrift或 41 -> 检查当前数据库结构与 SQLAlchemy 模型是否一致
|
||||||
migci 或 42 -> 运行 CI 同款迁移一致性检查(空库升级+漂移检测)
|
migci 或 42 -> 运行 CI 同款迁移一致性检查(空库升级+漂移检测)
|
||||||
hook 或 43 -> 安装 pre-commit Hook(改 models 必须带 migration)
|
hook 或 43 -> 安装 Git Hooks(models+migration / frontend vue-tsc / push 前 build)
|
||||||
help 或 9 -> 再次显示本帮助
|
help 或 9 -> 再次显示本帮助
|
||||||
help -> 再次显示本帮助
|
help -> 再次显示本帮助
|
||||||
exit 或 0 -> 退出脚本
|
exit 或 0 -> 退出脚本
|
||||||
@@ -759,7 +759,7 @@ main_loop() {
|
|||||||
confirm_and_run "CI同款迁移一致性检查" run_ci_migration_check
|
confirm_and_run "CI同款迁移一致性检查" run_ci_migration_check
|
||||||
;;
|
;;
|
||||||
43|hook)
|
43|hook)
|
||||||
confirm_and_run "安装 pre-commit Hook" install_precommit_hook
|
confirm_and_run "安装 Git Hooks" install_precommit_hook
|
||||||
;;
|
;;
|
||||||
9|help)
|
9|help)
|
||||||
show_help
|
show_help
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Jenkins / 本地 CI 同款前端生产构建(与 deploy.sh、frontend/Dockerfile 一致)
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||||
|
FRONTEND_DIR="${ROOT_DIR}/frontend"
|
||||||
|
|
||||||
|
if [[ ! -f "${FRONTEND_DIR}/package.json" ]]; then
|
||||||
|
echo "[ci-frontend-build] missing ${FRONTEND_DIR}/package.json"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "${FRONTEND_DIR}"
|
||||||
|
echo "[ci-frontend-build] npm ci"
|
||||||
|
npm ci
|
||||||
|
echo "[ci-frontend-build] npm run build"
|
||||||
|
npm run build
|
||||||
|
echo "[ci-frontend-build] OK"
|
||||||
@@ -9,13 +9,18 @@ if ! git -C "${ROOT_DIR}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
HOOK_PATH="${ROOT_DIR}/.githooks/pre-commit"
|
HOOKS_DIR="${ROOT_DIR}/.githooks"
|
||||||
if [[ ! -f "${HOOK_PATH}" ]]; then
|
REQUIRED_HOOKS=(pre-commit pre-push _common.sh)
|
||||||
echo "[hook-install] missing hook file: ${HOOK_PATH}"
|
|
||||||
exit 1
|
for hook_name in "${REQUIRED_HOOKS[@]}"; do
|
||||||
fi
|
hook_path="${HOOKS_DIR}/${hook_name}"
|
||||||
|
if [[ ! -f "${hook_path}" ]]; then
|
||||||
|
echo "[hook-install] missing hook file: ${hook_path}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
chmod +x "${hook_path}"
|
||||||
|
done
|
||||||
|
|
||||||
chmod +x "${HOOK_PATH}"
|
|
||||||
if ! git -C "${ROOT_DIR}" config core.hooksPath .githooks; then
|
if ! git -C "${ROOT_DIR}" config core.hooksPath .githooks; then
|
||||||
echo "[hook-install] failed to set git config core.hooksPath."
|
echo "[hook-install] failed to set git config core.hooksPath."
|
||||||
echo "[hook-install] please run manually in your local shell:"
|
echo "[hook-install] please run manually in your local shell:"
|
||||||
@@ -23,5 +28,9 @@ if ! git -C "${ROOT_DIR}" config core.hooksPath .githooks; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[hook-install] Installed pre-commit hook successfully."
|
echo "[hook-install] Installed Git hooks successfully."
|
||||||
|
echo "[hook-install] pre-commit: models 变更需带 migration;frontend 暂存时跑 vue-tsc"
|
||||||
|
echo "[hook-install] pre-push: 推送含 frontend 变更时跑 npm run build"
|
||||||
echo "[hook-install] core.hooksPath=$(git -C "${ROOT_DIR}" config --get core.hooksPath)"
|
echo "[hook-install] core.hooksPath=$(git -C "${ROOT_DIR}" config --get core.hooksPath)"
|
||||||
|
echo "[hook-install] 跳过前端检查: SKIP_FRONTEND_HOOKS=1"
|
||||||
|
echo "[hook-install] 跳过全部 hook: SKIP_GIT_HOOKS=1 或 git commit/push --no-verify"
|
||||||
Reference in new issue
Block a user