Merge branch 'dev' into test

This commit is contained in:
sophie committed 2026-05-26 18:47:40 +08:00
commit c7abb89149
16 files changed
+318 -613

No files matched your search

+4 -4
View File
@@ -1,11 +1,11 @@
# =============================================================================
# Development — docker compose / deploy_compose.sh dev
# Casdoor 做法 A:与 test/prod 共用同一 Casdoor 地址,但使用独立 Application「hxops-dev」
# 在 Casdoor 新建 Application,Redirect URLs 填入本环境实际会出现的前端 origin + /casdoor-callback
# Environment-specific variables stay in .env.dev/.env.test/.env.prod
# - .env.dev / .env.test / .env.prod for deployment environments
# =============================================================================
DATABASE_URL=postgresql://hxops:1qaz%40WSX@127.0.0.1/hxops
FLASK_APP=run.py
ENV_NAME=dev
FLASK_ENV=development
DATABASE_URL=postgresql://hxops:1qaz%40WSX@127.0.0.1/hxops
ORACLE_CLIENT_MOUNT_DIR=/home/lisq/ai/platform/hxops/oracle_client
ORACLE_CLIENT_LIB_DIR=/app/oracle_client/instantclient_19_31
LD_LIBRARY_PATH=/app/oracle_client/instantclient_19_31:/app/oracle_client
-108
View File
@@ -1,108 +0,0 @@
# Shared variables are maintained in .env.shared
# Environment-specific variables stay in .env.dev/.env.test/.env.prod
# hxops environment variables template
# Copy as needed:
# - .env.dev / .env.test / .env.prod for deployment environments
# - .env.local for local-only overrides (do not commit)
# Runtime selector
ENV_NAME=dev
# Core
SECRET_KEY=replace-with-strong-random-secret
DATABASE_URL=postgresql://<db_user>:<db_password>@<db_host>:5432/<db_name>
REDIS_URL=redis://:<redis_password>@<redis_host>:6379/0
# Knowledge base runtime
KB_STORAGE_ROOT=backend/data/kb
KB_TASK_EXECUTION_MODE=sync
KB_WORKER_POLL_SECONDS=2
# Dify
DIFY_API_BASE=https://api.dify.ai/v1
DIFY_API_KEY=
# Feature switch
FEEDBACK_ENABLED=true
# HR workflow
HR_WORKFLOW_IFRAME_URL=
HR_WORKFLOW_API_BASE=
HR_WORKFLOW_API_KEY=
# Integration API
INTEGRATION_API_MODE=local
INTEGRATION_API_BASE=
INTEGRATION_API_KEY=
# WeCom
WECOM_ENABLED=false
WECOM_CORP_ID=
WECOM_AGENT_ID=
WECOM_SECRET=
WECOM_REDIRECT_URI=
WECOM_AUTO_CREATE_USER=true
WECOM_MATCH_RULES=employee_id,mobile
WECOM_MATCH_OPERATOR=AND
WECOM_FIRST_LOGIN_BIND_MODE=match_rules
WECOM_FIRST_LOGIN_INPUT_FIELDS=employee_id,mobile,email
WECOM_EMPLOYEE_ID_SOURCE=userid
WECOM_MOBILE_NORMALIZE=true
WECOM_CALLBACK_TOKEN=
WECOM_ENCODING_AES_KEY=
WECOM_CALLBACK_URL=
WECOM_HOMEPAGE_URL=
WECOM_TRUSTED_DOMAIN=
WECOM_PUBLIC_BASE_URL=
WECOM_NOTIFY_ENABLED=true
WECOM_NOTIFY_BASE_URL=
WECOM_NOTIFY_EVENTS=permission_request_approved,permission_request_rejected,permission_batch_updated,task_completed
# Auth and Casdoor
AUTH_LEGACY_HEADER_ENABLED=true
AUTH_JWT_REQUIRED=true
AUTH_ALLOW_LOCAL_PASSWORD_LOGIN=true
AUTH_LOGIN_MODE=casdoor
AUTH_ALLOW_LOCAL_JWT=true
AUTH_JWT_ISSUER=
AUTH_JWT_AUDIENCE=
AUTH_JWT_JWKS_URL=
AUTH_LOCAL_JWT_ISSUER=hxops-backend
AUTH_LOCAL_JWT_AUDIENCE=hxops-frontend
AUTH_LOCAL_JWT_EXPIRES_HOURS=12
CASDOOR_BASE_URL=
CASDOOR_CLIENT_ID=
CASDOOR_CLIENT_SECRET=
CASDOOR_REDIRECT_URI=
CASDOOR_SCOPE=openid profile email
CASDOOR_WECOM_PROVIDER_HINT=
CASDOOR_WECOM_SILENT_SIGNIN=false
# Optional data source
HR_SQLSERVER_DRIVER=
HR_SQLSERVER_HOST=
HR_SQLSERVER_PORT=1433
HR_SQLSERVER_DATABASE=
HR_SQLSERVER_USERNAME=
HR_SQLSERVER_PASSWORD=
HR_SQLSERVER_ENCRYPT=no
HR_SQLSERVER_TRUST_CERT=yes
HR_SQLSERVER_TIMEOUT=10
ORACLE_CLIENT_LIB_DIR=
ERP_JDBC_JAR=
ERP_JDBC_JAR_URL=
ERP_DB_DSN=
TEXT2SQL_SCHEMA_PATH=
GJL_API_KEY=
GJL_API_BASE=https://api.siliconflow.cn/v1
GJL_MODEL=deepseek-ai/DeepSeek-V3
# MinIO
MINIO_ENDPOINT=127.0.0.1:9000
MINIO_BUCKET=image-hosting-service
MINIO_ACCESS_KEY=
MINIO_SECRET_KEY=
MINIO_PUBLIC_BASE_URL=
+4 -4
View File
@@ -1,11 +1,11 @@
# =============================================================================
# Production — docker compose env_file + deploy_compose.sh prod
# Casdoor 做法 A:共用 CASDOOR_BASE_URL,独立 Application「hxops-prod」
# 勿将真实 CASDOOR_CLIENT_SECRET 提交 Git;在服务器改实值或由 Jenkins 注入
# Environment-specific variables stay in .env.dev/.env.test/.env.prod
# - .env.dev / .env.test / .env.prod for deployment environments
# =============================================================================
DATABASE_URL=postgresql://postgres:difyai123456@192.168.100.230:5432/hxops_db
FLASK_APP=run.py
ENV_NAME=prod
FLASK_ENV=production
DATABASE_URL=postgresql://postgres:difyai123456@192.168.100.230:5432/hxops_db
ORACLE_CLIENT_MOUNT_DIR=/data/ai-platform/hxops/oracle_client
ORACLE_CLIENT_LIB_DIR=/app/oracle_client/instantclient_19_31
LD_LIBRARY_PATH=/app/oracle_client/instantclient_19_31:/app/oracle_client
+27 -4
View File
@@ -3,14 +3,19 @@
# Runtime selector fallback (actual deployment still sets ENV_NAME explicitly)
ENV_NAME=dev
# Common runtime defaults
FLASK_APP=run.py
# 知识库管理(后续需要修改此地址)
# 查「Dify 文档对应原始源文件下载地址」时,要连的那台 Integration API 的根 URL
INTEGRATION_API_BASE=http://192.168.100.230:8891
# 连接文档清洗系统的API KEY
INTEGRATION_API_KEY=I76mSQZQEPYU6TubMhjh-xLsCgWC0gSIg5MncJFHFCvqvVlg-gZ_BvwO_UEL2nh
SECRET_KEY=hxops-dify
# Common runtime defaults
FLASK_APP=run.py
# Knowledge base runtime
# KB_STORAGE_ROOT=backend/data/kb
KB_TASK_EXECUTION_MODE=worker
KB_WORKER_POLL_SECONDS=2
@@ -28,7 +33,12 @@ AUTH_LOCAL_JWT_ISSUER=hxops-backend
AUTH_LOCAL_JWT_AUDIENCE=hxops-frontend
AUTH_LOCAL_JWT_EXPIRES_HOURS=12
# Common WeCom behavior defaults
# WeCom
WECOM_ENABLED=false
WECOM_CORP_ID=
WECOM_AGENT_ID=
WECOM_SECRET=
WECOM_REDIRECT_URI=
WECOM_AUTO_CREATE_USER=true
WECOM_MATCH_RULES=employee_id,mobile
WECOM_MATCH_OPERATOR=AND
@@ -36,9 +46,18 @@ WECOM_FIRST_LOGIN_BIND_MODE=match_rules
WECOM_FIRST_LOGIN_INPUT_FIELDS=employee_id,mobile,email
WECOM_EMPLOYEE_ID_SOURCE=userid
WECOM_MOBILE_NORMALIZE=true
WECOM_CALLBACK_TOKEN=
WECOM_ENCODING_AES_KEY=
WECOM_CALLBACK_URL=
WECOM_HOMEPAGE_URL=
WECOM_TRUSTED_DOMAIN=
# Public HTTPS origin for WeCom console URLs (takes priority over notify base + request host)
WECOM_PUBLIC_BASE_URL=
WECOM_NOTIFY_ENABLED=true
WECOM_NOTIFY_BASE_URL=
WECOM_NOTIFY_EVENTS=permission_request_approved,permission_request_rejected,permission_batch_updated,task_completed,schedule_completed
# Common integration defaults
INTEGRATION_API_MODE=local
DIFY_API_BASE=https://api.dify.ai/v1
@@ -80,4 +99,8 @@ SRM_SQLSERVER_PASSWORD=sa@moreyou456
SRM_SQLSERVER_DRIVER=ODBC Driver 18 for SQL Server
SRM_SQLSERVER_ENCRYPT=no
SRM_SQLSERVER_TRUST_CERT=yes
SRM_SQLSERVER_TIMEOUT=10
SRM_SQLSERVER_TIMEOUT=10
# ERP
ERP_DB_DSN=192.168.8.24:1521/topprod
TEXT2SQL_SCHEMA_PATH=
+4 -3
View File
@@ -1,10 +1,11 @@
# =============================================================================
# Test — docker compose / deploy_compose.sh test
# Casdoor 做法 A:共用 CASDOOR_BASE_URL,独立 Application「hxops-test」
# Environment-specific variables stay in .env.dev/.env.test/.env.prod
# - .env.dev / .env.test / .env.prod for deployment environments
# =============================================================================
DATABASE_URL=postgresql://postgres:8je2olWwHj28fCfVTgRWmankoTQORjqyBn6iIK3dG2q10vAq@192.168.100.192:5432/hxops_testing
FLASK_APP=run.py
ENV_NAME=test
FLASK_ENV=test
DATABASE_URL=postgresql://postgres:8je2olWwHj28fCfVTgRWmankoTQORjqyBn6iIK3dG2q10vAq@192.168.100.192:5432/hxops_testing
ORACLE_CLIENT_MOUNT_DIR=/home/lisq/ai/platform/hxops/oracle_client
ORACLE_CLIENT_LIB_DIR=/app/oracle_client/instantclient_23_26
LD_LIBRARY_PATH=/app/oracle_client/instantclient_23_26:/app/oracle_client
-82
View File
@@ -1,82 +0,0 @@
#!/bin/bash
set -e
# ==============================================================================
# Hxops 部署脚本 (优化版)
# 用途: 自动拉取代码、构建前端、重启容器
# 使用: ./deploy.sh
# 备注:该文件用于手动在服务器上执行该脚本,Jenkins自动部署已不用该文件
# ==============================================================================
echo "🚀 开始部署 Hxops..."
# 1. 获取当前分支并拉取最新代码
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "📥 拉取代码 (分支: $CURRENT_BRANCH)..."
git pull origin "$CURRENT_BRANCH" || { echo "❌ git pull 失败"; exit 1; }
# 2. 检查 docker-compose 命令
if command -v docker-compose &> /dev/null; then
DC_CMD="docker-compose"
elif docker compose version &> /dev/null; then
DC_CMD="docker compose"
else
echo "❌ 未找到 docker-compose 或 docker compose 命令"
exit 1
fi
# 3. 前端构建 (在服务器上构建,确保环境一致性)
# 方案:使用 docker 临时容器构建,避免服务器安装 node
echo "🏗️ 构建前端资源..."
# 注意:这里假设 frontend/Dockerfile 已经是基于 nginx 且 COPY dist 的
# 如果我们想在服务器构建,最好修改 Dockerfile 为多阶段构建,或者使用临时容器
# 这里我们采用临时 node 容器构建 dist,然后让 docker-compose build 复制进去
# frontend 目录与当前用户信息
FRONTEND_DIR="$(pwd)/frontend"
HOST_UID="$(id -u)"
HOST_GID="$(id -g)"
# 清理旧构建产物(通过容器执行,兼容历史 root 权限文件)
echo " Cleaning old dist/node_modules..."
docker run --rm -v "${FRONTEND_DIR}:/app" -w /app node:22-alpine sh -c "rm -rf dist node_modules"
# 使用临时容器构建
echo " Running npm install & build in docker..."
docker run --rm \
-u "${HOST_UID}:${HOST_GID}" \
-e npm_config_cache=/tmp/.npm \
-v "${FRONTEND_DIR}:/app" \
-w /app \
node:22-alpine sh -c "npm install && npm run build"
if [ ! -d "frontend/dist" ]; then
echo "❌ 前端构建失败: frontend/dist 目录未生成"
exit 1
fi
# 4. 重启服务
echo "🔄 重启 Docker 服务..."
$DC_CMD down --remove-orphans || echo "⚠️ Warning: docker-compose down returned error, attempting to continue..."
$DC_CMD up -d --build
# 5. 执行数据库迁移(SQLAlchemy / Alembic)
echo "🗄️ 执行数据库表结构更新..."
$DC_CMD exec -T hxops-backend flask --app manage.py db upgrade || { echo "❌ 数据库迁移失败"; exit 1; }
# 5.1 SQLAlchemy 兜底同步(补齐缺失表,不替代 Alembic 迁移)
echo "🧩 执行 SQLAlchemy 表结构兜底同步..."
$DC_CMD exec -T hxops-backend python - <<'PY' || { echo "❌ SQLAlchemy 表结构同步失败"; exit 1; }
from app import create_app, db
app = create_app('production')
with app.app_context():
db.create_all()
print("SQLAlchemy create_all completed.")
PY
# 6. 清理未使用镜像
echo "🧹 清理旧镜像..."
docker image prune -f
echo "✅ 部署完成!"
-47
View File
@@ -1,47 +0,0 @@
#!/bin/bash
# deploy.sh
# 服务器部署脚本
SERVER_IP="192.168.100.230"
REMOTE_USER="inspur"
REMOTE_DIR="/data/hxops"
echo "=== 开始部署流程 ==="
# 1. 确保本地无未提交代码 (可选)
# git status
# 2. 将代码同步到服务器
echo ">> 同步代码到服务器..."
rsync -avz --exclude 'venv' --exclude 'node_modules' --exclude '.git' --exclude '__pycache__' \
./ $REMOTE_USER@$SERVER_IP:$REMOTE_DIR
# 3. 在服务器上构建并重启
echo ">> 远程构建并重启服务..."
ssh $REMOTE_USER@$SERVER_IP << EOF
cd $REMOTE_DIR
# 确保目录存在
mkdir -p backend/logs
# 加载环境变量 (如果存在 .env)
if [ -f .env ]; then
export \$(cat .env | xargs)
fi
# Docker Compose 重启
# 注意:首次运行需确保 hxops_prod 数据库已创建
# PGPASSWORD=difyai123456 createdb -h localhost -U postgres hxops_prod || true
sudo docker compose down
sudo docker compose build
sudo docker compose up -d
# 执行数据库迁移 (在 backend 容器内)
echo ">> 执行数据库迁移..."
sudo docker compose exec -T backend flask db upgrade
echo "=== 部署完成 ==="
sudo docker compose ps
EOF
-130
View File
@@ -1,130 +0,0 @@
services:
# ==============================================================================
# kb-redis: 知识库任务/后续异步能力预留的 Redis 服务
# ==============================================================================
kb-redis:
image: ${KB_REDIS_IMAGE:-redis:7-alpine}
container_name: hxops-kb-redis
restart: always
profiles:
- kb-redis
command: ["redis-server", "--appendonly", "yes"]
volumes:
- hxops_redis_data:/data
networks:
- ai-platform
# ==============================================================================
# hxops-backend: Flask 后端服务 (端口: 5000)
# ==============================================================================
hxops-backend:
image: ${BACKEND_IMAGE:-hxops-backend:local}
build:
context: .
dockerfile: backend/Dockerfile
args:
PYTHON_BASE_IMAGE: ${PYTHON_BASE_IMAGE:-python:3.12-slim}
PIP_INDEX_URL: ${PIP_INDEX_URL:-https://mirrors.aliyun.com/pypi/simple}
PIP_EXTRA_INDEX_URL: ${PIP_EXTRA_INDEX_URL:-}
container_name: hxops-backend
restart: always
# 与 scripts/deploy_compose.sh 使用的 .env.<ENV_NAME> 对齐(通过 COMPOSE_ENV_BASENAME)
env_file:
- ${COMPOSE_ENV_BASENAME:-.env.dev}
environment:
# 数据库连接 (在环境变量中配置)
- DATABASE_URL=${DATABASE_URL}
- FLASK_APP=${FLASK_APP:-run.py}
- FLASK_ENV=${FLASK_ENV:-production}
- ORACLE_CLIENT_LIB_DIR=${ORACLE_CLIENT_LIB_DIR:-/app/oracle_client}
- ORACLE_HOME=/app/oracle_client/instantclient_19_31
- LD_LIBRARY_PATH=/app/oracle_client/instantclient_19_31:/app/oracle_client
- REDIS_URL: ${REDIS_URL:-redis://kb-redis:6379/0}
- KB_STORAGE_ROOT: ${KB_STORAGE_ROOT:-/app/data/kb}
- KB_TASK_EXECUTION_MODE: ${KB_TASK_EXECUTION_MODE:-worker}
- KB_WORKER_POLL_SECONDS: ${KB_WORKER_POLL_SECONDS:-2}
# 允许容器访问宿主机服务 (如数据库)
extra_hosts:
- "host.docker.internal:host-gateway"
# 如果需要在宿主机调试,可暴露端口;生产环境建议只在网络内暴露
ports:
- "5052:5052"
# 持久化运行时可写文件:
# - backend/.env 用于保存管理员后台修改的企业微信等配置(与数据库双写,
# 防止容器重建后从镜像基线读取丢失修改)。文件不存在时 docker 会自动
# 把它当作目录挂载,因此先确保宿主机上存在该文件再启动。
volumes:
- ./backend/.env:/app/.env
- hxops_runtime_data:/app/data
networks:
- ai-platform
# ==============================================================================
# hxops-kb-worker: 知识库清洗/同步最小 worker
# ==============================================================================
hxops-kb-worker:
image: ${BACKEND_IMAGE:-hxops-backend:local}
build:
context: ./backend
dockerfile: Dockerfile
args:
PYTHON_BASE_IMAGE: ${PYTHON_BASE_IMAGE:-python:3.12-slim}
PIP_INDEX_URL: ${PIP_INDEX_URL:-https://mirrors.aliyun.com/pypi/simple}
PIP_EXTRA_INDEX_URL: ${PIP_EXTRA_INDEX_URL:-}
container_name: hxops-kb-worker
restart: always
command: ["python", "worker_kb.py"]
depends_on:
- hxops-backend
env_file:
- ./backend/.env
environment:
DATABASE_URL:
SECRET_KEY:
FLASK_APP: ${FLASK_APP:-run.py}
FLASK_ENV: ${FLASK_ENV:-production}
REDIS_URL: ${REDIS_URL:-redis://kb-redis:6379/0}
KB_STORAGE_ROOT: ${KB_STORAGE_ROOT:-/app/data/kb}
KB_TASK_EXECUTION_MODE: ${KB_TASK_EXECUTION_MODE:-worker}
KB_WORKER_POLL_SECONDS: ${KB_WORKER_POLL_SECONDS:-2}
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ./backend/.env:/app/.env
- hxops_runtime_data:/app/data
networks:
- ai-platform
# ==============================================================================
# hxops-frontend: Vue 前端静态资源 + Nginx 反向代理 (端口: 80)
# ==============================================================================
hxops-frontend:
image: ${FRONTEND_IMAGE:-hxops-frontend:local}
build:
context: ./frontend
dockerfile: Dockerfile
args:
NODE_BASE_IMAGE: ${NODE_BASE_IMAGE:-node:22-alpine}
NGINX_BASE_IMAGE: ${NGINX_BASE_IMAGE:-nginx:alpine}
container_name: hxops-frontend
restart: always
depends_on:
- hxops-backend
# 前端容器暴露 80 端口,映射到宿主机 8890 (或其他端口供 nginx-gateway 访问)
ports:
- "8890:80"
networks:
- ai-platform
# ==============================================================================
# 网络配置
# ==============================================================================
networks:
ai-platform:
name: ai-platform
driver: bridge
volumes:
hxops_runtime_data:
hxops_redis_data:
@@ -120,12 +120,12 @@ const submitFeedback = async () => {
v-if="modelValue"
class="fixed inset-0 z-[80] flex items-start justify-center overflow-y-auto bg-black/40 p-3 backdrop-blur-sm sm:items-center sm:p-4"
>
<div class="flex max-h-[92vh] w-full max-w-2xl flex-col rounded-2xl bg-white shadow-2xl">
<div class="flex items-center justify-between border-b border-gray-100 px-5 pb-4 pt-5 sm:px-8 sm:pb-4 sm:pt-7">
<h3 class="text-2xl font-bold text-gray-900">{{ t('feedback.title') }}</h3>
<div class="flex max-h-[92vh] w-full max-w-2xl flex-col rounded-2xl border border-transparent bg-white shadow-2xl dark:border-slate-700 dark:bg-slate-900">
<div class="flex items-center justify-between border-b border-gray-100 px-5 pb-4 pt-5 dark:border-slate-800 sm:px-8 sm:pb-4 sm:pt-7">
<h3 class="text-2xl font-bold text-gray-900 dark:text-slate-100">{{ t('feedback.title') }}</h3>
<button
@click="closeDialog"
class="rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600"
class="rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:text-slate-500 dark:hover:bg-slate-800 dark:hover:text-slate-300"
aria-label="Close"
>
<X class="h-5 w-5" />
@@ -134,7 +134,7 @@ const submitFeedback = async () => {
<div class="space-y-5 overflow-y-auto px-5 py-5 sm:px-8">
<div class="space-y-1.5">
<label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.type') }}</label>
<label class="block text-sm font-semibold text-gray-600 dark:text-slate-400">{{ t('feedback.labels.type') }}</label>
<div class="flex flex-wrap gap-3">
<button
v-for="item in typeOptions"
@@ -143,8 +143,8 @@ const submitFeedback = async () => {
class="rounded-xl border px-4 py-2.5 text-base font-medium transition-colors"
:class="
selectedType === item
? 'border-blue-500 bg-blue-50 text-blue-700'
: 'border-gray-200 bg-gray-50 text-gray-700 hover:bg-gray-100'
? 'border-blue-500 bg-blue-50 text-blue-700 dark:border-brand-500 dark:bg-brand-500/15 dark:text-brand-300'
: 'border-gray-200 bg-gray-50 text-gray-700 hover:bg-gray-100 dark:border-slate-600 dark:bg-slate-800/80 dark:text-slate-300 dark:hover:border-slate-500 dark:hover:bg-slate-700/80'
"
>
{{ item }}
@@ -153,43 +153,43 @@ const submitFeedback = async () => {
</div>
<div class="space-y-1.5">
<label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.module') }}</label>
<label class="block text-sm font-semibold text-gray-600 dark:text-slate-400">{{ t('feedback.labels.module') }}</label>
<select
v-model="selectedModule"
class="w-full rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20"
class="w-full rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 text-base text-gray-900 shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:focus:border-brand-500 dark:focus:bg-slate-800 dark:focus:ring-brand-500/20"
>
<option v-for="item in moduleOptions" :key="item" :value="item">{{ item }}</option>
</select>
</div>
<div class="space-y-1.5">
<label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.content') }}<span class="ml-0.5 text-red-500">*</span></label>
<label class="block text-sm font-semibold text-gray-600 dark:text-slate-400">{{ t('feedback.labels.content') }}<span class="ml-0.5 text-red-500 dark:text-red-400">*</span></label>
<textarea
v-model="content"
rows="5"
maxlength="2000"
class="w-full resize-none rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20"
class="w-full resize-none rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 text-base text-gray-900 shadow-sm outline-none transition-all placeholder:text-gray-400 focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:placeholder:text-slate-500 dark:focus:border-brand-500 dark:focus:bg-slate-800 dark:focus:ring-brand-500/20"
:placeholder="t('feedback.placeholder.content')"
/>
<div class="mt-2 flex items-center justify-between">
<div v-if="error" class="text-base text-red-600">{{ error }}</div>
<div v-if="error" class="text-base text-red-600 dark:text-red-400">{{ error }}</div>
<div v-else class="text-base text-gray-400"> </div>
<div class="text-base text-gray-400">{{ content.length }}/2000</div>
<div class="text-base text-gray-400 dark:text-slate-500">{{ content.length }}/2000</div>
</div>
</div>
</div>
<div class="flex justify-end gap-3 rounded-b-2xl border-t border-gray-100 bg-white px-5 py-4 sm:px-8">
<div class="flex justify-end gap-3 rounded-b-2xl border-t border-gray-100 bg-white px-5 py-4 dark:border-slate-800 dark:bg-slate-900 sm:px-8">
<button
@click="closeDialog"
class="rounded-xl px-5 py-2.5 text-base font-medium text-gray-600 transition-colors hover:bg-gray-100"
class="rounded-xl px-5 py-2.5 text-base font-medium text-gray-600 transition-colors hover:bg-gray-100 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-200"
:disabled="submitting"
>
{{ t('feedback.cancel') }}
</button>
<button
@click="submitFeedback"
class="inline-flex items-center justify-center gap-2 rounded-xl bg-blue-600 px-5 py-2.5 text-base font-medium text-white shadow-md shadow-blue-200 transition-all hover:bg-blue-700 active:scale-95 disabled:cursor-not-allowed disabled:opacity-70"
class="inline-flex items-center justify-center gap-2 rounded-xl bg-blue-600 px-5 py-2.5 text-base font-medium text-white shadow-md shadow-blue-200 transition-all hover:bg-blue-700 active:scale-95 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-brand-600 dark:shadow-none dark:hover:bg-brand-500"
:disabled="!canSubmit"
>
<MessageSquareText class="h-5 w-5" />
+10 -10
View File
@@ -26,21 +26,21 @@ onMounted(() => {
</script>
<template>
<div class="mt-6 rounded-2xl border border-slate-200 bg-white p-5">
<div class="mt-6 rounded-2xl border border-slate-200 bg-white p-5 dark:border-slate-700 dark:bg-slate-800">
<div class="mb-4 flex items-center justify-between">
<h3 class="text-lg font-semibold text-slate-900">{{ t('scheduleRuns.title') }}</h3>
<button class="rounded-lg border border-slate-300 px-3 py-1.5 text-sm text-slate-700 hover:bg-slate-50" @click="loadRuns">
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ t('scheduleRuns.title') }}</h3>
<button class="rounded-lg border border-slate-300 px-3 py-1.5 text-sm text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-700" @click="loadRuns">
{{ t('scheduleRuns.refresh') }}
</button>
</div>
<p class="mb-3 text-xs text-slate-500">{{ t('scheduleRuns.tip') }}</p>
<div v-if="isLoading" class="py-6 text-sm text-slate-500">{{ t('scheduleRuns.loading') }}</div>
<div v-else-if="error" class="py-6 text-sm text-rose-500">{{ error }}</div>
<div v-else-if="runs.length === 0" class="py-6 text-sm text-slate-400">{{ t('scheduleRuns.empty') }}</div>
<p class="mb-3 text-xs text-slate-500 dark:text-slate-400">{{ t('scheduleRuns.tip') }}</p>
<div v-if="isLoading" class="py-6 text-sm text-slate-500 dark:text-slate-400">{{ t('scheduleRuns.loading') }}</div>
<div v-else-if="error" class="py-6 text-sm text-rose-500 dark:text-rose-400">{{ error }}</div>
<div v-else-if="runs.length === 0" class="py-6 text-sm text-slate-400 dark:text-slate-500">{{ t('scheduleRuns.empty') }}</div>
<div v-else class="overflow-x-auto">
<table class="w-full min-w-[920px] text-sm">
<thead>
<tr class="border-b border-slate-200 text-left text-slate-500">
<tr class="border-b border-slate-200 text-left text-slate-500 dark:border-slate-700 dark:text-slate-400">
<th class="px-2 py-2">{{ t('scheduleRuns.columns.runNo') }}</th>
<th class="px-2 py-2">{{ t('scheduleRuns.columns.schedule') }}</th>
<th class="px-2 py-2">{{ t('scheduleRuns.columns.start') }}</th>
@@ -53,7 +53,7 @@ onMounted(() => {
</tr>
</thead>
<tbody>
<tr v-for="run in runs" :key="run.id" class="border-b border-slate-100 text-slate-700">
<tr v-for="run in runs" :key="run.id" class="border-b border-slate-100 text-slate-700 dark:border-slate-700 dark:text-slate-300">
<td class="px-2 py-2">{{ run.run_no }}</td>
<td class="px-2 py-2">{{ run.schedule_name || '-' }}</td>
<td class="px-2 py-2">{{ run.started_at || '-' }}</td>
@@ -63,7 +63,7 @@ onMounted(() => {
<td class="px-2 py-2">{{ run.success_count }}</td>
<td class="px-2 py-2">{{ run.failed_count }}</td>
<td class="px-2 py-2">
<a class="text-brand-600 hover:underline" :href="workspaceRunExcelUrl(run.id)" target="_blank">{{ t('scheduleRuns.viewExcel') }}</a>
<a class="text-brand-600 hover:underline dark:text-brand-400" :href="workspaceRunExcelUrl(run.id)" target="_blank">{{ t('scheduleRuns.viewExcel') }}</a>
</td>
</tr>
</tbody>
+1 -1
View File
@@ -98,7 +98,7 @@
}
.card {
@apply bg-white rounded-2xl border border-slate-100 shadow-soft hover:shadow-lg transition-all duration-300;
@apply bg-white rounded-2xl border border-slate-100 shadow-soft hover:shadow-lg transition-all duration-300 dark:bg-slate-800 dark:border-slate-700;
}
/* Mobile-first layout tokens for consistent spacing and density. */
+12 -7
View File
@@ -241,6 +241,10 @@ const route = useRoute();
// 当前左侧菜单激活的模块:dashboard / agents / permissions
const activeModule = ref<'dashboard' | 'agents' | 'announcements' | 'permissions' | 'requests' | 'reports' | 'approvals' | 'users' | 'departments' | 'questions' | 'wecom' | 'schedules' | 'knowledge_base'>('dashboard');
const adminSidebarNavActive =
'bg-brand-50 text-brand-700 shadow-sm dark:bg-brand-500/15 dark:text-brand-300 dark:shadow-none dark:ring-1 dark:ring-inset dark:ring-brand-500/25';
const adminSidebarNavInactive =
'text-slate-600 hover:bg-slate-50 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-800/80 dark:hover:text-slate-200';
const expandedReports = ref(true);
// agents:管理员视角下的所有 Agent 列表
@@ -3463,28 +3467,29 @@ const handlePermissionImport = async (event: Event) => {
v-for="item in sidebarItems"
:key="item.id"
class="group px-4 py-3 text-left text-sm font-medium rounded-xl transition-all flex items-center gap-3 relative overflow-hidden whitespace-nowrap flex-shrink-0"
:class="activeModule === item.id ? 'bg-brand-50 text-brand-700' : 'text-slate-600 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-slate-900 dark:hover:text-slate-100'"
:class="activeModule === item.id ? adminSidebarNavActive : adminSidebarNavInactive"
@click="activeModule = item.id as any; activeReportTabId = null"
:title="isSidebarCollapsed ? item.label : ''"
>
<component :is="item.icon" class="w-5 h-5 transition-transform group-hover:scale-110 flex-shrink-0" :class="activeModule === item.id ? 'text-brand-600' : 'text-slate-400 dark:text-slate-500 group-hover:text-slate-600 dark:group-hover:text-slate-300'" />
<component :is="item.icon" class="w-5 h-5 transition-transform group-hover:scale-110 flex-shrink-0" :class="activeModule === item.id ? 'text-brand-600 dark:text-brand-300' : 'text-slate-400 dark:text-slate-500 group-hover:text-slate-600 dark:group-hover:text-slate-300'" />
<span :class="isSidebarCollapsed ? 'md:hidden' : ''">{{ item.label }}</span>
<span v-if="item.badge && !isSidebarCollapsed" class="ml-auto bg-red-500 text-white text-[10px] font-bold px-2 py-0.5 rounded-full shadow-sm">
{{ item.badge }}
</span>
<span v-if="item.badge && isSidebarCollapsed" class="absolute top-2 right-2 w-2 h-2 bg-red-500 rounded-full"></span>
<div v-if="activeModule === item.id" class="absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 bg-brand-600 rounded-r-full"></div>
<div v-if="activeModule === item.id" class="absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 bg-brand-600 dark:bg-brand-400 rounded-r-full"></div>
</button>
<!-- Reports Submenu -->
<div v-if="config.admin.modules.reports !== false" class="flex flex-col flex-shrink-0">
<button
@click="expandedReports = !expandedReports"
class="group px-4 py-3 text-left text-sm font-medium rounded-xl transition-all flex items-center justify-between gap-3 relative overflow-hidden whitespace-nowrap text-slate-600 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-slate-900 dark:hover:text-slate-100"
class="group px-4 py-3 text-left text-sm font-medium rounded-xl transition-all flex items-center justify-between gap-3 relative overflow-hidden whitespace-nowrap"
:class="activeModule === 'reports' ? adminSidebarNavActive : adminSidebarNavInactive"
:title="isSidebarCollapsed ? t('admin.nav.reports') : ''"
>
<div class="flex items-center gap-3">
<BarChart2 class="w-5 h-5 text-slate-400 dark:text-slate-500 group-hover:text-slate-600 dark:group-hover:text-slate-300 flex-shrink-0" />
<BarChart2 class="w-5 h-5 flex-shrink-0 transition-colors" :class="activeModule === 'reports' ? 'text-brand-600 dark:text-brand-300' : 'text-slate-400 dark:text-slate-500 group-hover:text-slate-600 dark:group-hover:text-slate-300'" />
<span :class="isSidebarCollapsed ? 'md:hidden' : ''">{{ t('admin.nav.reports') }}</span>
</div>
<svg v-if="!isSidebarCollapsed" :class="expandedReports ? 'rotate-180' : ''" class="w-4 h-4 transition-transform text-slate-400 dark:text-slate-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
@@ -3498,9 +3503,9 @@ const handlePermissionImport = async (event: Event) => {
:key="table"
@click="openReportTab(table)"
class="w-full text-left px-4 py-2 text-xs font-medium rounded-lg transition-colors flex items-center gap-2"
:class="(activeModule === 'reports' && currentTable === table) ? 'bg-brand-50 text-brand-700' : 'text-slate-500 dark:text-slate-400 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-slate-900 dark:hover:text-slate-100'"
:class="(activeModule === 'reports' && currentTable === table) ? adminSidebarNavActive : adminSidebarNavInactive"
>
<div class="w-1.5 h-1.5 rounded-full" :class="(activeModule === 'reports' && currentTable === table) ? 'bg-brand-600' : 'bg-slate-300'"></div>
<div class="w-1.5 h-1.5 rounded-full" :class="(activeModule === 'reports' && currentTable === table) ? 'bg-brand-600 dark:bg-brand-400' : 'bg-slate-300 dark:bg-slate-600'"></div>
{{ getReportTableLabel(table) }}
</button>
</div>
+154 -34
View File
@@ -925,45 +925,165 @@ const calculateDurationHours = (startTime: string, endTime: string) => {
const formatDurationLabel = (hours: number) => {
if (!hours) return `0 ${t('chat.hourUnit')}`;
if (hours >= 8 && Number.isInteger((hours / 8) * 10) && (hours / 8) >= 1) {
const days = Number((hours / 8).toFixed(2));
return `${days} ${t('chat.dayUnit')} / ${hours} ${t('chat.hourUnit')}`;
}
return `${hours} ${t('chat.hourUnit')}`;
};
const LEAVE_TYPE_MAP: Record<string, string> = {
'事假': '005',
'病假': '006',
'丧假': '007',
'年假': '010',
'因公出差': '021',
'出差': '021',
'调休': '025',
'产假': '401',
'陪产假': '402',
'婚假': '403',
'住院': '405',
'工伤': '406',
'育儿假': '408',
'返乡': 'ZZ01',
};
const extractLeaveTypeFromIntent = (content: string) => {
if (!content) return '';
const map: Record<string, string> = {
'事假': '005',
'病假': '006',
'丧假': '007',
'年假': '010',
'因公出差': '021',
'出差': '021',
'调休': '025',
'产假': '401',
'陪产假': '402',
'婚假': '403',
'住院': '405',
'工伤': '406',
'育儿假': '408',
'返乡': 'ZZ01',
};
for (const [key, val] of Object.entries(map)) {
if (content.includes(key)) {
return val;
}
for (const [key, val] of Object.entries(LEAVE_TYPE_MAP)) {
if (content.includes(key)) return val;
}
return '';
};
const createLeaveFormData = (content?: string): LeaveRequestFormData => {
interface ExtractedLeaveInfo {
leaveType: string;
startTime: string;
endTime: string;
durationHours: number;
}
const extractLeaveInfoFromIntent = (content: string): ExtractedLeaveInfo | null => {
const normalized = content.replace(/\s+/g, ' ').trim();
let leaveType = extractLeaveTypeFromIntent(normalized);
let startTime = '';
let endTime = '';
let durationHours = 0;
const today = new Date();
const thisYear = today.getFullYear();
const parseDateStr = (m: RegExpMatchArray | null, groupOffset: number): Date | null => {
if (!m) return null;
const rawMo = m[groupOffset];
const rawDa = m[groupOffset + 1];
if (!rawMo || !rawDa) return null;
const mo = parseInt(rawMo, 10);
const da = parseInt(rawDa, 10);
if (Number.isNaN(mo) || Number.isNaN(da) || mo < 1 || mo > 12 || da < 1 || da > 31) return null;
return new Date(thisYear, mo - 1, da, 9, 0);
};
const fmtDt = (d: Date, hour: number, minute: number) => {
const y = d.getFullYear();
const mo = String(d.getMonth() + 1).padStart(2, '0');
const da = String(d.getDate()).padStart(2, '0');
const h = String(hour).padStart(2, '0');
const mi = String(minute).padStart(2, '0');
return `${y}-${mo}-${da}T${h}:${mi}`;
};
let startDay: Date | null = null;
let endDay: Date | null = null;
let startHM = { h: 9, m: 0 };
let endHM = { h: 18, m: 0 };
const rangeM = normalized.match(/从?(\d{1,2})[月./-](\d{1,2})[日号]?[到至—\-–](\d{1,2})[月./-]?(\d{1,2})[日号]?/);
if (rangeM) {
const s = parseDateStr(rangeM, 1);
if (rangeM[3] && rangeM[3].length <= 2 && rangeM[4] && rangeM[4].length <= 2) {
const eMo = parseInt(rangeM[3]!, 10);
const eDa = parseInt(rangeM[4]!, 10);
if (!Number.isNaN(eMo) && eMo >= 1 && eMo <= 12 && !Number.isNaN(eDa) && eDa >= 1 && eDa <= 31) {
endDay = new Date(thisYear, eMo - 1, eDa, 18, 0);
} else if (!Number.isNaN(eDa) && eDa >= 1 && eDa <= 31 && s) {
endDay = new Date(thisYear, s.getMonth(), eDa, 18, 0);
}
}
if (s) startDay = s;
}
if (!startDay) {
const singleM = normalized.match(/(\d{1,2})[月./-](\d{1,2})[日号]?/);
if (singleM) {
const s = parseDateStr(singleM, 1);
if (s) {
startDay = s;
const dayUnitM = normalized.match(/(\d+\.?\d*)\s*[天日]/);
if (dayUnitM?.[1]) {
const days = parseFloat(dayUnitM[1]);
if (days > 1) endDay = new Date(s.getFullYear(), s.getMonth(), s.getDate() + Math.ceil(days) - 1, 18, 0);
else endDay = new Date(s.getFullYear(), s.getMonth(), s.getDate(), 18, 0);
} else {
endDay = new Date(s.getFullYear(), s.getMonth(), s.getDate(), 18, 0);
}
}
}
}
const hourM = normalized.match(/(\d+\.?\d*)\s*小时/);
if (hourM?.[1]) {
durationHours = parseFloat(hourM[1]);
if (startDay && !endDay) {
endDay = new Date(startDay.getTime() + durationHours * 3600000);
}
}
const dayM = normalized.match(/(\d+\.?\d*)\s*[天日]/);
if (dayM?.[1] && !hourM) {
const days = parseFloat(dayM[1]);
durationHours = days * 8;
if (startDay && !endDay) {
endDay = new Date(startDay.getFullYear(), startDay.getMonth(), startDay.getDate() + Math.ceil(days) - 1, 18, 0);
}
}
if (startDay) {
if (durationHours > 0 && durationHours <= 8 && !endDay) {
endDay = new Date(startDay.getTime() + durationHours * 3600000);
}
startTime = fmtDt(startDay, startHM.h, startHM.m);
}
if (endDay) {
if (hourM && durationHours <= 8) {
endHM = { h: 9 + Math.floor(durationHours), m: (durationHours % 1) * 60 };
} else if (!hourM && durationHours > 0 && durationHours <= 8) {
endHM = { h: 9 + Math.floor(durationHours), m: 0 };
}
endTime = fmtDt(endDay, endHM.h, endHM.m);
}
if (startTime && endTime) {
durationHours = durationHours || calculateDurationHours(startTime, endTime);
}
if (!leaveType && !startTime) return null;
return {
leaveType,
startTime,
endTime,
durationHours,
};
};
const createLeaveFormData = (content?: string, extractedInfo?: ExtractedLeaveInfo | null): LeaveRequestFormData => {
const now = new Date();
const oneHourLater = new Date(now.getTime() + 60 * 60 * 1000);
const startTime = formatDateTime(now);
const endTime = formatDateTime(oneHourLater);
const initialLeaveType = extractLeaveTypeFromIntent(content || '');
const defaultStart = formatDateTime(now);
const defaultEnd = formatDateTime(oneHourLater);
const initialLeaveType = extractedInfo?.leaveType || extractLeaveTypeFromIntent(content || '');
const startTime = extractedInfo?.startTime || defaultStart;
const endTime = extractedInfo?.endTime || defaultEnd;
const durationHours = extractedInfo?.durationHours || calculateDurationHours(startTime, endTime);
return {
applicantName: currentUserDisplayName.value,
employeeId: currentUserEmployeeId.value,
@@ -976,7 +1096,7 @@ const createLeaveFormData = (content?: string): LeaveRequestFormData => {
leaveType: initialLeaveType,
startTime,
endTime,
durationHours: calculateDurationHours(startTime, endTime),
durationHours,
isOutOfOffice: 1,
isWorkInjury: 1,
};
@@ -995,11 +1115,10 @@ const getLeaveIntentNormalized = (content: string) => (content || '').replace(/\
const isStrongLeaveIntent = (content: string) => {
const normalized = getLeaveIntentNormalized(content);
// 弱意图(咨询流程/步骤)应走正常问答,不触发表单分流。
const weakConsultationIntent = /(请假流程|请假怎么走|请假步骤|请假如何申请|请假如何走流程|请假怎么办|请假需要什么|请假规定)/;
if (weakConsultationIntent.test(normalized)) return false;
if (/^(请假|休假|年假|事假|病假|调休)$/.test(normalized)) return true;
return /(我要请|申请请|发起请|请假申请|我要休|申请休|想请|帮我请|代我请|提交请)/.test(normalized);
if (/^(请假|休假|年假|事假|病假|调休|休年假|请事假|请病假|请年假)$/.test(normalized)) return true;
return /(我要请|申请请|发起请|请假申请|我要休|申请休|想请|帮我请|代我请|提交请|帮我申请|我要申请|想申请|申请.*假|请.*假|休.*假)/.test(normalized);
};
const saveLocalMessageToBackend = async (msg: any, userQuery: string = '') => {
@@ -1063,7 +1182,8 @@ const checkLeaveBalance = async (leaveTypeCode: string): Promise<{
};
const startLocalLeaveFlow = async (content: string) => {
const initialLeaveType = extractLeaveTypeFromIntent(content);
const extractedInfo = extractLeaveInfoFromIntent(content);
const initialLeaveType = extractedInfo?.leaveType || extractLeaveTypeFromIntent(content);
if (initialLeaveType && NEED_BALANCE_CHECK_TYPES.has(initialLeaveType)) {
messages.value.push({ role: 'user', content, type: 'text' });
@@ -1111,7 +1231,7 @@ const startLocalLeaveFlow = async (content: string) => {
const formId = newLocalMessageId('leave-form');
const payload: LeaveFormPayload = {
formId,
form: createLeaveFormData(content),
form: createLeaveFormData(content, extractedInfo),
submitting: false,
confirmationGenerated: false,
};
+86 -78
View File
@@ -773,6 +773,12 @@ const handleRegister = async () => {
};
const activeSidebarItem = ref<'profile' | 'applications' | 'feedback' | 'updates' | 'knowledge_base' | 'schedule_runs' | 'history'>('applications');
const workspaceSidebarNavActive =
'bg-brand-50 text-brand-700 shadow-sm dark:bg-brand-500/15 dark:text-brand-300 dark:shadow-none dark:ring-1 dark:ring-inset dark:ring-brand-500/25';
const workspaceSidebarNavInactive =
'text-slate-600 hover:bg-slate-50 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-800/80 dark:hover:text-slate-200';
const wsScheduleFilterInputClass =
'rounded-lg border border-slate-200 bg-white px-2 py-1.5 text-xs text-slate-900 outline-none transition-colors placeholder:text-slate-400 focus:border-brand-400 focus:ring-1 focus:ring-brand-500/20 dark:border-slate-700 dark:bg-slate-950/70 dark:text-slate-200 dark:placeholder:text-slate-500 dark:[color-scheme:dark]';
const isProfileLoading = ref(false);
const isProfileSaving = ref(false);
const isProfileEditing = ref(false);
@@ -1060,13 +1066,13 @@ const wsScheduleStatusOptions = [
const getWsScheduleStatusBadge = (status: string) => {
const map: Record<string, { cls: string; label: string }> = {
success: { cls: 'bg-emerald-100 text-emerald-700', label: t('workspace.schedule.status.success') },
partial_failed: { cls: 'bg-blue-100 text-blue-700', label: t('workspace.schedule.status.partialFailed') },
failed: { cls: 'bg-rose-100 text-rose-700', label: t('workspace.schedule.status.failed') },
running: { cls: 'bg-amber-100 text-amber-700', label: t('workspace.schedule.status.running') },
queued: { cls: 'bg-slate-100 text-slate-600', label: t('workspace.schedule.status.queued') },
success: { cls: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400', label: t('workspace.schedule.status.success') },
partial_failed: { cls: 'bg-blue-100 text-blue-700 dark:bg-blue-500/15 dark:text-blue-400', label: t('workspace.schedule.status.partialFailed') },
failed: { cls: 'bg-rose-100 text-rose-700 dark:bg-rose-500/15 dark:text-rose-400', label: t('workspace.schedule.status.failed') },
running: { cls: 'bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-400', label: t('workspace.schedule.status.running') },
queued: { cls: 'bg-slate-100 text-slate-600 dark:bg-slate-700/80 dark:text-slate-300', label: t('workspace.schedule.status.queued') },
};
return map[status] || { cls: 'bg-slate-100 text-slate-600', label: status };
return map[status] || { cls: 'bg-slate-100 text-slate-600 dark:bg-slate-700/80 dark:text-slate-300', label: status };
};
const formatDateTime = (iso?: string | null) => {
@@ -1553,15 +1559,15 @@ onMounted(async () => {
</header>
<div class="grid min-h-screen gap-0 lg:grid-cols-[232px_minmax(0,1fr)]">
<aside v-if="!isMobile" class="lg:sticky lg:top-0 lg:h-screen">
<div class="flex h-full flex-col border-r border-slate-200 bg-white px-5 py-6 shadow-sm">
<div class="border-b border-slate-100 pb-6">
<div class="flex h-full flex-col border-r border-slate-200 bg-white px-5 py-6 shadow-sm dark:border-slate-800 dark:bg-slate-900">
<div class="border-b border-slate-100 pb-6 dark:border-slate-800">
<div class="flex items-center gap-3">
<div class="flex h-12 w-12 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-500 via-brand-600 to-purple-600 text-white shadow-lg shadow-brand-500/25">
<Bot class="h-6 w-6" />
</div>
<div class="min-w-0">
<div class="text-2xl font-extrabold tracking-tight text-[#14213d]">{{ $t('workspace.brandTitle') }}</div>
<div class="truncate text-xs font-medium text-slate-400">
<div class="text-2xl font-extrabold tracking-tight text-[#14213d] dark:text-slate-100">{{ $t('workspace.brandTitle') }}</div>
<div class="truncate text-xs font-medium text-slate-400 dark:text-slate-500">
{{ currentUser?.username }} / {{ currentUser?.role }}
</div>
</div>
@@ -1573,7 +1579,7 @@ onMounted(async () => {
<button
@click="navigateToProfile"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'profile' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'profile' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<User class="h-4 w-4" />
<span>{{ $t('workspace.nav.profile') }}</span>
@@ -1581,7 +1587,8 @@ onMounted(async () => {
<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"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="workspaceSidebarNavInactive"
>
<Settings class="h-4 w-4" />
<span>{{ $t('workspace.nav.admin') }}</span>
@@ -1589,7 +1596,7 @@ onMounted(async () => {
<button
@click="navigateToApplications"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'applications' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'applications' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<LayoutGrid class="h-4 w-4" />
<span>{{ $t('workspace.nav.applications') }}</span>
@@ -1597,7 +1604,7 @@ onMounted(async () => {
<button
@click="navigateToKnowledgeBase"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'knowledge_base' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'knowledge_base' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<FileText class="h-4 w-4" />
<span>{{ $t('workspace.nav.knowledgeBase') }}</span>
@@ -1605,7 +1612,7 @@ onMounted(async () => {
<button
@click="navigateToScheduleRuns"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'schedule_runs' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'schedule_runs' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<Clock class="h-4 w-4" />
<span>{{ $t('workspace.nav.scheduleRuns') }}</span>
@@ -1613,7 +1620,7 @@ onMounted(async () => {
<button
@click="openGeneralFeedback"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'feedback' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'feedback' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<Edit class="h-4 w-4" />
<span>{{ $t('workspace.nav.feedback') }}</span>
@@ -1621,7 +1628,7 @@ onMounted(async () => {
<button
@click="navigateToUpdates"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'updates' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'updates' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<Megaphone class="h-4 w-4" />
<span>{{ $t('workspace.nav.updates') }}</span>
@@ -1629,18 +1636,19 @@ onMounted(async () => {
</div>
</div>
<div class="border-t border-slate-100 pt-6">
<div class="border-t border-slate-100 pt-6 dark:border-slate-800">
<div class="space-y-2">
<button
@click="navigateToGeneralChat"
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"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="workspaceSidebarNavInactive"
>
<Bot class="h-4 w-4" />
<span>{{ $t('workspace.nav.backToChat') }}</span>
</button>
<button
@click="handleLogout"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-red-500 transition-all hover:bg-red-50 hover:text-red-600"
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 dark:text-red-400 dark:hover:bg-red-950/40 dark:hover:text-red-300"
>
<LogOut class="h-4 w-4" />
<span>{{ $t('workspace.nav.logout') }}</span>
@@ -1650,7 +1658,7 @@ onMounted(async () => {
</div>
</aside>
<section class="min-w-0 space-y-6 bg-gray-50 px-4 py-6 md:px-6 md:py-8 lg:px-8" :class="isMobile ? 'pb-20' : ''">
<section class="min-w-0 space-y-6 bg-gray-50 px-4 py-6 dark:bg-slate-950 md:px-6 md:py-8 lg:px-8" :class="isMobile ? 'pb-20' : ''">
<template v-if="activeSidebarItem === 'history'">
<div class="space-y-3">
<div v-if="isLoadingHistories" class="flex justify-center py-20">
@@ -1876,99 +1884,99 @@ onMounted(async () => {
<template v-else-if="activeSidebarItem === 'schedule_runs'">
<div class="space-y-5 animate-fade-in-up">
<div class="flex items-center justify-between">
<h2 class="text-2xl font-bold text-slate-900">{{ $t('workspace.schedule.title') }}</h2>
<h2 class="text-2xl font-bold text-slate-900 dark:text-slate-100">{{ $t('workspace.schedule.title') }}</h2>
<button
@click="loadWorkspaceScheduleRuns"
class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50"
class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-800"
>
<RefreshCw class="h-3.5 w-3.5" />
{{ $t('workspace.schedule.refresh') }}
</button>
</div>
<div class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200 bg-slate-50/40 px-4 py-3">
<div class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200/80 bg-white/70 px-4 py-3 shadow-sm dark:border-slate-800 dark:bg-slate-900/20 dark:shadow-none">
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.name') }}</label>
<input type="text" v-model="wsScheduleNameFilter" :placeholder="$t('workspace.schedule.filters.namePlaceholder')" class="!w-[150px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
<label class="mb-1 block text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('workspace.schedule.filters.name') }}</label>
<input type="text" v-model="wsScheduleNameFilter" :placeholder="$t('workspace.schedule.filters.namePlaceholder')" :class="['!w-[150px]', wsScheduleFilterInputClass]" />
</div>
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.start') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedAfter" class="!w-[170px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
<label class="mb-1 block text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('workspace.schedule.filters.start') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedAfter" :class="['!w-[170px]', wsScheduleFilterInputClass]" />
</div>
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.end') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedBefore" class="!w-[170px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
<label class="mb-1 block text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('workspace.schedule.filters.end') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedBefore" :class="['!w-[170px]', wsScheduleFilterInputClass]" />
</div>
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.status') }}</label>
<select v-model="wsScheduleStatusFilter" class="!w-[120px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white">
<label class="mb-1 block text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('workspace.schedule.filters.status') }}</label>
<select v-model="wsScheduleStatusFilter" :class="['!w-[120px]', wsScheduleFilterInputClass]">
<option v-for="o in wsScheduleStatusOptions" :key="o.value" :value="o.value">{{ o.label }}</option>
</select>
</div>
<button
@click="loadWorkspaceScheduleRuns"
class="inline-flex items-center gap-1 rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-brand-700"
class="inline-flex items-center gap-1 rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-brand-700 dark:hover:bg-brand-500"
>
<Search class="h-3.5 w-3.5" />
{{ $t('workspace.schedule.search') }}
</button>
<button
@click="resetWsScheduleFilters"
class="rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50"
class="rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:bg-transparent dark:text-slate-300 dark:hover:bg-slate-800/60"
>
{{ $t('workspace.schedule.reset') }}
</button>
</div>
<div v-if="workspaceScheduleLoading" class="py-10 text-center text-sm text-slate-400">{{ $t('workspace.schedule.loading') }}</div>
<div v-else-if="workspaceScheduleRuns.length === 0" class="py-10 text-center text-sm text-slate-400">{{ $t('workspace.schedule.empty') }}</div>
<div v-else class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<div v-if="workspaceScheduleLoading" class="rounded-2xl border border-dashed border-slate-200 py-10 text-center text-sm text-slate-400 dark:border-slate-800 dark:text-slate-500">{{ $t('workspace.schedule.loading') }}</div>
<div v-else-if="workspaceScheduleRuns.length === 0" class="rounded-2xl border border-dashed border-slate-200 py-10 text-center text-sm text-slate-400 dark:border-slate-800 dark:text-slate-500">{{ $t('workspace.schedule.empty') }}</div>
<div v-else class="overflow-hidden rounded-2xl border border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-800">
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="border-b border-slate-100 bg-slate-50/60">
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.name') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.runNo') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.triggerType') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.start') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.end') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.duration') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.status') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.total') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.success') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.failed') }}</th>
<tr class="border-b border-slate-100 bg-slate-50/60 dark:border-slate-700 dark:bg-slate-900/60">
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.name') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.runNo') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.triggerType') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.start') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.end') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.duration') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.status') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.total') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.success') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.failed') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.detail') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.detail') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="r in workspaceScheduleRuns" :key="r.id" class="border-b border-slate-50 transition-colors hover:bg-slate-50/50">
<td class="px-4 py-3 font-medium text-slate-900">{{ r.schedule_name || '-' }}</td>
<td class="px-4 py-3 text-slate-500 font-mono text-xs">{{ r.run_no }}</td>
<td class="px-4 py-3 text-slate-500">{{ r.trigger_type === 'manual' ? $t('workspace.schedule.trigger.manual') : r.trigger_type === 'test' ? $t('workspace.schedule.trigger.test') : $t('workspace.schedule.trigger.timed') }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ formatDateTime(r.started_at) }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ formatDateTime(r.finished_at) }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ r.duration_ms != null ? (r.duration_ms >= 1000 ? (r.duration_ms / 1000).toFixed(1) + 's' : r.duration_ms + 'ms') : '-' }}</td>
<tr v-for="r in workspaceScheduleRuns" :key="r.id" class="border-b border-slate-50 transition-colors hover:bg-slate-50/50 dark:border-slate-700/80 dark:hover:bg-slate-700/40">
<td class="px-4 py-3 font-medium text-slate-900 dark:text-slate-100">{{ r.schedule_name || '-' }}</td>
<td class="px-4 py-3 font-mono text-xs text-slate-500 dark:text-slate-400">{{ r.run_no }}</td>
<td class="px-4 py-3 text-slate-500 dark:text-slate-400">{{ r.trigger_type === 'manual' ? $t('workspace.schedule.trigger.manual') : r.trigger_type === 'test' ? $t('workspace.schedule.trigger.test') : $t('workspace.schedule.trigger.timed') }}</td>
<td class="whitespace-nowrap px-4 py-3 text-slate-500 dark:text-slate-400">{{ formatDateTime(r.started_at) }}</td>
<td class="whitespace-nowrap px-4 py-3 text-slate-500 dark:text-slate-400">{{ formatDateTime(r.finished_at) }}</td>
<td class="whitespace-nowrap px-4 py-3 text-slate-500 dark:text-slate-400">{{ r.duration_ms != null ? (r.duration_ms >= 1000 ? (r.duration_ms / 1000).toFixed(1) + 's' : r.duration_ms + 'ms') : '-' }}</td>
<td class="px-4 py-3">
<span class="inline-flex shrink-0 items-center whitespace-nowrap rounded-full px-2.5 py-1 text-xs font-semibold" :class="getWsScheduleStatusBadge(r.status).cls">
{{ getWsScheduleStatusBadge(r.status).label }}
</span>
<span v-if="r.error_message && r.error_message !== '无待处理数据'" class="ml-1 text-xs text-slate-400" :title="r.error_message">...</span>
<span v-else-if="r.error_message === '无待处理数据'" class="ml-1 text-xs text-slate-400">({{ $t('workspace.schedule.noPendingData') }})</span>
<span v-if="r.error_message && r.error_message !== '无待处理数据'" class="ml-1 text-xs text-slate-400 dark:text-slate-500" :title="r.error_message">...</span>
<span v-else-if="r.error_message === '无待处理数据'" class="ml-1 text-xs text-slate-400 dark:text-slate-500">({{ $t('workspace.schedule.noPendingData') }})</span>
</td>
<td class="px-4 py-3 text-slate-500">{{ r.total_count || 0 }}</td>
<td class="px-4 py-3 text-emerald-600 font-medium">{{ r.success_count ?? 0 }}</td>
<td class="px-4 py-3 text-rose-600 font-medium">{{ r.failed_count ?? 0 }}</td>
<td class="px-4 py-3 text-slate-500 dark:text-slate-400">{{ r.total_count || 0 }}</td>
<td class="px-4 py-3 font-medium text-emerald-600 dark:text-emerald-400">{{ r.success_count ?? 0 }}</td>
<td class="px-4 py-3 font-medium text-rose-600 dark:text-rose-400">{{ r.failed_count ?? 0 }}</td>
<td class="px-4 py-3">
<a
v-if="r.total_count > 0 && r.excel_file_name"
href="#"
@click.prevent="downloadWsScheduleExcel(r.id)"
class="inline-flex items-center gap-1 rounded-lg border border-slate-200 px-2 py-1 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50"
class="inline-flex items-center gap-1 rounded-lg border border-slate-200 px-2 py-1 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:border-slate-500 dark:hover:bg-slate-700/80"
>
<Download class="h-3 w-3" />
{{ $t('workspace.schedule.download') }}
</a>
<span v-else class="text-xs text-slate-300">-</span>
<span v-else class="text-xs text-slate-300 dark:text-slate-600">-</span>
</td>
</tr>
</tbody>
@@ -2002,18 +2010,18 @@ onMounted(async () => {
<div class="flex justify-between items-center mb-6">
<h2 class="text-lg md:text-xl font-semibold text-[#1b2b49] dark:text-slate-100 flex items-center gap-2.5 cursor-pointer select-none" @click="toggleSectionCollapse(section)">
<div class="p-2 rounded-lg" :class="{
'bg-emerald-50 text-emerald-600': section.id === 'announcements',
'bg-yellow-50 text-yellow-600': section.id === 'favorites',
'bg-brand-50 text-brand-600': section.id === 'quick_questions',
'bg-purple-50 text-purple-600': section.id === 'embedded',
'bg-slate-100 text-slate-600': section.id === 'all_agents'
'bg-emerald-50 text-emerald-600 dark:bg-emerald-500/15 dark:text-emerald-400': section.id === 'announcements',
'bg-yellow-50 text-yellow-600 dark:bg-yellow-500/15 dark:text-yellow-400': section.id === 'favorites',
'bg-brand-50 text-brand-600 dark:bg-brand-500/15 dark:text-brand-300': section.id === 'quick_questions',
'bg-purple-50 text-purple-600 dark:bg-purple-500/15 dark:text-purple-400': section.id === 'embedded',
'bg-slate-100 text-slate-600 dark:bg-slate-700/80 dark:text-slate-300': section.id === 'all_agents'
}">
<component :is="section.id === 'announcements' ? Megaphone : (section.id === 'favorites' ? Star : (section.id === 'embedded' ? Bot : LayoutGrid))" class="w-5 h-5" />
</div>
{{ $t(getSectionTitleKey(section.id)) }}
<component :is="section.collapsed ? ChevronDown : ChevronUp" class="w-4 h-4 text-slate-400" />
</h2>
<button v-if="section.id === 'quick_questions' && !isAddingQuestion && !section.collapsed" @click="openAddQuestionForm" class="btn-ghost text-sm text-brand-600 hover:text-brand-700 hover:bg-brand-50">
<button v-if="section.id === 'quick_questions' && !isAddingQuestion && !section.collapsed" @click="openAddQuestionForm" class="btn-ghost text-sm text-brand-600 hover:text-brand-700 hover:bg-brand-50 dark:text-brand-300 dark:hover:bg-brand-500/15">
<Plus class="w-4 h-4" /> {{ $t('workspace.quickQuestions.add') }}
</button>
</div>
@@ -2030,21 +2038,21 @@ onMounted(async () => {
@click="openAnnouncement(ann)"
>
<div class="flex items-start justify-between gap-3 mb-2">
<h4 class="font-bold text-slate-900 line-clamp-2 group-hover:text-emerald-700 transition-colors">{{ ann.title }}</h4>
<span class="text-[10px] font-semibold text-emerald-700 bg-emerald-50 px-2 py-0.5 rounded-full whitespace-nowrap">{{ new Date(ann.created_at).toLocaleDateString() }}</span>
<h4 class="font-bold text-slate-900 dark:text-slate-100 line-clamp-2 group-hover:text-emerald-700 dark:group-hover:text-emerald-400 transition-colors">{{ ann.title }}</h4>
<span class="text-[10px] font-semibold text-emerald-700 bg-emerald-50 dark:text-emerald-300 dark:bg-emerald-500/15 px-2 py-0.5 rounded-full whitespace-nowrap">{{ new Date(ann.created_at).toLocaleDateString() }}</span>
</div>
<p class="text-sm text-slate-600 line-clamp-3">{{ ann.content }}</p>
<p class="text-sm text-slate-600 dark:text-slate-400 line-clamp-3">{{ ann.content }}</p>
</div>
</div>
</div>
<!-- Content: Favorites -->
<div v-if="section.id === 'favorites'">
<div v-if="favoriteAgents.length === 0" class="text-slate-400 text-sm italic py-4 bg-slate-50 rounded-xl text-center border border-dashed border-slate-200">{{ $t('workspace.noFavorites') }}</div>
<div v-if="favoriteAgents.length === 0" class="text-slate-400 text-sm italic py-4 bg-slate-50 rounded-xl text-center border border-dashed border-slate-200 dark:bg-slate-800/50 dark:border-slate-700">{{ $t('workspace.noFavorites') }}</div>
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 sm:gap-6">
<div v-for="agent in favoriteAgents" :key="agent.id" @click="navigateToChat(agent.id)"
class="card p-4 sm:p-5 cursor-pointer relative group/card hover:-translate-y-1 hover:shadow-lg hover:border-brand-200 bg-gradient-to-br from-white to-slate-50/50">
<div class="w-8 h-8 sm:w-12 sm:h-12 bg-brand-100 rounded-xl flex items-center justify-center text-brand-600 mb-3 sm:mb-4 shadow-sm group-hover/card:scale-110 transition-transform duration-300">
class="card p-4 sm:p-5 cursor-pointer relative group/card hover:-translate-y-1 hover:shadow-lg hover:border-brand-200 dark:hover:border-brand-600 bg-gradient-to-br from-white to-slate-50/50 dark:from-slate-800 dark:to-slate-800/90">
<div class="w-8 h-8 sm:w-12 sm:h-12 bg-brand-100 dark:bg-brand-500/15 rounded-xl flex items-center justify-center text-brand-600 dark:text-brand-300 mb-3 sm:mb-4 shadow-sm dark:shadow-none group-hover/card:scale-110 transition-transform duration-300">
<img v-if="agent.icon_url" :src="agent.icon_url" class="w-5 h-5 sm:w-7 sm:h-7" />
<Bot v-else class="w-5 h-5 sm:w-7 sm:h-7" />
</div>
@@ -2120,7 +2128,7 @@ onMounted(async () => {
<div v-for="agent in embeddedAgents" :key="agent.id" class="border border-slate-200 dark:border-slate-700 rounded-2xl overflow-hidden bg-white dark:bg-slate-900 shadow-sm hover:shadow-md transition-shadow h-[500px] flex flex-col">
<div class="bg-slate-50 dark:bg-slate-800 px-4 py-3 text-sm font-bold text-slate-700 dark:text-slate-200 flex justify-between items-center border-b border-slate-100 dark:border-slate-700">
<span>{{ agent.name }}</span>
<a :href="`/chat/${agent.id}`" target="_blank" class="text-brand-600 hover:text-brand-700 hover:bg-brand-50 p-1.5 rounded-lg transition-colors"><ExternalLink class="w-4 h-4"/></a>
<a :href="`/chat/${agent.id}`" target="_blank" class="text-brand-600 hover:text-brand-700 hover:bg-brand-50 dark:text-brand-300 dark:hover:bg-brand-500/15 p-1.5 rounded-lg transition-colors"><ExternalLink class="w-4 h-4"/></a>
</div>
<iframe v-if="agent.iframe_url" :src="agent.iframe_url" class="w-full flex-1 border-none bg-white dark:bg-slate-900"></iframe>
<div v-else class="flex items-center justify-center flex-1 text-slate-400 bg-slate-50/50">{{ $t('workspace.embedded.noUrl') }}</div>
@@ -2136,9 +2144,9 @@ onMounted(async () => {
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 sm:gap-6">
<div v-for="agent in otherAgents" :key="agent.id"
@click="navigateToChat(agent.id)"
class="card card-mobile-compact cursor-pointer relative group/card hover:-translate-y-1 hover:border-brand-200">
class="card card-mobile-compact cursor-pointer relative group/card hover:-translate-y-1 hover:border-brand-200 dark:hover:border-brand-600">
<div class="flex items-start justify-between mb-2 sm:mb-4">
<div class="w-8 h-8 sm:w-10 sm:h-10 bg-slate-50 rounded-xl flex items-center justify-center text-slate-500 group-hover/card:bg-brand-50 group-hover/card:text-brand-600 transition-colors">
<div class="w-8 h-8 sm:w-10 sm:h-10 bg-slate-50 dark:bg-slate-700/80 rounded-xl flex items-center justify-center text-slate-500 dark:text-slate-300 group-hover/card:bg-brand-50 group-hover/card:text-brand-600 dark:group-hover/card:bg-brand-500/15 dark:group-hover/card:text-brand-300 transition-colors">
<img v-if="agent.icon_url" :src="agent.icon_url" class="w-4 h-4 sm:w-6 sm:h-6" />
<Bot v-else class="w-4 h-4 sm:w-6 sm:h-6" />
</div>
-39
View File
@@ -1,39 +0,0 @@
#!/bin/bash
set -e
# Configuration
SERVER_USER="ai30"
SERVER_IP="192.168.100.230"
REMOTE_DIR="/data/ai-platform/hxops"
BACKEND_CONTAINER="hxops-backend"
echo "=== Starting Full Server Sync & Update ==="
echo "Target: $SERVER_USER@$SERVER_IP"
# 1. Sync Backend Code
echo ">>> [1/4] Syncing backend code..."
# Exclude venv, __pycache__, local db, etc.
rsync -avz --exclude 'venv' --exclude '__pycache__' --exclude '*.pyc' --exclude 'local_test.db' \
backend/ $SERVER_USER@$SERVER_IP:$REMOTE_DIR/backend/
# 2. Sync Frontend Build
echo ">>> [2/4] Syncing frontend build..."
rsync -avz frontend/dist/ $SERVER_USER@$SERVER_IP:$REMOTE_DIR/frontend/dist/
# 3. Restart Services
echo ">>> [3/4] Restarting services..."
ssh $SERVER_USER@$SERVER_IP "cd $REMOTE_DIR && \
docker-compose down && \
docker-compose up -d --build"
# 4. Update Database Data
echo ">>> [4/4] Updating database data (Password & Seeds)..."
# Ensure we run seed_production.py to update admin password to Hxit@54321
ssh $SERVER_USER@$SERVER_IP "cd $REMOTE_DIR && \
echo 'Running seed script...' && \
docker-compose exec -T $BACKEND_CONTAINER python3 seed_production.py"
echo "=== Sync & Update Complete! ==="
echo "You can now login at http://$SERVER_IP:8890"
echo "Username: admin"
echo "Password: Hxit@54321"
-46
View File
@@ -1,46 +0,0 @@
#!/bin/bash
set -e
# Configuration
# Since "ssh ai30" works directly (via ~/.ssh/config or keys), we use it directly.
# SERVER_USER and SERVER_IP are implicit in the "ai30" alias.
SERVER_ALIAS="ai30"
REMOTE_DIR="/data/ai-platform/hxops"
BACKEND_CONTAINER="hxops-backend"
echo "=== Starting Full Server Sync & Update ==="
echo "Target: $SERVER_ALIAS (Using SSH alias)"
# 1. Sync Backend Code
echo ">>> [1/4] Syncing backend code..."
# Exclude venv, __pycache__, local db, etc.
rsync -avz --exclude 'venv' --exclude '__pycache__' --exclude '*.pyc' --exclude 'local_test.db' \
backend/ $SERVER_ALIAS:$REMOTE_DIR/backend/
# 2. Sync Frontend Build
echo ">>> [2/4] Syncing frontend build..."
rsync -avz frontend/dist/ $SERVER_ALIAS:$REMOTE_DIR/frontend/dist/
# 3. Restart Services
echo ">>> [3/4] Restarting services..."
ssh $SERVER_ALIAS "cd $REMOTE_DIR && \
docker compose down && \
docker compose up -d --build"
# 4. Update Database Data
echo ">>> [4/4] Updating database data (Password & Seeds)..."
# Ensure we run seed_production.py to update admin password to Hxit@54321
# We use 'flask db upgrade' but if it fails due to existing tables, we proceed to seeding.
# The '|| true' allows the script to continue if migration fails.
ssh $SERVER_ALIAS "cd $REMOTE_DIR && \
echo 'Checking/Creating database...' && \
docker compose exec -T $BACKEND_CONTAINER python3 init_db.py && \
echo 'Running migrations (ignoring errors if tables exist)...' && \
docker compose exec -T $BACKEND_CONTAINER flask db upgrade || echo 'Migration step had errors, possibly existing tables. Continuing...' && \
echo 'Running seed script...' && \
docker compose exec -T $BACKEND_CONTAINER python3 seed_production.py"
echo "=== Sync & Update Complete! ==="
echo "You can now login at http://192.168.100.230:8890"
echo "Username: admin"
echo "Password: Hxit@54321"