refactor: 前端架构重构 - 提取 CSS 和逻辑到独立模块
前端重构: - 删除旧的大体积 Vue 组件(HomeView, FileManage, TextSplit 等) - 删除旧的 composables(useFormatters, useModels, useProjects) - 新增 core/, page-logic/, pages/, shared/ 模块化目录结构 - 提取 CSS 到 styles/pages/ 目录 - 添加全局样式 variables.css 和 common.css 后端 API 更新: - chunks: 语义分割 API 增强 - files: 文件处理 API 更新 - models: 模型管理 API 更新 - questions: 问答管理 API 更新 - database: 数据库连接优化 - semantic_embedding: 语义嵌入服务优化 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
151
.daily-work-cache.json
Normal file
151
.daily-work-cache.json
Normal file
@@ -0,0 +1,151 @@
|
||||
{
|
||||
"date": "2026-03-17",
|
||||
"project": "YG-Datasets",
|
||||
"projectPath": "/data/code/YG-Datasets",
|
||||
"entries": [
|
||||
{
|
||||
"time": "17:28",
|
||||
"type": "feature",
|
||||
"title": "后端核心架构模块",
|
||||
"files": ["backend/app/core/auth.py", "backend/app/core/crud.py", "backend/app/core/exceptions.py", "backend/app/core/logging.py"],
|
||||
"description": "添加认证模块、CRUD基础操作、异常处理、日志模块",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:28",
|
||||
"type": "feature",
|
||||
"title": "后端 API Schemas 定义",
|
||||
"files": ["backend/app/schemas/chunk.py", "backend/app/schemas/dataset.py", "backend/app/schemas/eval.py"],
|
||||
"description": "添加数据结构的 Schema 定义",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:28",
|
||||
"type": "feature",
|
||||
"title": "前端 TypeScript 类型定义和组件",
|
||||
"files": ["frontend/src/api/index.ts", "frontend/src/components/", "frontend/src/types/"],
|
||||
"description": "添加 TypeScript API 客户端和组件",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:29",
|
||||
"type": "feature",
|
||||
"title": "前端页面功能和 UI 优化",
|
||||
"files": ["frontend/src/views/ModelSettingsView.vue", "frontend/src/views/HomeView.vue"],
|
||||
"description": "添加模型配置页面,优化项目列表和删除功能",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:29",
|
||||
"type": "change",
|
||||
"title": "项目配置文件",
|
||||
"files": ["backend/pyproject.toml", "frontend/tsconfig.json"],
|
||||
"description": "添加项目配置文件",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:29",
|
||||
"type": "change",
|
||||
"title": "一键启动脚本",
|
||||
"files": ["start.sh"],
|
||||
"description": "添加一键启动脚本",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:29",
|
||||
"type": "feature",
|
||||
"title": "后端 API 端点实现",
|
||||
"files": ["backend/app/api/v1/projects/__init__.py", "backend/app/api/v1/datasets/__init__.py"],
|
||||
"description": "更新 API 端点实现",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:30",
|
||||
"type": "feature",
|
||||
"title": "后端核心模块和文件处理",
|
||||
"files": ["backend/app/core/config.py", "backend/app/main.py", "backend/app/models/models.py"],
|
||||
"description": "更新核心模块和文件处理器",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:30",
|
||||
"type": "change",
|
||||
"title": "前端依赖和路由配置",
|
||||
"files": ["frontend/package.json", "frontend/src/router/index.js", "frontend/vite.config.js"],
|
||||
"description": "更新依赖和路由配置",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:30",
|
||||
"type": "refactor",
|
||||
"title": "前端 API 客户端重构",
|
||||
"files": ["frontend/src/api/index.js", "frontend/src/api/index.ts"],
|
||||
"description": "用 TypeScript 版本替换 JavaScript API 客户端",
|
||||
"source": "git-commit"
|
||||
},
|
||||
{
|
||||
"time": "17:35",
|
||||
"type": "bugfix",
|
||||
"title": "修复返回按钮白色背景遮挡",
|
||||
"files": ["frontend/src/views/ModelSettingsView.vue"],
|
||||
"description": "修复模型配置页面返回按钮 hover 时白色背景遮挡问题",
|
||||
"source": "manual"
|
||||
},
|
||||
{
|
||||
"time": "17:40",
|
||||
"type": "change",
|
||||
"title": "Git 代码推送",
|
||||
"files": [],
|
||||
"description": "推送所有代码更改到远程仓库",
|
||||
"source": "manual"
|
||||
},
|
||||
{
|
||||
"time": "22:40",
|
||||
"type": "bugfix",
|
||||
"title": "修复数据库初始化问题",
|
||||
"files": ["backend/app/core/database.py", "backend/app/main.py"],
|
||||
"description": "修复数据库表未创建的问题,添加 models 导入确保 Base.metadata 包含所有模型",
|
||||
"source": "manual"
|
||||
},
|
||||
{
|
||||
"time": "22:42",
|
||||
"type": "bugfix",
|
||||
"title": "修复 API 响应序列化错误",
|
||||
"files": ["backend/app/api/v1/models/__init__.py", "backend/app/schemas/model.py"],
|
||||
"description": "修复 SQLAlchemy ORM 对象无法序列化为 JSON 的问题,使用 model_validate() 转换",
|
||||
"source": "manual"
|
||||
},
|
||||
{
|
||||
"time": "22:45",
|
||||
"type": "feature",
|
||||
"title": "添加供应商默认 API Base URL",
|
||||
"files": ["frontend/src/views/ModelSettingsView.vue"],
|
||||
"description": "为 MiniMax、GLM、OpenAI Compatible 三个供应商添加默认 API Base URL,自动填充",
|
||||
"source": "manual"
|
||||
},
|
||||
{
|
||||
"time": "22:50",
|
||||
"type": "feature",
|
||||
"title": "实现模型连接测试功能",
|
||||
"files": ["backend/app/api/v1/models/__init__.py", "frontend/src/views/ModelSettingsView.vue", "frontend/src/api/index.ts"],
|
||||
"description": "后端添加测试连接 API,前端调用并显示连接状态(已联通/未联通/待测试)",
|
||||
"source": "manual"
|
||||
},
|
||||
{
|
||||
"time": "22:55",
|
||||
"type": "feature",
|
||||
"title": "创建 git-commit skill",
|
||||
"files": ["/root/.claude/skills/git-commit/SKILL.md"],
|
||||
"description": "创建 Git 分批提交技能,自动分析 git 状态,按功能分组文件,生成规范提交信息",
|
||||
"source": "manual"
|
||||
},
|
||||
{
|
||||
"time": "23:00",
|
||||
"type": "change",
|
||||
"title": "前端 UI 样式调整",
|
||||
"files": ["frontend/src/App.vue", "frontend/src/main.js"],
|
||||
"description": "添加 Ant Design Vue 组件库,调整 Select 组件暗色样式",
|
||||
"source": "manual"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -11,7 +11,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy import select
|
||||
|
||||
from app.api.response import ApiResponse, PaginatedResponse
|
||||
from app.core.database import get_db
|
||||
from app.core.database import get_db, AsyncSessionLocal
|
||||
from app.core.exceptions import NotFoundException
|
||||
from app.core.crud import CRUDBase
|
||||
from app.core.logging import log_success, log_failure
|
||||
@@ -80,6 +80,106 @@ async def process_file_by_type(file: File) -> str:
|
||||
return content
|
||||
|
||||
|
||||
async def process_split_async(
|
||||
project_id: UUID,
|
||||
request: SplitRequest,
|
||||
):
|
||||
"""Run chunk splitting in background."""
|
||||
async with AsyncSessionLocal() as db:
|
||||
file = None
|
||||
try:
|
||||
result = await db.execute(
|
||||
select(File).where(File.id == request.file_id, File.project_id == project_id)
|
||||
)
|
||||
file = result.scalar_one_or_none()
|
||||
if not file:
|
||||
return
|
||||
|
||||
text = await process_file_by_type(file)
|
||||
|
||||
kwargs = {"chunk_size": request.chunk_size, "overlap": request.overlap}
|
||||
if request.method == "custom" and request.separator:
|
||||
kwargs["separator"] = request.separator
|
||||
|
||||
if request.method == "semantic_embedding":
|
||||
kwargs["embedding_provider_type"] = request.embedding_provider or "openai"
|
||||
kwargs["embedding_api_key"] = request.embedding_api_key
|
||||
kwargs["embedding_base_url"] = request.embedding_base_url or "https://api.minimax.chat/v1"
|
||||
kwargs["embedding_model"] = request.embedding_model or "text-embedding-3-small"
|
||||
kwargs["similarity_threshold"] = request.similarity_threshold
|
||||
kwargs["min_chunk_size"] = request.min_chunk_size
|
||||
|
||||
splitter = get_splitter(request.method, **kwargs)
|
||||
split_results = splitter.split(text)
|
||||
|
||||
await db.execute(
|
||||
Chunk.__table__.delete().where(
|
||||
Chunk.project_id == project_id,
|
||||
Chunk.file_id == file.id
|
||||
)
|
||||
)
|
||||
|
||||
chunks = []
|
||||
for chunk_data in split_results:
|
||||
db_chunk = Chunk(
|
||||
project_id=project_id,
|
||||
file_id=file.id,
|
||||
name=chunk_data.get("name", f"Chunk {chunk_data['index'] + 1}"),
|
||||
content=chunk_data["content"],
|
||||
word_count=chunk_data.get("word_count", len(chunk_data["content"].split()))
|
||||
)
|
||||
db.add(db_chunk)
|
||||
chunks.append(db_chunk)
|
||||
|
||||
await db.commit()
|
||||
|
||||
ready_dir = get_project_ready_dir(str(project_id))
|
||||
|
||||
# 删除旧的 markdown 文件(可能有两种命名格式)
|
||||
old_md_files = list(ready_dir.glob(f"{file.id}*.md"))
|
||||
for old_file in old_md_files:
|
||||
try:
|
||||
old_file.unlink()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
md_filename = f"{file.id}.md"
|
||||
md_path = ready_dir / md_filename
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
await loop.run_in_executor(
|
||||
None,
|
||||
lambda: md_path.write_text(text, encoding='utf-8')
|
||||
)
|
||||
|
||||
file.file_path = str(md_path)
|
||||
file.status = "completed"
|
||||
await db.commit()
|
||||
|
||||
log_success(
|
||||
"文件分割完成",
|
||||
project_id=str(project_id),
|
||||
file_id=str(file.id),
|
||||
filename=file.filename,
|
||||
method=request.method,
|
||||
chunk_count=len(chunks),
|
||||
text_length=len(text),
|
||||
ready_path=str(md_path)
|
||||
)
|
||||
except Exception as e:
|
||||
if file:
|
||||
file.status = "failed"
|
||||
await db.commit()
|
||||
|
||||
log_failure(
|
||||
"文件分割失败",
|
||||
project_id=str(project_id),
|
||||
file_id=str(request.file_id),
|
||||
method=request.method,
|
||||
error=str(e)
|
||||
)
|
||||
|
||||
|
||||
@router.post("/split", response_model=ApiResponse)
|
||||
async def split_text(
|
||||
project_id: UUID,
|
||||
@@ -88,7 +188,6 @@ async def split_text(
|
||||
):
|
||||
"""Split text into chunks"""
|
||||
try:
|
||||
# Get file
|
||||
result = await db.execute(
|
||||
select(File).where(File.id == request.file_id, File.project_id == project_id)
|
||||
)
|
||||
@@ -107,81 +206,27 @@ async def split_text(
|
||||
overlap=request.overlap
|
||||
)
|
||||
|
||||
# Process file
|
||||
text = await process_file_by_type(file)
|
||||
|
||||
# Update file status
|
||||
file.status = "processing"
|
||||
await db.commit()
|
||||
|
||||
# Split text
|
||||
kwargs = {"chunk_size": request.chunk_size, "overlap": request.overlap}
|
||||
if request.method == "custom" and request.separator:
|
||||
kwargs["separator"] = request.separator
|
||||
|
||||
# 如果使用 semantic_embedding 方法,传递 embedding 参数
|
||||
if request.method == "semantic_embedding":
|
||||
kwargs["embedding_provider_type"] = request.embedding_provider or "openai"
|
||||
kwargs["embedding_api_key"] = request.embedding_api_key
|
||||
kwargs["embedding_base_url"] = request.embedding_base_url or "https://api.minimax.chat/v1"
|
||||
kwargs["embedding_model"] = request.embedding_model or "text-embedding-3-small"
|
||||
kwargs["similarity_threshold"] = request.similarity_threshold
|
||||
kwargs["min_chunk_size"] = request.min_chunk_size
|
||||
|
||||
splitter = get_splitter(request.method, **kwargs)
|
||||
split_results = splitter.split(text)
|
||||
|
||||
# Save chunks
|
||||
chunks = []
|
||||
for chunk_data in split_results:
|
||||
db_chunk = Chunk(
|
||||
asyncio.create_task(
|
||||
process_split_async(
|
||||
project_id=project_id,
|
||||
file_id=file.id,
|
||||
name=chunk_data.get("name", f"Chunk {chunk_data['index'] + 1}"),
|
||||
content=chunk_data["content"],
|
||||
word_count=chunk_data.get("word_count", len(chunk_data["content"].split()))
|
||||
request=request,
|
||||
)
|
||||
db.add(db_chunk)
|
||||
chunks.append(db_chunk)
|
||||
|
||||
await db.commit()
|
||||
|
||||
# Save processed markdown to ready directory
|
||||
ready_dir = get_project_ready_dir(str(project_id))
|
||||
md_filename = f"{file.id}_{file.filename}.md"
|
||||
md_path = ready_dir / md_filename
|
||||
|
||||
# Write markdown content to file
|
||||
loop = asyncio.get_event_loop()
|
||||
await loop.run_in_executor(
|
||||
None,
|
||||
lambda: md_path.write_text(text, encoding='utf-8')
|
||||
)
|
||||
|
||||
# Update file path to ready location
|
||||
file.file_path = str(md_path)
|
||||
file.status = "completed"
|
||||
await db.commit()
|
||||
|
||||
# 记录成功日志
|
||||
log_success(
|
||||
"文件处理完成",
|
||||
project_id=str(project_id),
|
||||
file_id=str(file.id),
|
||||
filename=file.filename,
|
||||
chunk_count=len(chunks),
|
||||
text_length=len(text),
|
||||
ready_path=str(md_path)
|
||||
)
|
||||
|
||||
return ApiResponse.ok(
|
||||
data={"chunks": len(chunks)},
|
||||
message=f"Successfully split into {len(chunks)} chunks"
|
||||
data={"file_id": str(file.id), "status": file.status},
|
||||
message="Split task started, processing in background"
|
||||
)
|
||||
except Exception as e:
|
||||
# 记录失败日志
|
||||
if 'file' in locals() and file:
|
||||
file.status = "failed"
|
||||
await db.commit()
|
||||
|
||||
log_failure(
|
||||
"文件处理失败",
|
||||
"分割任务启动失败",
|
||||
project_id=str(project_id),
|
||||
file_id=str(request.file_id),
|
||||
error=str(e)
|
||||
|
||||
@@ -9,6 +9,7 @@ from uuid import UUID, uuid4
|
||||
from fastapi import APIRouter, Depends, UploadFile, File, Query
|
||||
from fastapi.responses import FileResponse, PlainTextResponse
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy import select
|
||||
|
||||
from app.api.response import ApiResponse, PaginatedResponse
|
||||
from app.core.config import get_settings
|
||||
@@ -17,6 +18,7 @@ from app.core.exceptions import ValidationException, NotFoundException
|
||||
from app.core.crud import CRUDBase
|
||||
from app.core.logging import log_success, log_failure
|
||||
from app.models.models import File as FileModel
|
||||
from app.models.models import Chunk, Question
|
||||
from app.schemas.file import FileResponse, FileCreateSchema
|
||||
from markitdown import MarkItDown
|
||||
|
||||
@@ -329,11 +331,27 @@ async def delete_file(
|
||||
file_id: UUID,
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""Delete file"""
|
||||
"""Delete file and all related data (markdown, chunks, questions)"""
|
||||
file = await file_crud.get(db, file_id)
|
||||
if not file or file.project_id != project_id:
|
||||
raise NotFoundException("File", file_id)
|
||||
|
||||
# Delete related chunks and their questions (explicit deletion for safety)
|
||||
chunks_result = await db.execute(
|
||||
select(Chunk).where(Chunk.file_id == file_id)
|
||||
)
|
||||
chunks = chunks_result.scalars().all()
|
||||
for chunk in chunks:
|
||||
# Delete questions related to this chunk
|
||||
questions_result = await db.execute(
|
||||
select(Question).where(Question.chunk_id == chunk.id)
|
||||
)
|
||||
questions = questions_result.scalars().all()
|
||||
for question in questions:
|
||||
await db.delete(question)
|
||||
# Delete chunk
|
||||
await db.delete(chunk)
|
||||
|
||||
# Delete file from raw directory
|
||||
if file.file_path and os.path.exists(file.file_path):
|
||||
await asyncio.get_event_loop().run_in_executor(
|
||||
@@ -342,16 +360,27 @@ async def delete_file(
|
||||
file.file_path
|
||||
)
|
||||
|
||||
# Delete file from ready directory (processed markdown)
|
||||
ready_path = Path("/data/code/YG-Datasets/data") / str(project_id) / "ready" / f"{file_id}.md"
|
||||
if ready_path.exists():
|
||||
await asyncio.get_event_loop().run_in_executor(
|
||||
None,
|
||||
os.remove,
|
||||
str(ready_path)
|
||||
)
|
||||
# Delete file from ready directory (processed markdown) - try both naming conventions
|
||||
ready_dir = Path("/data/code/YG-Datasets/data") / str(project_id) / "ready"
|
||||
if ready_dir.exists():
|
||||
# Try file_id.md (from upload process)
|
||||
ready_path = ready_dir / f"{file_id}.md"
|
||||
if ready_path.exists():
|
||||
await asyncio.get_event_loop().run_in_executor(
|
||||
None,
|
||||
os.remove,
|
||||
str(ready_path)
|
||||
)
|
||||
# Try file_id_filename.md (from split process)
|
||||
for md_file in ready_dir.glob(f"{file_id}_*.md"):
|
||||
await asyncio.get_event_loop().run_in_executor(
|
||||
None,
|
||||
os.remove,
|
||||
str(md_file)
|
||||
)
|
||||
|
||||
await file_crud.delete(db, file_id)
|
||||
await db.commit()
|
||||
return ApiResponse.ok(message="File deleted successfully")
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,38 @@ from app.schemas.model import ModelCreate, ModelUpdate, ModelResponse
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
VALID_MODEL_TYPES = {"chat", "vlm", "embedding", "rerank"}
|
||||
|
||||
|
||||
def normalize_model_type(model_type: str | None, model_name: str | None) -> str:
|
||||
"""Normalize model type, with keyword fallback for legacy records."""
|
||||
if model_type in VALID_MODEL_TYPES and model_type != "chat":
|
||||
return model_type
|
||||
|
||||
normalized_name = (model_name or "").strip().lower()
|
||||
|
||||
rerank_keywords = ("rerank", "bce-reranker", "gte-rerank")
|
||||
embedding_keywords = (
|
||||
"embedding",
|
||||
"embed",
|
||||
"text-embedding",
|
||||
"bge-",
|
||||
"bge_m3",
|
||||
"gte-",
|
||||
"m3e",
|
||||
"e5-",
|
||||
"jina-embeddings",
|
||||
)
|
||||
vlm_keywords = ("vl", "vision", "visual", "multimodal", "qwen-vl", "gpt-4o")
|
||||
|
||||
if any(keyword in normalized_name for keyword in rerank_keywords):
|
||||
return "rerank"
|
||||
if any(keyword in normalized_name for keyword in embedding_keywords):
|
||||
return "embedding"
|
||||
if any(keyword in normalized_name for keyword in vlm_keywords):
|
||||
return "vlm"
|
||||
return model_type if model_type in VALID_MODEL_TYPES else "chat"
|
||||
|
||||
|
||||
async def test_model_connection(model: ModelConfig) -> dict:
|
||||
"""Test model connection by calling the API"""
|
||||
@@ -23,6 +55,7 @@ async def test_model_connection(model: ModelConfig) -> dict:
|
||||
api_base = model.api_base or ""
|
||||
provider = model.provider
|
||||
model_name = model.model_name
|
||||
model_type = normalize_model_type(model.model_type, model_name)
|
||||
api_key = model.api_key
|
||||
|
||||
headers = {
|
||||
@@ -32,7 +65,7 @@ async def test_model_connection(model: ModelConfig) -> dict:
|
||||
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10.0) as client:
|
||||
if provider == "openai":
|
||||
if model_type in {"chat", "vlm"} and provider in {"openai", "ali"}:
|
||||
# OpenAI compatible API test
|
||||
response = await client.post(
|
||||
f"{api_base.rstrip('/')}/chat/completions",
|
||||
@@ -43,7 +76,7 @@ async def test_model_connection(model: ModelConfig) -> dict:
|
||||
"max_tokens": 5
|
||||
}
|
||||
)
|
||||
elif provider == "minimax":
|
||||
elif model_type in {"chat", "vlm"} and provider == "minimax":
|
||||
# MiniMax API test
|
||||
response = await client.post(
|
||||
f"{api_base.rstrip('/')}/chat/completions_v2",
|
||||
@@ -56,7 +89,7 @@ async def test_model_connection(model: ModelConfig) -> dict:
|
||||
"messages": [{"role": "user", "content": "Hi"}]
|
||||
}
|
||||
)
|
||||
elif provider == "glm":
|
||||
elif model_type in {"chat", "vlm"} and provider == "glm":
|
||||
# GLM API test
|
||||
response = await client.post(
|
||||
f"{api_base.rstrip('/')}/chat/completions",
|
||||
@@ -66,8 +99,21 @@ async def test_model_connection(model: ModelConfig) -> dict:
|
||||
"messages": [{"role": "user", "content": "Hi"}]
|
||||
}
|
||||
)
|
||||
elif model_type == "embedding" and provider in {"openai", "ali", "glm"}:
|
||||
response = await client.post(
|
||||
f"{api_base.rstrip('/')}/embeddings",
|
||||
headers=headers,
|
||||
json={
|
||||
"model": model_name,
|
||||
"input": "test"
|
||||
}
|
||||
)
|
||||
elif model_type == "embedding" and provider == "minimax":
|
||||
return {"success": False, "message": "MiniMax embedding 自动测试暂未接入,请手动确认端点与模型"}
|
||||
elif model_type == "rerank":
|
||||
return {"success": False, "message": "Rerank 自动测试暂未接入,请先保存配置并在实际流程中验证"}
|
||||
else:
|
||||
return {"success": False, "message": f"Unsupported provider: {provider}"}
|
||||
return {"success": False, "message": f"Unsupported provider/type: {provider}/{model_type}"}
|
||||
|
||||
if response.status_code == 200:
|
||||
return {"success": True, "message": "Connection successful"}
|
||||
@@ -114,6 +160,7 @@ async def create_model(model: ModelCreate, db: AsyncSession = Depends(get_db)):
|
||||
|
||||
db_model = ModelConfig(
|
||||
provider=model.provider,
|
||||
model_type=model.model_type,
|
||||
model_name=model.model_name,
|
||||
api_key=model.api_key,
|
||||
api_base=model.api_base,
|
||||
@@ -248,6 +295,7 @@ async def test_model(model_id: str, db: AsyncSession = Depends(get_db)):
|
||||
test_result = await test_model_connection(model)
|
||||
|
||||
# Save connection status to database
|
||||
model.model_type = normalize_model_type(model.model_type, model.model_name)
|
||||
model.connection_status = "connected" if test_result["success"] else "disconnected"
|
||||
await db.commit()
|
||||
await db.refresh(model)
|
||||
|
||||
@@ -1,31 +1,303 @@
|
||||
"""
|
||||
Questions API Router
|
||||
"""
|
||||
import asyncio
|
||||
import json
|
||||
import re
|
||||
from typing import List, Optional
|
||||
from uuid import UUID
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
import httpx
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from pydantic import BaseModel, Field
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.api.response import ApiResponse, PaginatedResponse
|
||||
from app.core.database import get_db
|
||||
from app.core.exceptions import NotFoundException, ValidationException
|
||||
from app.core.crud import CRUDBase
|
||||
from app.models.models import Question, Chunk
|
||||
from app.schemas.question import QuestionResponse
|
||||
from app.schemas.question import QuestionCreateSchema
|
||||
from app.core.database import AsyncSessionLocal, get_db
|
||||
from app.core.exceptions import NotFoundException, ValidationException
|
||||
from app.core.logging import log_failure, log_success
|
||||
from app.models.models import Chunk, ModelConfig, Question
|
||||
from app.schemas.question import QuestionCreateSchema, QuestionResponse
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
# Initialize CRUD
|
||||
question_crud = CRUDBase(Question)
|
||||
|
||||
VALID_MODEL_TYPES = {"chat", "vlm", "embedding", "rerank"}
|
||||
|
||||
DEFAULT_PRESET_PROMPT = (
|
||||
"你是一名高质量中文问答数据构建助手。"
|
||||
"请基于给定 chunk 内容生成准确、自然、可用于训练的数据集问答对。"
|
||||
"问题必须清晰具体,答案必须直接来自内容或基于内容做合理概括,"
|
||||
"不要编造原文没有的信息,不要输出与目录、导航、页眉页脚、噪声文字相关的问题。"
|
||||
)
|
||||
|
||||
|
||||
class GenerateRequest(BaseModel):
|
||||
"""Request model for generating questions"""
|
||||
chunk_ids: List[UUID] = Field(..., min_length=1)
|
||||
count: int = Field(5, ge=1, le=50)
|
||||
question_types: List[str] = ["fact", "summary"]
|
||||
model_id: UUID
|
||||
count: int = Field(3, ge=1, le=10)
|
||||
dirty_data_filter: bool = True
|
||||
thinking_mode: bool = True
|
||||
preset_prompt: str = Field(default=DEFAULT_PRESET_PROMPT, min_length=1, max_length=4000)
|
||||
|
||||
|
||||
def normalize_model_type(model_type: str | None, model_name: str | None) -> str:
|
||||
"""Normalize model type, with keyword fallback for legacy records."""
|
||||
if model_type in VALID_MODEL_TYPES and model_type != "chat":
|
||||
return model_type
|
||||
|
||||
normalized_name = (model_name or "").strip().lower()
|
||||
rerank_keywords = ("rerank", "bce-reranker", "gte-rerank")
|
||||
embedding_keywords = (
|
||||
"embedding",
|
||||
"embed",
|
||||
"text-embedding",
|
||||
"bge-",
|
||||
"bge_m3",
|
||||
"gte-",
|
||||
"m3e",
|
||||
"e5-",
|
||||
"jina-embeddings",
|
||||
)
|
||||
vlm_keywords = ("vl", "vision", "visual", "multimodal", "qwen-vl", "gpt-4o")
|
||||
|
||||
if any(keyword in normalized_name for keyword in rerank_keywords):
|
||||
return "rerank"
|
||||
if any(keyword in normalized_name for keyword in embedding_keywords):
|
||||
return "embedding"
|
||||
if any(keyword in normalized_name for keyword in vlm_keywords):
|
||||
return "vlm"
|
||||
return model_type if model_type in VALID_MODEL_TYPES else "chat"
|
||||
|
||||
|
||||
def is_dirty_chunk(content: str) -> bool:
|
||||
"""Heuristic dirty-data filter for low-value chunks."""
|
||||
normalized = re.sub(r"\s+", " ", (content or "")).strip()
|
||||
if len(normalized) < 40:
|
||||
return True
|
||||
|
||||
if len(re.sub(r"[^\u4e00-\u9fffA-Za-z0-9]", "", normalized)) < 24:
|
||||
return True
|
||||
|
||||
lowered = normalized.lower()
|
||||
if lowered in {"目录", "contents", "table of contents"}:
|
||||
return True
|
||||
|
||||
lines = [line.strip() for line in (content or "").splitlines() if line.strip()]
|
||||
if lines:
|
||||
short_lines = sum(1 for line in lines if len(line) <= 18)
|
||||
dotted_lines = sum(1 for line in lines if re.search(r"[·•…\.]{3,}|\s\d+$", line))
|
||||
if short_lines / len(lines) > 0.7 and len(lines) >= 3:
|
||||
return True
|
||||
if dotted_lines / len(lines) > 0.4:
|
||||
return True
|
||||
|
||||
punctuation_ratio = sum(1 for ch in normalized if not ch.isalnum() and not ("\u4e00" <= ch <= "\u9fff")) / max(len(normalized), 1)
|
||||
if punctuation_ratio > 0.45:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def build_generation_prompt(chunk: Chunk, request: GenerateRequest) -> str:
|
||||
"""Build user prompt for QA generation."""
|
||||
thinking_instruction = (
|
||||
"请先对内容做简短分析,识别核心事实、概念、关系与潜在考点,然后再生成问答。"
|
||||
"分析过程只用于提高质量,不要在最终输出中暴露你的思维链。"
|
||||
if request.thinking_mode
|
||||
else "直接基于内容生成高质量问答。"
|
||||
)
|
||||
|
||||
return (
|
||||
f"{request.preset_prompt}\n\n"
|
||||
"输出要求:\n"
|
||||
f"1. 生成 {request.count} 组问答。\n"
|
||||
"2. 只输出 JSON 数组,不要输出解释、标题、Markdown。\n"
|
||||
'3. 每个对象结构为 {"question":"...","answer":"...","question_type":"fact|summary|reasoning"}。\n'
|
||||
"4. 问题避免重复,答案避免空泛。\n"
|
||||
"5. 如果内容不足以生成高质量问答,请返回空数组 []。\n"
|
||||
f"6. {thinking_instruction}\n\n"
|
||||
f"Chunk 名称:{chunk.name or '未命名分片'}\n"
|
||||
f"Chunk 内容:\n{chunk.content}"
|
||||
)
|
||||
|
||||
|
||||
def extract_text_from_response(data: dict) -> str:
|
||||
"""Extract response text from provider response."""
|
||||
choices = data.get("choices") or []
|
||||
if choices:
|
||||
message = choices[0].get("message") or {}
|
||||
content = message.get("content")
|
||||
if isinstance(content, str):
|
||||
return content
|
||||
if isinstance(content, list):
|
||||
parts = [item.get("text", "") for item in content if isinstance(item, dict)]
|
||||
return "\n".join(part for part in parts if part)
|
||||
return ""
|
||||
|
||||
|
||||
def parse_generated_questions(raw_text: str) -> List[dict]:
|
||||
"""Parse JSON array from model output."""
|
||||
text = (raw_text or "").strip()
|
||||
if not text:
|
||||
return []
|
||||
|
||||
fenced_match = re.search(r"```json\s*(.*?)\s*```", text, flags=re.S)
|
||||
if fenced_match:
|
||||
text = fenced_match.group(1).strip()
|
||||
|
||||
if not text.startswith("["):
|
||||
array_match = re.search(r"(\[\s*\{.*\}\s*\])", text, flags=re.S)
|
||||
if array_match:
|
||||
text = array_match.group(1)
|
||||
|
||||
try:
|
||||
parsed = json.loads(text)
|
||||
except json.JSONDecodeError:
|
||||
return []
|
||||
|
||||
if not isinstance(parsed, list):
|
||||
return []
|
||||
|
||||
normalized = []
|
||||
for item in parsed:
|
||||
if not isinstance(item, dict):
|
||||
continue
|
||||
question = str(item.get("question", "")).strip()
|
||||
answer = str(item.get("answer", "")).strip()
|
||||
question_type = str(item.get("question_type", "fact")).strip() or "fact"
|
||||
if not question or not answer:
|
||||
continue
|
||||
normalized.append({
|
||||
"question": question,
|
||||
"answer": answer,
|
||||
"question_type": question_type
|
||||
})
|
||||
return normalized
|
||||
|
||||
|
||||
async def call_generation_model(model: ModelConfig, prompt: str) -> str:
|
||||
"""Call configured chat model for question generation."""
|
||||
provider = model.provider
|
||||
api_base = (model.api_base or "").rstrip("/")
|
||||
api_key = model.api_key or ""
|
||||
model_name = model.model_name
|
||||
headers = {
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
payload = {
|
||||
"model": model_name,
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "你是问答数据构建助手。严格按 JSON 输出,不要输出额外说明。"
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": prompt
|
||||
}
|
||||
],
|
||||
"temperature": 0.4,
|
||||
"response_format": {"type": "json_object"}
|
||||
}
|
||||
|
||||
async with httpx.AsyncClient(timeout=120.0) as client:
|
||||
if provider == "minimax":
|
||||
response = await client.post(
|
||||
f"{api_base}/chat/completions_v2",
|
||||
headers=headers,
|
||||
json={k: v for k, v in payload.items() if k != "response_format"}
|
||||
)
|
||||
else:
|
||||
response = await client.post(
|
||||
f"{api_base}/chat/completions",
|
||||
headers=headers,
|
||||
json=payload
|
||||
)
|
||||
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
content = extract_text_from_response(data)
|
||||
if not content:
|
||||
raise ValueError("Model returned empty content")
|
||||
|
||||
if content.lstrip().startswith("{"):
|
||||
obj = json.loads(content)
|
||||
if isinstance(obj, dict) and isinstance(obj.get("questions"), list):
|
||||
return json.dumps(obj["questions"], ensure_ascii=False)
|
||||
return content
|
||||
|
||||
|
||||
async def process_generate_async(project_id: UUID, request: GenerateRequest):
|
||||
"""Generate QA pairs in background."""
|
||||
async with AsyncSessionLocal() as db:
|
||||
try:
|
||||
model_result = await db.execute(
|
||||
select(ModelConfig).where(ModelConfig.id == request.model_id, ModelConfig.project_id == None) # noqa: E711
|
||||
)
|
||||
model = model_result.scalar_one_or_none()
|
||||
if not model:
|
||||
return
|
||||
|
||||
model_type = normalize_model_type(model.model_type, model.model_name)
|
||||
if model_type not in {"chat", "vlm"}:
|
||||
raise ValidationException("Selected model must be chat/vlm type", field="model_id")
|
||||
|
||||
chunk_result = await db.execute(
|
||||
select(Chunk).where(Chunk.id.in_(request.chunk_ids), Chunk.project_id == project_id)
|
||||
)
|
||||
chunks = chunk_result.scalars().all()
|
||||
if not chunks:
|
||||
return
|
||||
|
||||
created_count = 0
|
||||
skipped_count = 0
|
||||
for chunk in chunks:
|
||||
if request.dirty_data_filter and is_dirty_chunk(chunk.content):
|
||||
skipped_count += 1
|
||||
continue
|
||||
|
||||
prompt = build_generation_prompt(chunk, request)
|
||||
raw_text = await call_generation_model(model, prompt)
|
||||
qa_pairs = parse_generated_questions(raw_text)[:request.count]
|
||||
if not qa_pairs:
|
||||
skipped_count += 1
|
||||
continue
|
||||
|
||||
for item in qa_pairs:
|
||||
db.add(Question(
|
||||
project_id=project_id,
|
||||
chunk_id=chunk.id,
|
||||
content=item["question"],
|
||||
answer=item["answer"],
|
||||
question_type=item["question_type"],
|
||||
source="generated"
|
||||
))
|
||||
created_count += 1
|
||||
|
||||
await db.commit()
|
||||
|
||||
log_success(
|
||||
"问答批量生成完成",
|
||||
project_id=str(project_id),
|
||||
model_id=str(model.id),
|
||||
chunk_count=len(chunks),
|
||||
created_questions=created_count,
|
||||
skipped_chunks=skipped_count
|
||||
)
|
||||
except Exception as e:
|
||||
log_failure(
|
||||
"问答批量生成失败",
|
||||
project_id=str(project_id),
|
||||
model_id=str(request.model_id),
|
||||
error=str(e)
|
||||
)
|
||||
|
||||
|
||||
@router.post("/generate", response_model=ApiResponse)
|
||||
@@ -34,36 +306,33 @@ async def generate_questions(
|
||||
request: GenerateRequest,
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""Generate questions from chunks using LLM"""
|
||||
# Get chunks
|
||||
result = await db.execute(
|
||||
select(Chunk).where(Chunk.id.in_(request.chunk_ids), Chunk.project_id == project_id)
|
||||
"""Generate questions from chunks using LLM in background."""
|
||||
model_result = await db.execute(
|
||||
select(ModelConfig).where(ModelConfig.id == request.model_id, ModelConfig.project_id == None) # noqa: E711
|
||||
)
|
||||
chunks = result.scalars().all()
|
||||
model = model_result.scalar_one_or_none()
|
||||
if not model:
|
||||
raise ValidationException("Selected model not found", field="model_id")
|
||||
|
||||
if not chunks:
|
||||
model_type = normalize_model_type(model.model_type, model.model_name)
|
||||
if model_type not in {"chat", "vlm"}:
|
||||
raise ValidationException("Selected model must be chat/vlm type", field="model_id")
|
||||
if not model.api_key:
|
||||
raise ValidationException("Selected model is missing API Key", field="model_id")
|
||||
|
||||
chunk_result = await db.execute(
|
||||
select(Chunk.id).where(Chunk.id.in_(request.chunk_ids), Chunk.project_id == project_id)
|
||||
)
|
||||
valid_chunk_ids = [row[0] for row in chunk_result.all()]
|
||||
if not valid_chunk_ids:
|
||||
raise ValidationException("No valid chunks found", field="chunk_ids")
|
||||
|
||||
# Create sample questions (placeholder for LLM-based generation)
|
||||
created_questions = []
|
||||
for chunk in chunks:
|
||||
for i in range(request.count):
|
||||
question = Question(
|
||||
project_id=project_id,
|
||||
chunk_id=chunk.id,
|
||||
content=f"这是关于「{chunk.name}」的问题 {i+1}?",
|
||||
answer=f"这是问题 {i+1} 的答案。",
|
||||
question_type=request.question_types[0] if request.question_types else "fact",
|
||||
source="generated"
|
||||
)
|
||||
db.add(question)
|
||||
created_questions.append(question)
|
||||
|
||||
await db.commit()
|
||||
request_payload = request.model_copy(update={"chunk_ids": valid_chunk_ids})
|
||||
asyncio.create_task(process_generate_async(project_id, request_payload))
|
||||
|
||||
return ApiResponse.ok(
|
||||
data={"questions": len(created_questions)},
|
||||
message=f"Successfully generated {len(created_questions)} questions"
|
||||
data={"chunk_count": len(valid_chunk_ids), "status": "processing"},
|
||||
message="Question generation started in background"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from contextlib import asynccontextmanager
|
||||
from typing import AsyncGenerator
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine, async_sessionmaker
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
from sqlalchemy import create_engine, event
|
||||
from sqlalchemy import create_engine, event, inspect, text
|
||||
from sqlalchemy.pool import NullPool
|
||||
|
||||
from app.core.config import get_settings
|
||||
@@ -65,9 +65,28 @@ async def init_db():
|
||||
logger.info("Initializing database...")
|
||||
async with async_engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
await conn.run_sync(_ensure_legacy_columns)
|
||||
logger.info("Database initialized successfully")
|
||||
|
||||
|
||||
def _ensure_legacy_columns(sync_conn):
|
||||
"""Patch legacy tables with newly introduced columns."""
|
||||
inspector = inspect(sync_conn)
|
||||
if "model_configs" not in inspector.get_table_names():
|
||||
return
|
||||
|
||||
columns = {column["name"] for column in inspector.get_columns("model_configs")}
|
||||
if "model_type" in columns:
|
||||
return
|
||||
|
||||
logger.info("Adding missing model_type column to model_configs table")
|
||||
dialect = sync_conn.dialect.name
|
||||
if dialect == "postgresql":
|
||||
sync_conn.execute(text("ALTER TABLE model_configs ADD COLUMN model_type VARCHAR(50) NOT NULL DEFAULT 'chat'"))
|
||||
else:
|
||||
sync_conn.execute(text("ALTER TABLE model_configs ADD COLUMN model_type VARCHAR(50) NOT NULL DEFAULT 'chat'"))
|
||||
|
||||
|
||||
async def close_db():
|
||||
"""Close database connections"""
|
||||
logger.info("Closing database connections...")
|
||||
|
||||
@@ -137,7 +137,8 @@ class ModelConfig(Base, UUIDMixin, TimestampMixin):
|
||||
__tablename__ = "model_configs"
|
||||
|
||||
project_id = Column(UUID(as_uuid=True), ForeignKey("projects.id", ondelete="CASCADE"), nullable=True)
|
||||
provider = Column(String(50), nullable=False) # minimax, glm, openai
|
||||
provider = Column(String(50), nullable=False) # minimax, glm, openai, ali
|
||||
model_type = Column(String(50), nullable=False, default="chat") # chat, vlm, embedding, rerank
|
||||
model_name = Column(String(100))
|
||||
api_key = Column(String(500))
|
||||
api_base = Column(String(500))
|
||||
|
||||
@@ -9,7 +9,8 @@ from uuid import UUID
|
||||
|
||||
class ModelBase(BaseModel):
|
||||
"""Base model schema"""
|
||||
provider: str = Field(..., description="Model provider: minimax, glm, openai")
|
||||
provider: str = Field(..., description="Model provider: minimax, glm, openai, ali")
|
||||
model_type: str = Field(default="chat", description="Model type: chat, vlm, embedding, rerank")
|
||||
model_name: str = Field(..., description="Model name")
|
||||
api_key: Optional[str] = Field(None, description="API key")
|
||||
api_base: Optional[str] = Field(None, description="API base URL")
|
||||
@@ -24,6 +25,7 @@ class ModelCreate(ModelBase):
|
||||
class ModelUpdate(BaseModel):
|
||||
"""Model update schema"""
|
||||
provider: Optional[str] = None
|
||||
model_type: Optional[str] = None
|
||||
model_name: Optional[str] = None
|
||||
api_key: Optional[str] = None
|
||||
api_base: Optional[str] = None
|
||||
|
||||
@@ -8,6 +8,7 @@ import httpx
|
||||
import numpy as np
|
||||
from typing import List, Dict, Optional
|
||||
from abc import ABC, abstractmethod
|
||||
from langchain_text_splitters import RecursiveCharacterTextSplitter
|
||||
|
||||
|
||||
class EmbeddingProvider(ABC):
|
||||
@@ -109,32 +110,28 @@ class EmbeddingSplitter:
|
||||
|
||||
def _tokenize_sentences(self, text: str) -> List[str]:
|
||||
"""将文本切分为句子"""
|
||||
# 中英文句末符号
|
||||
# 先按换行分割,保持段落结构
|
||||
paragraphs = re.split(r'\n+', text)
|
||||
|
||||
paragraphs = re.split(r'\n\s*\n+', text)
|
||||
sentences = []
|
||||
for para in paragraphs:
|
||||
if not para.strip():
|
||||
para = para.strip()
|
||||
if not para:
|
||||
continue
|
||||
|
||||
# 按句子符号分割
|
||||
# 中文:。!?;
|
||||
# 英文:. ! ? ;
|
||||
parts = re.split(r'([。!?;\n]|(?<=[.!?])\s+)', para)
|
||||
parts = re.split(r'(?<=[。!?;.!?])\s+|(?<=[。!?;])', para)
|
||||
buffer = []
|
||||
|
||||
# 重新组合句子
|
||||
current_sentence = ""
|
||||
for part in parts:
|
||||
if part in '。!?;.\n':
|
||||
if current_sentence.strip():
|
||||
sentences.append(current_sentence.strip())
|
||||
current_sentence = ""
|
||||
elif part and part.strip():
|
||||
current_sentence += part
|
||||
# 处理最后一个句子
|
||||
if current_sentence.strip():
|
||||
sentences.append(current_sentence.strip())
|
||||
part = part.strip()
|
||||
if not part:
|
||||
continue
|
||||
|
||||
# 过短的片段先暂存,尽量与后一句合并,避免 embedding 粒度过碎
|
||||
if len(part) < 8 and buffer:
|
||||
buffer[-1] = f"{buffer[-1]} {part}".strip()
|
||||
else:
|
||||
buffer.append(part)
|
||||
|
||||
sentences.extend(buffer)
|
||||
|
||||
return sentences
|
||||
|
||||
@@ -162,51 +159,48 @@ class EmbeddingSplitter:
|
||||
if not similarities:
|
||||
return []
|
||||
|
||||
window = self.window_size
|
||||
window = max(1, self.window_size)
|
||||
smoothed = []
|
||||
|
||||
for i in range(len(similarities)):
|
||||
start = max(0, i - window + 1)
|
||||
end = i + 1
|
||||
start = max(0, i - window)
|
||||
end = min(len(similarities), i + window + 1)
|
||||
window_vals = similarities[start:end]
|
||||
smoothed.append(sum(window_vals) / len(window_vals))
|
||||
|
||||
return smoothed
|
||||
|
||||
def _detect_boundaries(self, similarities: List[float]) -> List[int]:
|
||||
def _detect_boundaries(self, similarities: List[float], sentence_lengths: List[int]) -> List[int]:
|
||||
"""检测分割点(相似度显著下降的位置)"""
|
||||
if not similarities:
|
||||
return [0]
|
||||
|
||||
# 平滑
|
||||
smoothed = self._smooth_similarities(similarities)
|
||||
|
||||
# 计算深度分数(类似 TextTiling)
|
||||
depth_scores = []
|
||||
for i in range(1, len(smoothed) - 1):
|
||||
# 当前位置的深度 = 当前位置的值 - 平均值
|
||||
# 但更准确的是:左侧平均 - 右侧平均
|
||||
left_avg = sum(smoothed[max(0, i - self.window_size):i]) / self.window_size
|
||||
right_avg = sum(smoothed[i:min(len(smoothed), i + self.window_size)]) / self.window_size
|
||||
depth = left_avg - right_avg
|
||||
depth_scores.append(depth)
|
||||
|
||||
# 如果没有足够的点,直接返回
|
||||
if not depth_scores:
|
||||
if len(smoothed) <= 1:
|
||||
return [0]
|
||||
|
||||
# 阈值判断
|
||||
mean_depth = np.mean(depth_scores)
|
||||
std_depth = np.std(depth_scores)
|
||||
|
||||
# 找分割点:depth 显著高于均值的位置
|
||||
threshold = mean_depth + 0.5 * std_depth
|
||||
mean_sim = float(np.mean(smoothed))
|
||||
std_sim = float(np.std(smoothed))
|
||||
dynamic_threshold = max(0.0, min(0.95, mean_sim - 0.5 * std_sim))
|
||||
effective_threshold = max(self.similarity_threshold, dynamic_threshold)
|
||||
|
||||
boundaries = [0] # 起始点
|
||||
for i, depth in enumerate(depth_scores):
|
||||
if depth > threshold and depth > self.similarity_threshold:
|
||||
boundaries.append(i + 1) # 对应相似度的下一个位置
|
||||
boundaries.append(len(self._tokenize_sentences.__name__)) # 结束点
|
||||
accumulated_chars = 0
|
||||
|
||||
for i, sim in enumerate(smoothed):
|
||||
accumulated_chars += sentence_lengths[i]
|
||||
|
||||
left_sim = smoothed[i - 1] if i > 0 else 1.0
|
||||
right_sim = smoothed[i + 1] if i < len(smoothed) - 1 else 1.0
|
||||
is_local_min = sim <= left_sim and sim <= right_sim
|
||||
has_enough_context = accumulated_chars >= self.min_chunk_size
|
||||
oversize_guard = accumulated_chars >= self.chunk_size
|
||||
|
||||
if (is_local_min and has_enough_context and sim <= effective_threshold) or oversize_guard:
|
||||
boundaries.append(i + 1)
|
||||
accumulated_chars = 0
|
||||
|
||||
boundaries.append(len(sentence_lengths))
|
||||
|
||||
return sorted(list(set(boundaries)))
|
||||
|
||||
@@ -225,7 +219,12 @@ class EmbeddingSplitter:
|
||||
for i in range(len(boundaries) - 1):
|
||||
start = boundaries[i]
|
||||
end = boundaries[i + 1]
|
||||
chunk_text = ' '.join(sentences[start:end])
|
||||
if start >= end:
|
||||
continue
|
||||
|
||||
chunk_text = ' '.join(sentences[start:end]).strip()
|
||||
if not chunk_text:
|
||||
continue
|
||||
|
||||
# 如果 chunk 过大,递归分割
|
||||
if len(chunk_text) > self.chunk_size * 1.5:
|
||||
@@ -278,14 +277,22 @@ class EmbeddingSplitter:
|
||||
merged = [chunks[0]]
|
||||
|
||||
for chunk in chunks[1:]:
|
||||
# 如果前一个 chunk 太小,合并
|
||||
if merged[-1]["char_count"] < self.min_chunk_size:
|
||||
merged[-1]["content"] += " " + chunk["content"]
|
||||
merged[-1]["word_count"] += chunk["word_count"]
|
||||
merged[-1]["char_count"] += chunk["char_count"]
|
||||
previous = merged[-1]
|
||||
should_merge = (
|
||||
previous["char_count"] < self.min_chunk_size or
|
||||
chunk["char_count"] < self.min_chunk_size
|
||||
)
|
||||
|
||||
if should_merge and previous["char_count"] + chunk["char_count"] <= self.chunk_size * 1.5:
|
||||
previous["content"] += " " + chunk["content"]
|
||||
previous["word_count"] += chunk["word_count"]
|
||||
previous["char_count"] += chunk["char_count"]
|
||||
else:
|
||||
merged.append(chunk)
|
||||
|
||||
for index, chunk in enumerate(merged):
|
||||
chunk["index"] = index
|
||||
|
||||
return merged
|
||||
|
||||
async def split_with_embedding(self, text: str) -> List[Dict]:
|
||||
@@ -295,8 +302,8 @@ class EmbeddingSplitter:
|
||||
if not sentences:
|
||||
return []
|
||||
|
||||
# 过滤过短的句子
|
||||
sentences = [s for s in sentences if len(s) >= 10]
|
||||
# 过滤纯噪音片段,但保留正常短句
|
||||
sentences = [s for s in sentences if len(s.strip()) >= 4]
|
||||
|
||||
if not sentences:
|
||||
return []
|
||||
@@ -312,17 +319,22 @@ class EmbeddingSplitter:
|
||||
|
||||
# 3. 调用 Embedding API
|
||||
try:
|
||||
if self.embedding_provider is None:
|
||||
raise ValueError("embedding provider is not configured")
|
||||
embeddings = await self.embedding_provider.get_embeddings(sentences)
|
||||
except Exception as e:
|
||||
# 如果 embedding 失败,降级到规则分割
|
||||
print(f"Embedding failed, falling back to rule-based: {e}")
|
||||
return self._fallback_split(text)
|
||||
|
||||
if len(embeddings) != len(sentences):
|
||||
return self._fallback_split(text)
|
||||
|
||||
# 4. 计算相似度
|
||||
similarities = self._compute_similarities(embeddings)
|
||||
|
||||
# 5. 检测分割点
|
||||
boundaries = self._detect_boundaries(similarities)
|
||||
boundaries = self._detect_boundaries(similarities, [len(sentence) for sentence in sentences])
|
||||
|
||||
# 6. 组装 chunks
|
||||
chunks = self._assemble_chunks(sentences, boundaries)
|
||||
@@ -387,7 +399,7 @@ class SemanticEmbeddingSplitter(EmbeddingSplitter):
|
||||
|
||||
def create_embedding_provider(provider: str, api_key: str, base_url: str, model: str = None) -> EmbeddingProvider:
|
||||
"""创建 Embedding 提供商"""
|
||||
if provider in ["openai", "compatible"]:
|
||||
if provider in ["openai", "compatible", "ali", "glm"]:
|
||||
return OpenAIEmbedding(api_key, base_url, model or "text-embedding-3-small")
|
||||
elif provider == "minimax":
|
||||
return MiniMaxEmbedding(api_key, base_url)
|
||||
|
||||
2410
backend/logs/2026-03-18/app.log.2026-03-18
Normal file
2410
backend/logs/2026-03-18/app.log.2026-03-18
Normal file
File diff suppressed because it is too large
Load Diff
1
backend/uploads/.gitkeep
Normal file
1
backend/uploads/.gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
# This file ensures the uploads directory is tracked in git
|
||||
3657
backend/uv.lock
generated
Normal file
3657
backend/uv.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
BIN
backend/ygdataset.db
Normal file
BIN
backend/ygdataset.db
Normal file
Binary file not shown.
97
daily-work/2026-03-17.md
Normal file
97
daily-work/2026-03-17.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# 工作日志 - 2026-03-17
|
||||
|
||||
## 项目信息
|
||||
- 项目: YG-Datasets
|
||||
- 路径: /data/code/YG-Datasets
|
||||
|
||||
## 工作摘要
|
||||
今日共完成 16 项任务
|
||||
|
||||
## 详细记录
|
||||
|
||||
### 1. 🟣 Feature 后端核心架构模块
|
||||
- 时间: 17:28
|
||||
- 文件: backend/app/core/auth.py, backend/app/core/crud.py, backend/app/core/exceptions.py, backend/app/core/logging.py
|
||||
- 描述: 添加认证模块、CRUD 基础操作、异常处理、日志模块
|
||||
|
||||
### 2. 🟣 Feature 后端 API Schemas 定义
|
||||
- 时间: 17:28
|
||||
- 文件: backend/app/schemas/chunk.py, backend/app/schemas/dataset.py, backend/app/schemas/eval.py
|
||||
- 描述: 添加数据结构的 Schema 定义
|
||||
|
||||
### 3. 🟣 Feature 前端 TypeScript 类型定义和组件
|
||||
- 时间: 17:28
|
||||
- 文件: frontend/src/api/index.ts, frontend/src/components/, frontend/src/types/
|
||||
- 描述: 添加 TypeScript API 客户端和组件
|
||||
|
||||
### 4. 🟣 Feature 前端页面功能和 UI 优化
|
||||
- 时间: 17:29
|
||||
- 文件: frontend/src/views/ModelSettingsView.vue, frontend/src/views/HomeView.vue
|
||||
- 描述: 添加模型配置页面,优化项目列表和删除功能
|
||||
|
||||
### 5. ✅ Change 项目配置文件
|
||||
- 时间: 17:29
|
||||
- 文件: backend/pyproject.toml, frontend/tsconfig.json
|
||||
- 描述: 添加项目配置文件
|
||||
|
||||
### 6. ✅ Change 一键启动脚本
|
||||
- 时间: 17:29
|
||||
- 文件: start.sh
|
||||
- 描述: 添加一键启动脚本
|
||||
|
||||
### 7. 🟣 Feature 后端 API 端点实现
|
||||
- 时间: 17:29
|
||||
- 文件: backend/app/api/v1/projects/__init__.py, backend/app/api/v1/datasets/__init__.py
|
||||
- 描述: 更新 API 端点实现
|
||||
|
||||
### 8. 🟣 Feature 后端核心模块和文件处理
|
||||
- 时间: 17:30
|
||||
- 文件: backend/app/core/config.py, backend/app/main.py, backend/app/models/models.py
|
||||
- 描述: 更新核心模块和文件处理器
|
||||
|
||||
### 9. ✅ Change 前端依赖和路由配置
|
||||
- 时间: 17:30
|
||||
- 文件: frontend/package.json, frontend/src/router/index.js, frontend/vite.config.js
|
||||
- 描述: 更新依赖和路由配置
|
||||
|
||||
### 10. 🔄 Refactor 前端 API 客户端重构
|
||||
- 时间: 17:30
|
||||
- 文件: frontend/src/api/index.js, frontend/src/api/index.ts
|
||||
- 描述: 用 TypeScript 版本替换 JavaScript API 客户端
|
||||
|
||||
### 11. 🔴 Bugfix 修复返回按钮白色背景遮挡
|
||||
- 时间: 17:35
|
||||
- 文件: frontend/src/views/ModelSettingsView.vue
|
||||
- 描述: 修复模型配置页面返回按钮 hover 时白色背景遮挡问题
|
||||
|
||||
### 12. 🔴 Bugfix 修复数据库初始化问题
|
||||
- 时间: 22:40
|
||||
- 文件: backend/app/core/database.py, backend/app/main.py
|
||||
- 描述: 修复数据库表未创建的问题,添加 models 导入确保 Base.metadata 包含所有模型
|
||||
|
||||
### 13. 🔴 Bugfix 修复 API 响应序列化错误
|
||||
- 时间: 22:42
|
||||
- 文件: backend/app/api/v1/models/__init__.py, backend/app/schemas/model.py
|
||||
- 描述: 修复 SQLAlchemy ORM 对象无法序列化为 JSON 的问题,使用 model_validate() 转换
|
||||
|
||||
### 14. 🟣 Feature 添加供应商默认 API Base URL
|
||||
- 时间: 22:45
|
||||
- 文件: frontend/src/views/ModelSettingsView.vue
|
||||
- 描述: 为 MiniMax、GLM、OpenAI Compatible 三个供应商添加默认 API Base URL,自动填充
|
||||
|
||||
### 15. 🟣 Feature 实现模型连接测试功能
|
||||
- 时间: 22:50
|
||||
- 文件: backend/app/api/v1/models/__init__.py, frontend/src/views/ModelSettingsView.vue, frontend/src/api/index.ts
|
||||
- 描述: 后端添加测试连接 API,前端调用并显示连接状态(已联通/未联通/待测试)
|
||||
|
||||
### 16. 🟣 Feature 创建 git-commit skill
|
||||
- 时间: 22:55
|
||||
- 文件: /root/.claude/skills/git-commit/SKILL.md
|
||||
- 描述: 创建 Git 分批提交技能,自动分析 git 状态,按功能分组文件,生成规范提交信息
|
||||
|
||||
---
|
||||
|
||||
## 其他工作
|
||||
|
||||
- ✅ Change: 前端 UI 样式调整 - 添加 Ant Design Vue 组件库,调整 Select 组件暗色样式
|
||||
- 📝 Git: 推送所有代码更改到远程仓库,共 10 个 commit
|
||||
73
daily-work/2026-03-18.md
Normal file
73
daily-work/2026-03-18.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# 工作日志 - 2026-03-18
|
||||
|
||||
## 项目信息
|
||||
- 项目: YG-Datasets
|
||||
- 路径: /data/code/YG-Datasets
|
||||
|
||||
## 工作摘要
|
||||
今日共完成 11 项任务
|
||||
|
||||
## 详细记录
|
||||
|
||||
### 1. 🟣 Feature 完善日志系统,支持按日期分目录存储
|
||||
- 时间: 10:44
|
||||
- 文件: backend/app/core/logging.py, backend/app/main.py
|
||||
- 描述: 日志系统支持按日期分目录存储,便于日志管理和分析
|
||||
|
||||
### 2. 🟣 Feature 完善前端功能,添加爬虫页面和项目分页
|
||||
- 时间: 10:45
|
||||
- 文件: frontend/src/views/HomeView.vue, frontend/src/views/CrawlerView.vue
|
||||
- 描述: 新增爬虫页面、composables 工具函数、项目列表分页功能
|
||||
|
||||
### 3. 🟣 Feature 新增 composables 工具函数和爬虫页面
|
||||
- 时间: 10:45
|
||||
- 文件: frontend/src/composables/index.ts, frontend/src/composables/useFormatters.ts, frontend/src/composables/useProjects.ts
|
||||
- 描述: 添加前端工具函数 composables,实现项目、模型、格式化等复用逻辑
|
||||
|
||||
### 4. 🔴 Bugfix 修复文件上传后异步处理失败问题
|
||||
- 时间: 16:08
|
||||
- 文件: backend/app/api/v1/files/__init__.py, backend/app/core/database.py
|
||||
- 描述: 修复 async_session_maker 引用错误,确保文件异步处理正常执行
|
||||
|
||||
### 5. 🟣 Feature 添加语义嵌入文本分割功能
|
||||
- 时间: 16:08
|
||||
- 文件: backend/app/services/text_splitter/semantic_embedding.py, backend/app/services/text_splitter/splitter.py
|
||||
- 描述: 实现基于语义嵌入的文本分割算法,支持更智能的文本分块
|
||||
|
||||
### 6. 🟣 Feature 更新 API 支持语义分割和 embedding 配置
|
||||
- 时间: 16:08
|
||||
- 文件: backend/app/api/v1/chunks/__init__.py, backend/app/schemas/
|
||||
- 描述: 后端 API 支持语义分割模式和 embedding 参数配置
|
||||
|
||||
### 7. ✅ Change 优化文件管理上传流程和 UI 体验
|
||||
- 时间: 16:08
|
||||
- 文件: frontend/src/views/project/FileManage.vue
|
||||
- 描述: 优化文件上传流程,添加上传状态轮询、空状态处理、动画效果优化
|
||||
|
||||
### 8. 🔄 Refactor 更新项目视图和文本分割页面
|
||||
- 时间: 16:08
|
||||
- 文件: frontend/src/views/ProjectView.vue, frontend/src/views/project/TextSplit.vue
|
||||
- 描述: 重构项目视图移除返回首页按钮,优化 TextSplit 页面样式和交互逻辑
|
||||
|
||||
### 9. 🧹 Chore 删除废弃文件
|
||||
- 时间: 16:08
|
||||
- 文件: "bug修复.md"
|
||||
- 描述: 清理废弃文件
|
||||
|
||||
---
|
||||
|
||||
## 附加工作(会话中完成,尚未提交)
|
||||
|
||||
### 10. ✅ Change 评估管理界面样式与文件管理保持一致
|
||||
- 时间: 17:32
|
||||
- 文件: frontend/src/views/project/EvalManage.vue
|
||||
- 描述: 评估管理界面采用与文件管理一致的样式:统计卡片带 glow 效果,空状态轨道动画、表格布局多选功能
|
||||
|
||||
### 11. ✅ Change 问答管理界面样式与文件管理保持一致
|
||||
- 时间: 17:40
|
||||
- 文件: frontend/src/views/project/QuestionManage.vue
|
||||
- 描述: 问答管理界面采用与文件管理一致的样式:渐变标题、统计卡片,空状态动画、表格多选批量操作
|
||||
|
||||
---
|
||||
|
||||
*生成时间: 2026-03-18 17:45*
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,266 @@
|
||||
文件编号:YG-CMMI-CM-PD07
|
||||
发布日期:2023-06-30
|
||||
现行版本:1.3
|
||||
|
||||
商密【中】
|
||||
|
||||
基线库管理规范
|
||||
|
||||
修订历史记录
|
||||
| 日期 | 版本 | 说明 | 作者/修改人 | 审核 | 批准 |
|
||||
| ----------- | -------- | -------- | ------- | ---- | ---- |
|
||||
| 2012-11-14 | 1.0 新增 | | 吴建春 | 李锋 | 卢晓民 |
|
||||
| | 在规范描述中增加 | EAM 产品的内 | | | |
|
||||
| 2013-7-23 | 1.1 | | 陈来方 | 卢晓民 | 周立 |
|
||||
容和入基线的标准邮件
|
||||
调整“适用部门”、“相关文档”
|
||||
| 2014-09-23 | 1.2 章节、根据最新组织机构调整本 | | 吴建春 | 卢晓民 | 李美平 |
|
||||
| ----------- | ------------------- | --- | ---- | ---- | ---- |
|
||||
文档引用的部门名称
|
||||
修订页眉中的商标引用,更新规
|
||||
| 2023-06-30 | 1.3 | | 李锋 | 刘娟 | 向万红 |
|
||||
| ----------- | ---- | --- | --- | --- | ---- |
|
||||
范描述
|
||||
| | | | | | |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| | | | | | |
|
||||
|
||||
远光软件股份有限公司 发布
|
||||
|
||||
文件编号 YG-CMMI-CM-PD07
|
||||
远光软件股份有限公司
|
||||
发布日期 2014-09-23
|
||||
现行版本 1.2
|
||||
基线库管理规范
|
||||
页次 第1页 共7页
|
||||
目录
|
||||
1. 引言 ............................................................................................................................................................................ 2
|
||||
1.1 目的 ................................................................................................................................................................... 2
|
||||
1.2 适用范围 ........................................................................................................................................................... 2
|
||||
1.2.1 适用部门 ................................................................................................................................................... 2
|
||||
1.2.2 适用业务 ................................................................................................................................................... 2
|
||||
1.3 术语和缩略语 ................................................................................................................................................... 2
|
||||
2. 角色与职责 ................................................................................................................................................................ 2
|
||||
3. 规范描述 .................................................................................................................................................................... 3
|
||||
3.1 纳入基线管理的工作产品范围 ........................................................................................................................ 3
|
||||
3.2 通知入基线角色 ............................................................................................................................................... 3
|
||||
3.3 通知入基线时机 ............................................................................................................................................... 4
|
||||
3.4 文档存储地址 ................................................................................................................................................... 4
|
||||
3.5 权限管理 ........................................................................................................................................................... 5
|
||||
3.6 入基线文档规范 ............................................................................................................................................... 5
|
||||
3.6.1 模板引用 ................................................................................................................................................... 5
|
||||
3.6.2 格式要求 ................................................................................................................................................... 6
|
||||
3.7 文档入基线及基线变更的充分条件 ................................................................................................................ 6
|
||||
3.7.1 XX资料已入基线的邮件 .......................................................................................................................... 6
|
||||
4. 相关文档 .................................................................................................................................................................... 7
|
||||
5. 参考资料 .................................................................................................................................................................... 7
|
||||
商密【中】
|
||||
|
||||
| | | | 文件编号 | YG-CMMI-CM-PD07 |
|
||||
| --- | --- | --- | ----- | ---------------- |
|
||||
远光软件股份有限公司
|
||||
| | | | 发布日期 | 2014-09-23 |
|
||||
| --- | --- | --- | ----- | ----------- |
|
||||
| | | | 现行版本 | 1.2 |
|
||||
基线库管理规范
|
||||
| | | | 页次 | 第2页 共7页 |
|
||||
| --- | --- | --- | --- | -------- |
|
||||
|
||||
引言
|
||||
1.
|
||||
目的
|
||||
1.1
|
||||
为加强对研发线各阶段所输出工件入配置基线库活动的管理,明确规定入基线库的工件范围、及工件
|
||||
入基线库的时效性,特补充本规范。
|
||||
1.2 适用范围
|
||||
1.2.1 适用部门
|
||||
适用于公司产品研发部门、全资子公司,控股子公司参考执行。
|
||||
1.2.2 适用业务
|
||||
各产品研发线,在各阶段输出需入基线库工件的管理。
|
||||
1.3 术语和缩略语
|
||||
术语/缩略语 解释
|
||||
| CM(Configuration Management: | | 是软件工程中的一项规程,包括相关工具和应用技术(过程和方 | | |
|
||||
| ---------------------------- | --- | ------------------------------- | --- | --- |
|
||||
| 配置管理) | | 法),公司用它来管理软件资产变更。 | | |
|
||||
| BL (Base Line:基线) | | 软件开发过程中的里程碑,它以一或多个软件配置项的交付为标 | | |
|
||||
志。基线由已经通过正式评审和批准的某规约或产品组成,它因
|
||||
|
||||
此可以作为进一步开发的基础,并且只能通过正式的变更控制过
|
||||
程才能够改变。
|
||||
| 工件 | | 软件研发生命周期各阶段的工作产品 | | |
|
||||
| --- | --- | -------------------- | --- | --- |
|
||||
|
||||
2. 角色与职责
|
||||
| 序号 | 角色 | 职责 | | |
|
||||
| --- | --- | --- | --- | --- |
|
||||
商密【中】
|
||||
|
||||
| | | | 文件编号 | YG-CMMI-CM-PD07 |
|
||||
| --- | --- | --- | ----- | ---------------- |
|
||||
远光软件股份有限公司
|
||||
| | | | 发布日期 | 2014-09-23 |
|
||||
| --- | --- | --- | ----- | ----------- |
|
||||
| | | | 现行版本 | 1.2 |
|
||||
基线库管理规范
|
||||
| | | | 页次 | 第3页 共7页 |
|
||||
| --- | --- | --- | --- | -------- |
|
||||
|
||||
负责将评审通过之后的文件入基线库
|
||||
配置管理员
|
||||
| 1 | | | | |
|
||||
| --- | --- | --- | --- | --- |
|
||||
负责将变更后的文件重新入基线库
|
||||
|
||||
负责确定项目哪些工作产品需入基线库管理
|
||||
项 目经理
|
||||
| 2 | | 负责管理并要求配置管理员按要求将各阶段工作产品入基线库 | | |
|
||||
| --- | --- | ------------------------------- | --- | --- |
|
||||
负责申请项目开发立项、发版材料入基线
|
||||
需求\设计\开发\测试
|
||||
负责参与工件入基线前的评审;
|
||||
| 3 | | | | |
|
||||
| --- | --- | --- | --- | --- |
|
||||
责任人
|
||||
负责申请各阶段工作产品入基线库
|
||||
|
||||
负责审计各阶段工作产品是否按要求入基线库
|
||||
QA工程师
|
||||
| 4 | | | | |
|
||||
| --- | --- | --- | --- | --- |
|
||||
负责审计各工作产品的完整性和符合性
|
||||
规范描述
|
||||
3.
|
||||
3.1 纳入基线管理的工作产品范围
|
||||
| | 工件 | 阶段 | | |
|
||||
| --------- | --- | ----- | --- | --- |
|
||||
| 产品需求说明书 | | 需求阶段 | | |
|
||||
| 需求规格说明书 | | 需求阶段 | | |
|
||||
| 详细需求说明书 | | 需求阶段 | | |
|
||||
| 功能设计文档 | | 设计阶段 | | |
|
||||
| 详细设计文档 | | 设计阶段 | | |
|
||||
| 测试用例 | | 测试阶段 | | |
|
||||
| 项目开发立项材料 | | 立项阶段 | | |
|
||||
| 项目结项材料 | | 结项阶段 | | |
|
||||
注:
|
||||
1)开发阶段的代码管理依据《YG-CMMI-CM-PD04 配置管理规范》执行。
|
||||
2)发版阶段:集成测试结束之后,配置项清单检查之前。
|
||||
通知入基线角色
|
||||
3.2
|
||||
|
||||
| 工件 | 入基线角色 | | | |
|
||||
| -------- | ------ | --- | --- | --- |
|
||||
| 产品需求说明书 | 需求责任人 | | | |
|
||||
商密【中】
|
||||
|
||||
文件编号 YG-CMMI-CM-PD07
|
||||
远光软件股份有限公司
|
||||
发布日期 2014-09-23
|
||||
现行版本 1.2
|
||||
基线库管理规范
|
||||
页次 第4页 共7页
|
||||
需求规格说明书 需求责任人
|
||||
详细需求说明书 需求责任人
|
||||
功能设计文档 详细设计人员
|
||||
详细设计文档 详细设计人员
|
||||
测试用例 测试责任人
|
||||
项目开发立项材料 项目经理
|
||||
项目结项材料 项目经理
|
||||
3.3 通知入基线时机
|
||||
工件 入基线时机
|
||||
产品需求说明书 产品需求评审之后
|
||||
需求规格说明书 设计评审之后
|
||||
详细需求说明书评审之
|
||||
详细需求说明书
|
||||
后
|
||||
功能设计文档 评审之后
|
||||
详细设计文档 评审之后
|
||||
测试用例 测试用例评审之后
|
||||
项目开发立项材料 立项评审之后
|
||||
项目结项材料 结项评审之后
|
||||
3.4 文档存储地址
|
||||
(1)需求阶段
|
||||
需求规格说明书
|
||||
http:// 10.50.0.13/FMISdoc//baseline/ 需求规格说明书
|
||||
(2)设计阶段
|
||||
功能设计、详细设计文档:
|
||||
商密【中】
|
||||
|
||||
文件编号 YG-CMMI-CM-PD07
|
||||
远光软件股份有限公司
|
||||
发布日期 2014-09-23
|
||||
现行版本 1.2
|
||||
基线库管理规范
|
||||
页次 第5页 共7页
|
||||
http:// 10.50.0.13/FMISdoc//baseline/设计文档/
|
||||
(3)测试阶段
|
||||
测试用例
|
||||
测试阶段工件列入VSS管理
|
||||
(4)开发阶段的代码管理
|
||||
统一列入ClearCase管理,依照《YG-CMMI-CM-PD04 配置管理规范》执行
|
||||
(5)项目开发立项材料
|
||||
项目开发立项材料
|
||||
http:// 10.50.0.13/FMISdoc//baseline/XXX(项目名称)/ 项目开发立项材料
|
||||
(6)项目结项材料
|
||||
项目结项材料
|
||||
http:// 10.50.0.13/FMISdoc//baseline/XXX(项目名称)/ 项目结项材料
|
||||
注:
|
||||
上述地址仅供参考,项目文档存储地址地址以实际立项计划中的要求为准。
|
||||
3.5 权限管理
|
||||
只允许本项目配置管理员有权限新增、删除、修改基线库内本项目的文档。
|
||||
其他项目干系人只能拥有本工作范围内工件的读取权限。
|
||||
3.6 入基线文档规范
|
||||
3.6.1 模板引用
|
||||
各阶段工件需按照公司CMMI研发体系中所发布的相应标准模板编写。
|
||||
商密【中】
|
||||
|
||||
文件编号 YG-CMMI-CM-PD07
|
||||
远光软件股份有限公司
|
||||
发布日期 2014-09-23
|
||||
现行版本 1.2
|
||||
基线库管理规范
|
||||
页次 第6页 共7页
|
||||
3.6.2 格式要求
|
||||
各个工件除了按照标准模板执行外,还需要遵循如下通用要求:
|
||||
1) 文档显示的默认比例必须为100%;
|
||||
2) 正式文档必须记录审核人、批准人;
|
||||
3) 各个模板中,相应章节若无内容时必须写“无”来表明,而不允许直接删除本章节或留空。
|
||||
3.7 文档入基线及基线变更的充分条件
|
||||
文档入基线或申请变更基线文件时,必须输入入基线申请(变更申请),并保留有审批记录。
|
||||
入基线申请(变更申请)和审批记录,必须以正式的方式提交,如:依照RTC流程在相应单据中填写
|
||||
提交、或正式邮件提交。一切口头的或者利用其他交流工具提交的申请,都视为不符合。
|
||||
3.7.1 XX资料已入基线的邮件
|
||||
发件人:项目级配置管理师
|
||||
收件人:编写人(变更处理人)
|
||||
抄送人:配置经理、项目经理、资料使用人、QA
|
||||
邮件标题:关于XX资料已入基线的通知
|
||||
附件:无
|
||||
邮件内容模板如下:
|
||||
编写人(变更处理人):
|
||||
您好!
|
||||
XX资料于MM-DD(周X)入基线,获取地址如下:XXX。
|
||||
配置管理工程师:XXX
|
||||
20XX年X月X日
|
||||
商密【中】
|
||||
|
||||
| | | | 文件编号 | YG-CMMI-CM-PD07 |
|
||||
| --- | --- | --- | ----- | ---------------- |
|
||||
远光软件股份有限公司
|
||||
| | | | 发布日期 | 2014-09-23 |
|
||||
| --- | --- | --- | ----- | ----------- |
|
||||
| | | | 现行版本 | 1.2 |
|
||||
基线库管理规范
|
||||
| | | | 页次 | 第7页 共7页 |
|
||||
| --- | --- | --- | --- | -------- |
|
||||
|
||||
4. 相关文档
|
||||
《YG-CMMI-CM-PC04 配置管理过程》
|
||||
《YG-CMMI-CM-PD04 配置管理规范》
|
||||
《YG-CMMI-PP-TEMP02 项目计划模板》
|
||||
《YG-CMMI-CM-TEMP13 配置管理计划模板》
|
||||
参考资料
|
||||
5.
|
||||
| 名称 | 来源 | 版本/日期 | | |
|
||||
| --- | --- | ------ | --- | --- |
|
||||
| | | | | |
|
||||
|
||||
商密【中】
|
||||
@@ -0,0 +1,266 @@
|
||||
文件编号:YG-CMMI-CM-PD07
|
||||
发布日期:2023-06-30
|
||||
现行版本:1.3
|
||||
|
||||
商密【中】
|
||||
|
||||
基线库管理规范
|
||||
|
||||
修订历史记录
|
||||
| 日期 | 版本 | 说明 | 作者/修改人 | 审核 | 批准 |
|
||||
| ----------- | -------- | -------- | ------- | ---- | ---- |
|
||||
| 2012-11-14 | 1.0 新增 | | 吴建春 | 李锋 | 卢晓民 |
|
||||
| | 在规范描述中增加 | EAM 产品的内 | | | |
|
||||
| 2013-7-23 | 1.1 | | 陈来方 | 卢晓民 | 周立 |
|
||||
容和入基线的标准邮件
|
||||
调整“适用部门”、“相关文档”
|
||||
| 2014-09-23 | 1.2 章节、根据最新组织机构调整本 | | 吴建春 | 卢晓民 | 李美平 |
|
||||
| ----------- | ------------------- | --- | ---- | ---- | ---- |
|
||||
文档引用的部门名称
|
||||
修订页眉中的商标引用,更新规
|
||||
| 2023-06-30 | 1.3 | | 李锋 | 刘娟 | 向万红 |
|
||||
| ----------- | ---- | --- | --- | --- | ---- |
|
||||
范描述
|
||||
| | | | | | |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| | | | | | |
|
||||
|
||||
远光软件股份有限公司 发布
|
||||
|
||||
文件编号 YG-CMMI-CM-PD07
|
||||
远光软件股份有限公司
|
||||
发布日期 2014-09-23
|
||||
现行版本 1.2
|
||||
基线库管理规范
|
||||
页次 第1页 共7页
|
||||
目录
|
||||
1. 引言 ............................................................................................................................................................................ 2
|
||||
1.1 目的 ................................................................................................................................................................... 2
|
||||
1.2 适用范围 ........................................................................................................................................................... 2
|
||||
1.2.1 适用部门 ................................................................................................................................................... 2
|
||||
1.2.2 适用业务 ................................................................................................................................................... 2
|
||||
1.3 术语和缩略语 ................................................................................................................................................... 2
|
||||
2. 角色与职责 ................................................................................................................................................................ 2
|
||||
3. 规范描述 .................................................................................................................................................................... 3
|
||||
3.1 纳入基线管理的工作产品范围 ........................................................................................................................ 3
|
||||
3.2 通知入基线角色 ............................................................................................................................................... 3
|
||||
3.3 通知入基线时机 ............................................................................................................................................... 4
|
||||
3.4 文档存储地址 ................................................................................................................................................... 4
|
||||
3.5 权限管理 ........................................................................................................................................................... 5
|
||||
3.6 入基线文档规范 ............................................................................................................................................... 5
|
||||
3.6.1 模板引用 ................................................................................................................................................... 5
|
||||
3.6.2 格式要求 ................................................................................................................................................... 6
|
||||
3.7 文档入基线及基线变更的充分条件 ................................................................................................................ 6
|
||||
3.7.1 XX资料已入基线的邮件 .......................................................................................................................... 6
|
||||
4. 相关文档 .................................................................................................................................................................... 7
|
||||
5. 参考资料 .................................................................................................................................................................... 7
|
||||
商密【中】
|
||||
|
||||
| | | | 文件编号 | YG-CMMI-CM-PD07 |
|
||||
| --- | --- | --- | ----- | ---------------- |
|
||||
远光软件股份有限公司
|
||||
| | | | 发布日期 | 2014-09-23 |
|
||||
| --- | --- | --- | ----- | ----------- |
|
||||
| | | | 现行版本 | 1.2 |
|
||||
基线库管理规范
|
||||
| | | | 页次 | 第2页 共7页 |
|
||||
| --- | --- | --- | --- | -------- |
|
||||
|
||||
引言
|
||||
1.
|
||||
目的
|
||||
1.1
|
||||
为加强对研发线各阶段所输出工件入配置基线库活动的管理,明确规定入基线库的工件范围、及工件
|
||||
入基线库的时效性,特补充本规范。
|
||||
1.2 适用范围
|
||||
1.2.1 适用部门
|
||||
适用于公司产品研发部门、全资子公司,控股子公司参考执行。
|
||||
1.2.2 适用业务
|
||||
各产品研发线,在各阶段输出需入基线库工件的管理。
|
||||
1.3 术语和缩略语
|
||||
术语/缩略语 解释
|
||||
| CM(Configuration Management: | | 是软件工程中的一项规程,包括相关工具和应用技术(过程和方 | | |
|
||||
| ---------------------------- | --- | ------------------------------- | --- | --- |
|
||||
| 配置管理) | | 法),公司用它来管理软件资产变更。 | | |
|
||||
| BL (Base Line:基线) | | 软件开发过程中的里程碑,它以一或多个软件配置项的交付为标 | | |
|
||||
志。基线由已经通过正式评审和批准的某规约或产品组成,它因
|
||||
|
||||
此可以作为进一步开发的基础,并且只能通过正式的变更控制过
|
||||
程才能够改变。
|
||||
| 工件 | | 软件研发生命周期各阶段的工作产品 | | |
|
||||
| --- | --- | -------------------- | --- | --- |
|
||||
|
||||
2. 角色与职责
|
||||
| 序号 | 角色 | 职责 | | |
|
||||
| --- | --- | --- | --- | --- |
|
||||
商密【中】
|
||||
|
||||
| | | | 文件编号 | YG-CMMI-CM-PD07 |
|
||||
| --- | --- | --- | ----- | ---------------- |
|
||||
远光软件股份有限公司
|
||||
| | | | 发布日期 | 2014-09-23 |
|
||||
| --- | --- | --- | ----- | ----------- |
|
||||
| | | | 现行版本 | 1.2 |
|
||||
基线库管理规范
|
||||
| | | | 页次 | 第3页 共7页 |
|
||||
| --- | --- | --- | --- | -------- |
|
||||
|
||||
负责将评审通过之后的文件入基线库
|
||||
配置管理员
|
||||
| 1 | | | | |
|
||||
| --- | --- | --- | --- | --- |
|
||||
负责将变更后的文件重新入基线库
|
||||
|
||||
负责确定项目哪些工作产品需入基线库管理
|
||||
项 目经理
|
||||
| 2 | | 负责管理并要求配置管理员按要求将各阶段工作产品入基线库 | | |
|
||||
| --- | --- | ------------------------------- | --- | --- |
|
||||
负责申请项目开发立项、发版材料入基线
|
||||
需求\设计\开发\测试
|
||||
负责参与工件入基线前的评审;
|
||||
| 3 | | | | |
|
||||
| --- | --- | --- | --- | --- |
|
||||
责任人
|
||||
负责申请各阶段工作产品入基线库
|
||||
|
||||
负责审计各阶段工作产品是否按要求入基线库
|
||||
QA工程师
|
||||
| 4 | | | | |
|
||||
| --- | --- | --- | --- | --- |
|
||||
负责审计各工作产品的完整性和符合性
|
||||
规范描述
|
||||
3.
|
||||
3.1 纳入基线管理的工作产品范围
|
||||
| | 工件 | 阶段 | | |
|
||||
| --------- | --- | ----- | --- | --- |
|
||||
| 产品需求说明书 | | 需求阶段 | | |
|
||||
| 需求规格说明书 | | 需求阶段 | | |
|
||||
| 详细需求说明书 | | 需求阶段 | | |
|
||||
| 功能设计文档 | | 设计阶段 | | |
|
||||
| 详细设计文档 | | 设计阶段 | | |
|
||||
| 测试用例 | | 测试阶段 | | |
|
||||
| 项目开发立项材料 | | 立项阶段 | | |
|
||||
| 项目结项材料 | | 结项阶段 | | |
|
||||
注:
|
||||
1)开发阶段的代码管理依据《YG-CMMI-CM-PD04 配置管理规范》执行。
|
||||
2)发版阶段:集成测试结束之后,配置项清单检查之前。
|
||||
通知入基线角色
|
||||
3.2
|
||||
|
||||
| 工件 | 入基线角色 | | | |
|
||||
| -------- | ------ | --- | --- | --- |
|
||||
| 产品需求说明书 | 需求责任人 | | | |
|
||||
商密【中】
|
||||
|
||||
文件编号 YG-CMMI-CM-PD07
|
||||
远光软件股份有限公司
|
||||
发布日期 2014-09-23
|
||||
现行版本 1.2
|
||||
基线库管理规范
|
||||
页次 第4页 共7页
|
||||
需求规格说明书 需求责任人
|
||||
详细需求说明书 需求责任人
|
||||
功能设计文档 详细设计人员
|
||||
详细设计文档 详细设计人员
|
||||
测试用例 测试责任人
|
||||
项目开发立项材料 项目经理
|
||||
项目结项材料 项目经理
|
||||
3.3 通知入基线时机
|
||||
工件 入基线时机
|
||||
产品需求说明书 产品需求评审之后
|
||||
需求规格说明书 设计评审之后
|
||||
详细需求说明书评审之
|
||||
详细需求说明书
|
||||
后
|
||||
功能设计文档 评审之后
|
||||
详细设计文档 评审之后
|
||||
测试用例 测试用例评审之后
|
||||
项目开发立项材料 立项评审之后
|
||||
项目结项材料 结项评审之后
|
||||
3.4 文档存储地址
|
||||
(1)需求阶段
|
||||
需求规格说明书
|
||||
http:// 10.50.0.13/FMISdoc//baseline/ 需求规格说明书
|
||||
(2)设计阶段
|
||||
功能设计、详细设计文档:
|
||||
商密【中】
|
||||
|
||||
文件编号 YG-CMMI-CM-PD07
|
||||
远光软件股份有限公司
|
||||
发布日期 2014-09-23
|
||||
现行版本 1.2
|
||||
基线库管理规范
|
||||
页次 第5页 共7页
|
||||
http:// 10.50.0.13/FMISdoc//baseline/设计文档/
|
||||
(3)测试阶段
|
||||
测试用例
|
||||
测试阶段工件列入VSS管理
|
||||
(4)开发阶段的代码管理
|
||||
统一列入ClearCase管理,依照《YG-CMMI-CM-PD04 配置管理规范》执行
|
||||
(5)项目开发立项材料
|
||||
项目开发立项材料
|
||||
http:// 10.50.0.13/FMISdoc//baseline/XXX(项目名称)/ 项目开发立项材料
|
||||
(6)项目结项材料
|
||||
项目结项材料
|
||||
http:// 10.50.0.13/FMISdoc//baseline/XXX(项目名称)/ 项目结项材料
|
||||
注:
|
||||
上述地址仅供参考,项目文档存储地址地址以实际立项计划中的要求为准。
|
||||
3.5 权限管理
|
||||
只允许本项目配置管理员有权限新增、删除、修改基线库内本项目的文档。
|
||||
其他项目干系人只能拥有本工作范围内工件的读取权限。
|
||||
3.6 入基线文档规范
|
||||
3.6.1 模板引用
|
||||
各阶段工件需按照公司CMMI研发体系中所发布的相应标准模板编写。
|
||||
商密【中】
|
||||
|
||||
文件编号 YG-CMMI-CM-PD07
|
||||
远光软件股份有限公司
|
||||
发布日期 2014-09-23
|
||||
现行版本 1.2
|
||||
基线库管理规范
|
||||
页次 第6页 共7页
|
||||
3.6.2 格式要求
|
||||
各个工件除了按照标准模板执行外,还需要遵循如下通用要求:
|
||||
1) 文档显示的默认比例必须为100%;
|
||||
2) 正式文档必须记录审核人、批准人;
|
||||
3) 各个模板中,相应章节若无内容时必须写“无”来表明,而不允许直接删除本章节或留空。
|
||||
3.7 文档入基线及基线变更的充分条件
|
||||
文档入基线或申请变更基线文件时,必须输入入基线申请(变更申请),并保留有审批记录。
|
||||
入基线申请(变更申请)和审批记录,必须以正式的方式提交,如:依照RTC流程在相应单据中填写
|
||||
提交、或正式邮件提交。一切口头的或者利用其他交流工具提交的申请,都视为不符合。
|
||||
3.7.1 XX资料已入基线的邮件
|
||||
发件人:项目级配置管理师
|
||||
收件人:编写人(变更处理人)
|
||||
抄送人:配置经理、项目经理、资料使用人、QA
|
||||
邮件标题:关于XX资料已入基线的通知
|
||||
附件:无
|
||||
邮件内容模板如下:
|
||||
编写人(变更处理人):
|
||||
您好!
|
||||
XX资料于MM-DD(周X)入基线,获取地址如下:XXX。
|
||||
配置管理工程师:XXX
|
||||
20XX年X月X日
|
||||
商密【中】
|
||||
|
||||
| | | | 文件编号 | YG-CMMI-CM-PD07 |
|
||||
| --- | --- | --- | ----- | ---------------- |
|
||||
远光软件股份有限公司
|
||||
| | | | 发布日期 | 2014-09-23 |
|
||||
| --- | --- | --- | ----- | ----------- |
|
||||
| | | | 现行版本 | 1.2 |
|
||||
基线库管理规范
|
||||
| | | | 页次 | 第7页 共7页 |
|
||||
| --- | --- | --- | --- | -------- |
|
||||
|
||||
4. 相关文档
|
||||
《YG-CMMI-CM-PC04 配置管理过程》
|
||||
《YG-CMMI-CM-PD04 配置管理规范》
|
||||
《YG-CMMI-PP-TEMP02 项目计划模板》
|
||||
《YG-CMMI-CM-TEMP13 配置管理计划模板》
|
||||
参考资料
|
||||
5.
|
||||
| 名称 | 来源 | 版本/日期 | | |
|
||||
| --- | --- | ------ | --- | --- |
|
||||
| | | | | |
|
||||
|
||||
商密【中】
|
||||
@@ -0,0 +1,394 @@
|
||||
文件编号:YG-CMMI-CM-PD04
|
||||
发布日期:2023-06-30
|
||||
现行版本:2.2
|
||||
|
||||
商密【中】
|
||||
|
||||
代码提交规范
|
||||
|
||||
修订历史记录
|
||||
|
||||
日期
|
||||
2013-08-5
|
||||
|
||||
版本
|
||||
1.0 新增代码提交规范 张金金
|
||||
|
||||
批准
|
||||
李剑/陈明有 周立
|
||||
|
||||
作者/修改人
|
||||
|
||||
说明
|
||||
|
||||
审核
|
||||
|
||||
2014-03-24
|
||||
|
||||
1.1
|
||||
|
||||
2017-08-30
|
||||
|
||||
1.2
|
||||
|
||||
2022-09-9
|
||||
|
||||
2.0
|
||||
|
||||
2023-02-20
|
||||
|
||||
2.1
|
||||
|
||||
2023-06-30
|
||||
|
||||
2.2
|
||||
|
||||
张羡
|
||||
|
||||
杨莹
|
||||
|
||||
陈金银
|
||||
|
||||
陈斯华
|
||||
|
||||
李美平
|
||||
|
||||
增加代码提交时需写注释,便于构
|
||||
建系统识别变更集
|
||||
增加提交代码总则,增加附注 ”GRIS
|
||||
模块代码复审说明及操作”
|
||||
修订 1.2.1 适用部门 ;
|
||||
新增 2 角色与职责;
|
||||
新增 3 权限管理;
|
||||
修订 4.1 代码提交原则;
|
||||
修订 4.3.1 RTC 提交代码规范;
|
||||
新增 4.3.3 GIT 提交代码规范。
|
||||
修订适用范围、代码提交原则、增加
|
||||
代码库明细表。
|
||||
修订页眉中的商标引用,删除 RTC 代
|
||||
码提交规范章节
|
||||
|
||||
姚国全
|
||||
陈金银 刘发/王优
|
||||
|
||||
陈金银 黄德海
|
||||
|
||||
贾士中
|
||||
|
||||
向万红
|
||||
|
||||
姚国全
|
||||
|
||||
李锋
|
||||
|
||||
刘娟
|
||||
|
||||
远光软件股份有限公司 发布
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-06-30
|
||||
|
||||
2.2
|
||||
第 1 页 共 6 页
|
||||
|
||||
目 录
|
||||
|
||||
1. 引言 ................................................................................................................................................... 2
|
||||
1.1. 目的 ............................................................................................................................................................2
|
||||
1.2. 适用范围 ....................................................................................................................................................2
|
||||
1.2.1. 适用部门 ................................................................................................................................................2
|
||||
1.2.2. 适应业务 ................................................................................................................................................2
|
||||
2. 角色与职责 ............................................................................................................................................... 2
|
||||
3. 权限管理 ........................................................................................................................................... 2
|
||||
3.1. 用户管理及授权原则 ........................................................................................................................................2
|
||||
3.2. 代码权限开通或关闭流程 ........................................................................................................................3
|
||||
4. 规范描述 ........................................................................................................................................... 4
|
||||
4.1. 代码提交原则 ............................................................................................................................................4
|
||||
4.2. 代码库管理工具的特性规范 ....................................................................................................................4
|
||||
CC(ClearCase)提交代码规范 ..........................................................................................................4
|
||||
4.2.1.
|
||||
GIT 提交代码规范 .................................................................................................................................5
|
||||
4.2.2.
|
||||
5. 相关附件 ........................................................................................................................................... 5
|
||||
6. 相关文档 ........................................................................................................................................... 5
|
||||
7. 附代码库明细表(供参考) .............................................................................................................. 5
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-04-06
|
||||
|
||||
2.1
|
||||
第 2 页 共 6 页
|
||||
|
||||
1. 引言
|
||||
|
||||
1.1. 目的
|
||||
|
||||
为统一规范代码库用户管理及授权控制,规范代码提交,保证代码的安全性、完整性、可追溯性,
|
||||
|
||||
特制定本规范,用以保障代码管理工具 GIT 和 CC(ClearCase)等提交代码活动的有序开展。
|
||||
|
||||
1.2. 适用范围
|
||||
|
||||
1.2.1. 适用部门
|
||||
|
||||
适用于公司产品研发部门、全资子公司,控股子公司参考执行。
|
||||
|
||||
1.2.2. 适应业务
|
||||
|
||||
项目代码交付。
|
||||
|
||||
2. 角色与职责
|
||||
|
||||
序号
|
||||
|
||||
角色
|
||||
|
||||
职责
|
||||
|
||||
1
|
||||
|
||||
2
|
||||
|
||||
部门经理
|
||||
|
||||
项目经理
|
||||
/开发经理
|
||||
|
||||
负责审批本部门员工(含借调)提起的跨项目组代码权限申请。
|
||||
负责审批项目组内员工(含借调)提起的代码权限申请。
|
||||
及时关闭项目组调出、离职员工的代码权限。
|
||||
|
||||
3
|
||||
|
||||
开发工程师
|
||||
|
||||
4
|
||||
|
||||
配置管理工程师
|
||||
|
||||
负责发起代码权限开通或关闭申请。
|
||||
明确代码库权限开通或关闭范围。
|
||||
了解代码库使用规范及要求。
|
||||
借调员工加入项目组的接受项目组统一管理。
|
||||
员工调岗、离职时需及时申请权限关闭。
|
||||
负责代码库权限的设置。
|
||||
协助项目成员正常使用代码库。
|
||||
填写单据相关信息,更改单据状态。
|
||||
|
||||
3. 权限管理
|
||||
|
||||
3.1. 用户管理及授权原则
|
||||
1) 用户代码权限,须经过项目经理(开发经理)或者部门经理审批,在审批通过后方可设置权限。
|
||||
|
||||
2) 开通代码权限的用户,须妥善保管好自己的帐号和密码,不得转借他人使用,避免由此带来的泄密
|
||||
|
||||
及代码追溯困难等问题的风险。
|
||||
|
||||
3) 开通了代码权限的用户,发现帐号/密码泄漏,须及时修改密码,设置的密码应符合公司安全规范。
|
||||
|
||||
因不遵守规范造成严重后果的,将按公司相关要求处理。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-04-06
|
||||
|
||||
2.1
|
||||
第 3 页 共 6 页
|
||||
|
||||
4) 开通了代码权限的用户,须严格按照代码提交规范要求及对应工具的操作手册进行代码提交,确保
|
||||
|
||||
代码的正确性、完整性及可追溯性。
|
||||
|
||||
5) 开通了代码权限的用户,在调岗、离职时,需将代码交付完整后,按流程申请权限关闭。
|
||||
|
||||
3.2. 代码权限开通或关闭流程
|
||||
|
||||
入口准则
|
||||
|
||||
1
|
||||
输入
|
||||
1
|
||||
|
||||
需要代码库权限开通或关闭
|
||||
|
||||
无
|
||||
|
||||
过程步骤
|
||||
|
||||
1.1 申请人在公司研发管理平台上新建《代码库权限申请单》,提交代码权限开通或关闭申请。
|
||||
申请人在《代码库权限申请单》填写相关内容,包括代码库地址、权限说明、执行人及其
|
||||
它需说明的内容,申请人申请所在项目组代码库权限的由项目经理(开发经理)审批,申
|
||||
|
||||
1.2
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-04-06
|
||||
|
||||
2.1
|
||||
第 4 页 共 6 页
|
||||
|
||||
请部门其他项目组代码库权限的由项目归属的部门经理审批。
|
||||
|
||||
1.3 申请人将《代码库权限申请单》提交给部门经理、或项目经理(开发经理)审批。
|
||||
|
||||
1.4 部门经理、或项目经理(开发经理)审批通过,转单给配置管理工程师进行权限设置。
|
||||
|
||||
1.5 配置管理工程师按单据设置相应代码权限,并完善单据信息,变更单据状态。
|
||||
|
||||
输出
|
||||
1
|
||||
|
||||
《代码库权限申请单》
|
||||
|
||||
出口准则
|
||||
|
||||
1
|
||||
|
||||
《代码库权限申请单》完整填写,权限已设置,单据内容已完善,单据状态已更改为结束。
|
||||
|
||||
裁剪
|
||||
裁剪内容 不可裁剪
|
||||
裁剪准则 无
|
||||
|
||||
4. 规范描述
|
||||
|
||||
4.1. 代码提交原则
|
||||
|
||||
1) 遵守已发布文档《YG-CMMI-CM-PD04 配置管理规范》中关于代码管理的所有原则。
|
||||
|
||||
2) 依据研发管理平台单据交付代码,没纳入版本的需求单/工作单,不允许提交代码至代码库。
|
||||
|
||||
3) 交付代码时必须按单号正确填写注释,格式如下:
|
||||
|
||||
注释必须含研发管理平台单据号,遵循以下三种要求:
|
||||
格式 1:单号 示例 843186
|
||||
格式 2:单号+空格+注释,示例 843186 注释内容
|
||||
格式 3:一个变更集可以对应多个单号,需都写入注释中,示例 843186 843187 注释内容
|
||||
补充说明:
|
||||
因解决编译报错修改的代码,关联导致编译报错时的代码变更集单据。
|
||||
解决合并冲突产生的变更集,关联产生冲突时的代码变更集单据。
|
||||
|
||||
4) 代码在本地构建通过后才能交付至代码库。
|
||||
|
||||
5) 所有提交发布流(分支)、受控流(分支)的代码需经复审后才可正式提交。各代码流(或分支)
|
||||
的具体管理要求请遵照发布文档《YG-CMMI-CM-PD04 配置管理规范(试行).pdf》中涉及的关于代
|
||||
码管理的所有原则。
|
||||
|
||||
6) 公司产品研发部门所有代码库的发布流(分支)、受控流(分支),原则上由配置管理工程师统一
|
||||
|
||||
创建和管理。
|
||||
|
||||
7) 未按以上原则进行代码提交和管理,造成代码问题的,依据公司相关规定进行处理。
|
||||
|
||||
4.2. 代码库管理工具的特性规范
|
||||
|
||||
4.2.1. CC(ClearCase)提交代码规范
|
||||
|
||||
1) 按单据号在研发管理平台上申请权限,由研发管理部部门经理审批后开通权限。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-04-06
|
||||
|
||||
2.1
|
||||
第 5 页 共 6 页
|
||||
|
||||
2) 开发工程师在 CC 中提交代码,选中要检出的文件,填写修改该文件的研发管理平台中单据号,如
|
||||
|
||||
果多个文件需要同时修改,则选中多个文件,一起检出,填写一个单号即可。
|
||||
|
||||
3) 每次创建单号后,CC 都会记录,提示框显示出来的单号如果正确,无需重新创建单号。如果没有,
|
||||
|
||||
创建即可。同一个单号修改多个文件,无需多次创建同一单号。
|
||||
|
||||
4) 详细的 Clearcase 操作指南请参见附件《YG-CMMI-CM-GD01 ClearcaseLT 客户端操作指南.doc》。
|
||||
|
||||
4.2.2. GIT 提交代码规范
|
||||
|
||||
1) GIT 代码库因其分支灵活的特点,无法进行统一管控,项目组因各种原因须建立个人分支,须邮件
|
||||
向项目经理申请,项目经理审批通过后方可建立,对建立的个人分支,配置管理工程师不纳入整体
|
||||
的代码流管理,项目组需妥善管控,并定期清理,由此类分支管理混乱造成代码问题及引发严重后
|
||||
果的,依据公司相关规定进行处理。
|
||||
|
||||
2) 详细的 GIT 操作手册请参见附件《YG-CMMI-CM-GD05 Git 使用手册-开发工程师》。
|
||||
|
||||
5. 相关附件
|
||||
|
||||
《YG-CMMI-CM-GD04 Git 安装指南-开发工程师》
|
||||
|
||||
《YG-CMMI-CM-GD05 Git 使用手册-开发工程师》
|
||||
|
||||
《YG-CMMI-CM-GD06 GAP 模块代码复审操作说明》
|
||||
|
||||
《RTC 操作手册-开发工程师》
|
||||
|
||||
6. 相关文档
|
||||
|
||||
《YG-CMMI-CM-PD04 配置管理规范》
|
||||
|
||||
《YG-CMMI-CM-PD03 配置项标识规范》
|
||||
|
||||
《YG-CMMI-CM-GD01 ClearcaseLT 客户端操作指南》
|
||||
|
||||
7. 附代码库明细表(供参考)
|
||||
|
||||
代码库明细表.xls
|
||||
|
||||
商密【中】
|
||||
|
||||
@@ -0,0 +1,394 @@
|
||||
文件编号:YG-CMMI-CM-PD04
|
||||
发布日期:2023-06-30
|
||||
现行版本:2.2
|
||||
|
||||
商密【中】
|
||||
|
||||
代码提交规范
|
||||
|
||||
修订历史记录
|
||||
|
||||
日期
|
||||
2013-08-5
|
||||
|
||||
版本
|
||||
1.0 新增代码提交规范 张金金
|
||||
|
||||
批准
|
||||
李剑/陈明有 周立
|
||||
|
||||
作者/修改人
|
||||
|
||||
审核
|
||||
|
||||
说明
|
||||
|
||||
2014-03-24
|
||||
|
||||
1.1
|
||||
|
||||
2017-08-30
|
||||
|
||||
1.2
|
||||
|
||||
2022-09-9
|
||||
|
||||
2.0
|
||||
|
||||
2023-02-20
|
||||
|
||||
2.1
|
||||
|
||||
2023-06-30
|
||||
|
||||
2.2
|
||||
|
||||
张羡
|
||||
|
||||
杨莹
|
||||
|
||||
陈金银
|
||||
|
||||
陈斯华
|
||||
|
||||
李美平
|
||||
|
||||
增加代码提交时需写注释,便于构
|
||||
建系统识别变更集
|
||||
增加提交代码总则,增加附注 ”GRIS
|
||||
模块代码复审说明及操作”
|
||||
修订 1.2.1 适用部门 ;
|
||||
新增 2 角色与职责;
|
||||
新增 3 权限管理;
|
||||
修订 4.1 代码提交原则;
|
||||
修订 4.3.1 RTC 提交代码规范;
|
||||
新增 4.3.3 GIT 提交代码规范。
|
||||
修订适用范围、代码提交原则、增加
|
||||
代码库明细表。
|
||||
修订页眉中的商标引用,删除 RTC 代
|
||||
码提交规范章节
|
||||
|
||||
姚国全
|
||||
陈金银 刘发/王优
|
||||
|
||||
陈金银 黄德海
|
||||
|
||||
贾士中
|
||||
|
||||
向万红
|
||||
|
||||
姚国全
|
||||
|
||||
李锋
|
||||
|
||||
刘娟
|
||||
|
||||
远光软件股份有限公司 发布
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-06-30
|
||||
|
||||
2.2
|
||||
第 1 页 共 6 页
|
||||
|
||||
目 录
|
||||
|
||||
1. 引言 ................................................................................................................................................... 2
|
||||
1.1. 目的 ............................................................................................................................................................2
|
||||
1.2. 适用范围 ....................................................................................................................................................2
|
||||
1.2.1. 适用部门 ................................................................................................................................................2
|
||||
1.2.2. 适应业务 ................................................................................................................................................2
|
||||
2. 角色与职责 ............................................................................................................................................... 2
|
||||
3. 权限管理 ........................................................................................................................................... 2
|
||||
3.1. 用户管理及授权原则 ........................................................................................................................................2
|
||||
3.2. 代码权限开通或关闭流程 ........................................................................................................................3
|
||||
4. 规范描述 ........................................................................................................................................... 4
|
||||
4.1. 代码提交原则 ............................................................................................................................................4
|
||||
4.2. 代码库管理工具的特性规范 ....................................................................................................................4
|
||||
CC(ClearCase)提交代码规范 ..........................................................................................................4
|
||||
4.2.1.
|
||||
GIT 提交代码规范 .................................................................................................................................5
|
||||
4.2.2.
|
||||
5. 相关附件 ........................................................................................................................................... 5
|
||||
6. 相关文档 ........................................................................................................................................... 5
|
||||
7. 附代码库明细表(供参考) .............................................................................................................. 5
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-04-06
|
||||
|
||||
2.1
|
||||
第 2 页 共 6 页
|
||||
|
||||
1. 引言
|
||||
|
||||
1.1. 目的
|
||||
|
||||
为统一规范代码库用户管理及授权控制,规范代码提交,保证代码的安全性、完整性、可追溯性,
|
||||
|
||||
特制定本规范,用以保障代码管理工具 GIT 和 CC(ClearCase)等提交代码活动的有序开展。
|
||||
|
||||
1.2. 适用范围
|
||||
|
||||
1.2.1. 适用部门
|
||||
|
||||
适用于公司产品研发部门、全资子公司,控股子公司参考执行。
|
||||
|
||||
1.2.2. 适应业务
|
||||
|
||||
项目代码交付。
|
||||
|
||||
2. 角色与职责
|
||||
|
||||
序号
|
||||
|
||||
角色
|
||||
|
||||
职责
|
||||
|
||||
1
|
||||
|
||||
2
|
||||
|
||||
部门经理
|
||||
|
||||
项目经理
|
||||
/开发经理
|
||||
|
||||
负责审批本部门员工(含借调)提起的跨项目组代码权限申请。
|
||||
负责审批项目组内员工(含借调)提起的代码权限申请。
|
||||
及时关闭项目组调出、离职员工的代码权限。
|
||||
|
||||
3
|
||||
|
||||
开发工程师
|
||||
|
||||
4
|
||||
|
||||
配置管理工程师
|
||||
|
||||
负责发起代码权限开通或关闭申请。
|
||||
明确代码库权限开通或关闭范围。
|
||||
了解代码库使用规范及要求。
|
||||
借调员工加入项目组的接受项目组统一管理。
|
||||
员工调岗、离职时需及时申请权限关闭。
|
||||
负责代码库权限的设置。
|
||||
协助项目成员正常使用代码库。
|
||||
填写单据相关信息,更改单据状态。
|
||||
|
||||
3. 权限管理
|
||||
|
||||
3.1. 用户管理及授权原则
|
||||
1) 用户代码权限,须经过项目经理(开发经理)或者部门经理审批,在审批通过后方可设置权限。
|
||||
|
||||
2) 开通代码权限的用户,须妥善保管好自己的帐号和密码,不得转借他人使用,避免由此带来的泄密
|
||||
|
||||
及代码追溯困难等问题的风险。
|
||||
|
||||
3) 开通了代码权限的用户,发现帐号/密码泄漏,须及时修改密码,设置的密码应符合公司安全规范。
|
||||
|
||||
因不遵守规范造成严重后果的,将按公司相关要求处理。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-04-06
|
||||
|
||||
2.1
|
||||
第 3 页 共 6 页
|
||||
|
||||
4) 开通了代码权限的用户,须严格按照代码提交规范要求及对应工具的操作手册进行代码提交,确保
|
||||
|
||||
代码的正确性、完整性及可追溯性。
|
||||
|
||||
5) 开通了代码权限的用户,在调岗、离职时,需将代码交付完整后,按流程申请权限关闭。
|
||||
|
||||
3.2. 代码权限开通或关闭流程
|
||||
|
||||
入口准则
|
||||
|
||||
1
|
||||
输入
|
||||
1
|
||||
|
||||
需要代码库权限开通或关闭
|
||||
|
||||
无
|
||||
|
||||
过程步骤
|
||||
|
||||
1.1 申请人在公司研发管理平台上新建《代码库权限申请单》,提交代码权限开通或关闭申请。
|
||||
申请人在《代码库权限申请单》填写相关内容,包括代码库地址、权限说明、执行人及其
|
||||
它需说明的内容,申请人申请所在项目组代码库权限的由项目经理(开发经理)审批,申
|
||||
|
||||
1.2
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-04-06
|
||||
|
||||
2.1
|
||||
第 4 页 共 6 页
|
||||
|
||||
请部门其他项目组代码库权限的由项目归属的部门经理审批。
|
||||
|
||||
1.3 申请人将《代码库权限申请单》提交给部门经理、或项目经理(开发经理)审批。
|
||||
|
||||
1.4 部门经理、或项目经理(开发经理)审批通过,转单给配置管理工程师进行权限设置。
|
||||
|
||||
1.5 配置管理工程师按单据设置相应代码权限,并完善单据信息,变更单据状态。
|
||||
|
||||
输出
|
||||
1
|
||||
|
||||
《代码库权限申请单》
|
||||
|
||||
出口准则
|
||||
|
||||
1
|
||||
|
||||
《代码库权限申请单》完整填写,权限已设置,单据内容已完善,单据状态已更改为结束。
|
||||
|
||||
裁剪
|
||||
裁剪内容 不可裁剪
|
||||
裁剪准则 无
|
||||
|
||||
4. 规范描述
|
||||
|
||||
4.1. 代码提交原则
|
||||
|
||||
1) 遵守已发布文档《YG-CMMI-CM-PD04 配置管理规范》中关于代码管理的所有原则。
|
||||
|
||||
2) 依据研发管理平台单据交付代码,没纳入版本的需求单/工作单,不允许提交代码至代码库。
|
||||
|
||||
3) 交付代码时必须按单号正确填写注释,格式如下:
|
||||
|
||||
注释必须含研发管理平台单据号,遵循以下三种要求:
|
||||
格式 1:单号 示例 843186
|
||||
格式 2:单号+空格+注释,示例 843186 注释内容
|
||||
格式 3:一个变更集可以对应多个单号,需都写入注释中,示例 843186 843187 注释内容
|
||||
补充说明:
|
||||
因解决编译报错修改的代码,关联导致编译报错时的代码变更集单据。
|
||||
解决合并冲突产生的变更集,关联产生冲突时的代码变更集单据。
|
||||
|
||||
4) 代码在本地构建通过后才能交付至代码库。
|
||||
|
||||
5) 所有提交发布流(分支)、受控流(分支)的代码需经复审后才可正式提交。各代码流(或分支)
|
||||
的具体管理要求请遵照发布文档《YG-CMMI-CM-PD04 配置管理规范(试行).pdf》中涉及的关于代
|
||||
码管理的所有原则。
|
||||
|
||||
6) 公司产品研发部门所有代码库的发布流(分支)、受控流(分支),原则上由配置管理工程师统一
|
||||
|
||||
创建和管理。
|
||||
|
||||
7) 未按以上原则进行代码提交和管理,造成代码问题的,依据公司相关规定进行处理。
|
||||
|
||||
4.2. 代码库管理工具的特性规范
|
||||
|
||||
4.2.1. CC(ClearCase)提交代码规范
|
||||
|
||||
1) 按单据号在研发管理平台上申请权限,由研发管理部部门经理审批后开通权限。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
代码提交规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD04
|
||||
2023-04-06
|
||||
|
||||
2.1
|
||||
第 5 页 共 6 页
|
||||
|
||||
2) 开发工程师在 CC 中提交代码,选中要检出的文件,填写修改该文件的研发管理平台中单据号,如
|
||||
|
||||
果多个文件需要同时修改,则选中多个文件,一起检出,填写一个单号即可。
|
||||
|
||||
3) 每次创建单号后,CC 都会记录,提示框显示出来的单号如果正确,无需重新创建单号。如果没有,
|
||||
|
||||
创建即可。同一个单号修改多个文件,无需多次创建同一单号。
|
||||
|
||||
4) 详细的 Clearcase 操作指南请参见附件《YG-CMMI-CM-GD01 ClearcaseLT 客户端操作指南.doc》。
|
||||
|
||||
4.2.2. GIT 提交代码规范
|
||||
|
||||
1) GIT 代码库因其分支灵活的特点,无法进行统一管控,项目组因各种原因须建立个人分支,须邮件
|
||||
向项目经理申请,项目经理审批通过后方可建立,对建立的个人分支,配置管理工程师不纳入整体
|
||||
的代码流管理,项目组需妥善管控,并定期清理,由此类分支管理混乱造成代码问题及引发严重后
|
||||
果的,依据公司相关规定进行处理。
|
||||
|
||||
2) 详细的 GIT 操作手册请参见附件《YG-CMMI-CM-GD05 Git 使用手册-开发工程师》。
|
||||
|
||||
5. 相关附件
|
||||
|
||||
《YG-CMMI-CM-GD04 Git 安装指南-开发工程师》
|
||||
|
||||
《YG-CMMI-CM-GD05 Git 使用手册-开发工程师》
|
||||
|
||||
《YG-CMMI-CM-GD06 GAP 模块代码复审操作说明》
|
||||
|
||||
《RTC 操作手册-开发工程师》
|
||||
|
||||
6. 相关文档
|
||||
|
||||
《YG-CMMI-CM-PD04 配置管理规范》
|
||||
|
||||
《YG-CMMI-CM-PD03 配置项标识规范》
|
||||
|
||||
《YG-CMMI-CM-GD01 ClearcaseLT 客户端操作指南》
|
||||
|
||||
7. 附代码库明细表(供参考)
|
||||
|
||||
代码库明细表.xls
|
||||
|
||||
商密【中】
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,279 @@
|
||||
文件编号:YG-CMMI-CM-PD03
|
||||
发布日期:2023-06-30
|
||||
现行版本:1.2
|
||||
|
||||
商密【中】
|
||||
|
||||
配置项标识规范
|
||||
|
||||
修订历史记录
|
||||
|
||||
日期
|
||||
|
||||
版本
|
||||
|
||||
2008-06-19
|
||||
|
||||
1.0
|
||||
|
||||
说明
|
||||
新增文档,用于规范配置项标识
|
||||
工作,以便进行配置管理
|
||||
|
||||
2010-07-01
|
||||
2023-06-30
|
||||
|
||||
1.1 增加商密级别
|
||||
1.2 修订页眉中的商标引用
|
||||
|
||||
作者/修改人
|
||||
|
||||
审核
|
||||
|
||||
杨莹
|
||||
|
||||
吴建春
|
||||
李锋
|
||||
|
||||
周立
|
||||
|
||||
周立
|
||||
刘娟
|
||||
|
||||
批准
|
||||
|
||||
周立
|
||||
|
||||
周立
|
||||
向万红
|
||||
|
||||
远光软件股份有限公司 发布
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
配置项标识规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD03PD03
|
||||
2023-06-30
|
||||
|
||||
V1.2
|
||||
第 1 页 共 4 页
|
||||
|
||||
目 录
|
||||
|
||||
1. 引言 .......................................................................................................................................................... 2
|
||||
1.1. 目的 ....................................................................................................................................................................2
|
||||
1.1.1. 适用部门 ........................................................................................................................................................2
|
||||
1.1.2. 适用业务 ........................................................................................................................................................2
|
||||
1.2. 概述 ....................................................................................................................................................................2
|
||||
1.3. 术语和缩略语 ....................................................................................................................................................2
|
||||
2. 角色与职责 ............................................................................................................................................... 2
|
||||
3. 规范描述 ................................................................................................................................................... 2
|
||||
3.1. 配置项命名 ........................................................................................................................................................2
|
||||
3.1.1. 配置项/单元命名规范 ...................................................................................................................................2
|
||||
3.1.2. 配置单元中的配置项命名 ............................................................................................................................3
|
||||
3.2. 配置库对象标识 ................................................................................................................................................3
|
||||
3.2.1. 版本管理 ........................................................................................................................................................3
|
||||
3.2.2. 基线管理 ........................................................................................................................................................3
|
||||
3.2.3. 项目 ................................................................................................................................................................3
|
||||
3.2.4. 开发流 ............................................................................................................................................................3
|
||||
3.2.5. 活动 ................................................................................................................................................................3
|
||||
3.2.6. 视图 ................................................................................................................................................................3
|
||||
3.2.7. VOB .................................................................................................................................................................3
|
||||
3.2.8. componet 组件 ...............................................................................................................................................3
|
||||
3.2.9. 文件及文件夹 ................................................................................................................................................4
|
||||
4. 相关文档 ................................................................................................................................................... 4
|
||||
5. 参考资料 ................................................................................................................................................... 4
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
配置项标识规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD03
|
||||
2010-07-01
|
||||
|
||||
V1.1
|
||||
第 2 页 共 4 页
|
||||
|
||||
1. 引言
|
||||
|
||||
1.1. 目的
|
||||
|
||||
对纳入配置库的配置项统一标识,便于管理与查找。配置项的标识是为配置管理所使用的,不要和
|
||||
|
||||
文档编号混淆。
|
||||
|
||||
1.1.1. 适用部门
|
||||
|
||||
配置管理部门。
|
||||
|
||||
1.1.2. 适用业务
|
||||
|
||||
配置项的标识活动。
|
||||
|
||||
1.2. 概述
|
||||
|
||||
描述对项目或产品工件如何命名、标记和编号。标识方案涵盖硬件、系统软件以及产品目录结构中
|
||||
|
||||
列出的所有应用开发工件,例如,计划、模型、组件、测试软件、结果和数据、可执行文件,等等。
|
||||
|
||||
解释
|
||||
|
||||
由配置管理视为一个单一整体而进行处理的工作产品(例如:在
|
||||
软件生存周期各阶段所产生的各种形式和各种版本的文档、程
|
||||
序、数据等)以及完成工作产品所需的软件工具和支持系统。
|
||||
软件开发过程中的里程碑,它以一或多个软件配置项的交付为标
|
||||
志。基线由已经通过正式评审和批准的某规约或产品组成,它因
|
||||
此可以作为进一步开发的基础,并且只能通过正式的变更控制过
|
||||
程才能够改变.
|
||||
|
||||
1.3. 术语和缩略语
|
||||
|
||||
术语/缩略语
|
||||
|
||||
SCI(Software Configuration Item:
|
||||
软件配置项)
|
||||
|
||||
BL (BaseLine:基线)
|
||||
|
||||
2. 角色与职责
|
||||
|
||||
无
|
||||
|
||||
3. 规范描述
|
||||
|
||||
主要从配置项和配置库对象两个方面来定义如何进行标识,从而使配置库整洁有序。
|
||||
|
||||
3.1. 配置项命名
|
||||
|
||||
3.1.1. 配置项/单元命名规范
|
||||
|
||||
配置项/单元命名规范为:项目简称_配置项/单元名称
|
||||
|
||||
项目简称:为客户简称-项目名称缩写,应该是长度 8 位以内的英文字母与连接符的组合。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
配置项标识规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD03
|
||||
2010-07-01
|
||||
|
||||
V1.1
|
||||
第 3 页 共 4 页
|
||||
|
||||
(项目简称由项目经理提供)
|
||||
|
||||
3.1.2. 配置单元中的配置项命名
|
||||
|
||||
对于测试用例等配置单元,其中的配置项的命名与编号规范,可以根据项目实际情况做相应约定,
|
||||
|
||||
要求是体现配置项内容和所属功能模块等信息。
|
||||
|
||||
文档类的配置项,以文档名称进行标识,标识时注意唯一性与可追溯性;
|
||||
|
||||
源码类的配置项,可以直接使用程序名称作为配置项标识。
|
||||
|
||||
3.2. 配置库对象标识
|
||||
|
||||
3.2.1. 版本管理
|
||||
|
||||
配置项每check out/in 一次,自身的版本号就会升一,可以直接看到。不允许随便删除版本,尤其是
|
||||
|
||||
已经打上label或者基线的版本。
|
||||
|
||||
3.2.2. 基线管理
|
||||
|
||||
参见文档《基线发布控制规程》
|
||||
|
||||
3.2.3. 项目
|
||||
|
||||
项目名字由项目经理提供,一般为项目简称。
|
||||
|
||||
3.2.4. 开发流
|
||||
|
||||
开发流的标识统一使用小写,命名约定:[主项目]_[用途标识],例如 ygerp_3.1_intergration、
|
||||
|
||||
ygerp_3.1_report、ygerp_3.1_release 等。
|
||||
|
||||
3.2.5. 活动
|
||||
|
||||
针对的单据类型:R 加需求单号,Y 加优化单号,W 加工作单号,其他的向组织级配置管理工程师
|
||||
|
||||
申报后再决定。
|
||||
|
||||
3.2.6. 视图
|
||||
|
||||
所有人员建立视图均采用以下模式:
|
||||
域用户名+流名称,如 admin_ ygerp_3.1_report,此为 admin 用户在 ygerp_3.1_report 上建立的视图,
|
||||
|
||||
不鼓励在同一流上建立多个视图。
|
||||
|
||||
3.2.7. VOB
|
||||
|
||||
按所存贮的数据类型命名,如 A.分析软件
|
||||
|
||||
3.2.8. componet 组件
|
||||
|
||||
管理组件统一采用 CBL.项目名称。如 CBL. ygerp_3.1。普通组件按功能进行命名。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
配置项标识规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD03
|
||||
2010-07-01
|
||||
|
||||
V1.1
|
||||
第 4 页 共 4 页
|
||||
|
||||
3.2.9. 文件及文件夹
|
||||
|
||||
统一采用小写字母进行命名。
|
||||
|
||||
4. 相关文档
|
||||
|
||||
无
|
||||
|
||||
5. 参考资料
|
||||
|
||||
名称
|
||||
|
||||
无
|
||||
|
||||
来源
|
||||
|
||||
版本/日期
|
||||
|
||||
商密【中】
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
文件编号:YG-CMMI-CM-PD03
|
||||
发布日期:2023-06-30
|
||||
现行版本:1.2
|
||||
|
||||
商密【中】
|
||||
|
||||
配置项标识规范
|
||||
|
||||
修订历史记录
|
||||
|
||||
日期
|
||||
|
||||
版本
|
||||
|
||||
2008-06-19
|
||||
|
||||
1.0
|
||||
|
||||
说明
|
||||
新增文档,用于规范配置项标识
|
||||
工作,以便进行配置管理
|
||||
|
||||
2010-07-01
|
||||
2023-06-30
|
||||
|
||||
1.1 增加商密级别
|
||||
1.2 修订页眉中的商标引用
|
||||
|
||||
作者/修改人
|
||||
|
||||
审核
|
||||
|
||||
杨莹
|
||||
|
||||
吴建春
|
||||
李锋
|
||||
|
||||
周立
|
||||
|
||||
周立
|
||||
刘娟
|
||||
|
||||
批准
|
||||
|
||||
周立
|
||||
|
||||
周立
|
||||
向万红
|
||||
|
||||
远光软件股份有限公司 发布
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
配置项标识规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD03PD03
|
||||
2023-06-30
|
||||
|
||||
V1.2
|
||||
第 1 页 共 4 页
|
||||
|
||||
目 录
|
||||
|
||||
1. 引言 .......................................................................................................................................................... 2
|
||||
1.1. 目的 ....................................................................................................................................................................2
|
||||
1.1.1. 适用部门 ........................................................................................................................................................2
|
||||
1.1.2. 适用业务 ........................................................................................................................................................2
|
||||
1.2. 概述 ....................................................................................................................................................................2
|
||||
1.3. 术语和缩略语 ....................................................................................................................................................2
|
||||
2. 角色与职责 ............................................................................................................................................... 2
|
||||
3. 规范描述 ................................................................................................................................................... 2
|
||||
3.1. 配置项命名 ........................................................................................................................................................2
|
||||
3.1.1. 配置项/单元命名规范 ...................................................................................................................................2
|
||||
3.1.2. 配置单元中的配置项命名 ............................................................................................................................3
|
||||
3.2. 配置库对象标识 ................................................................................................................................................3
|
||||
3.2.1. 版本管理 ........................................................................................................................................................3
|
||||
3.2.2. 基线管理 ........................................................................................................................................................3
|
||||
3.2.3. 项目 ................................................................................................................................................................3
|
||||
3.2.4. 开发流 ............................................................................................................................................................3
|
||||
3.2.5. 活动 ................................................................................................................................................................3
|
||||
3.2.6. 视图 ................................................................................................................................................................3
|
||||
3.2.7. VOB .................................................................................................................................................................3
|
||||
3.2.8. componet 组件 ...............................................................................................................................................3
|
||||
3.2.9. 文件及文件夹 ................................................................................................................................................4
|
||||
4. 相关文档 ................................................................................................................................................... 4
|
||||
5. 参考资料 ................................................................................................................................................... 4
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
配置项标识规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD03
|
||||
2010-07-01
|
||||
|
||||
V1.1
|
||||
第 2 页 共 4 页
|
||||
|
||||
1. 引言
|
||||
|
||||
1.1. 目的
|
||||
|
||||
对纳入配置库的配置项统一标识,便于管理与查找。配置项的标识是为配置管理所使用的,不要和
|
||||
|
||||
文档编号混淆。
|
||||
|
||||
1.1.1. 适用部门
|
||||
|
||||
配置管理部门。
|
||||
|
||||
1.1.2. 适用业务
|
||||
|
||||
配置项的标识活动。
|
||||
|
||||
1.2. 概述
|
||||
|
||||
描述对项目或产品工件如何命名、标记和编号。标识方案涵盖硬件、系统软件以及产品目录结构中
|
||||
|
||||
列出的所有应用开发工件,例如,计划、模型、组件、测试软件、结果和数据、可执行文件,等等。
|
||||
|
||||
解释
|
||||
|
||||
由配置管理视为一个单一整体而进行处理的工作产品(例如:在
|
||||
软件生存周期各阶段所产生的各种形式和各种版本的文档、程
|
||||
序、数据等)以及完成工作产品所需的软件工具和支持系统。
|
||||
软件开发过程中的里程碑,它以一或多个软件配置项的交付为标
|
||||
志。基线由已经通过正式评审和批准的某规约或产品组成,它因
|
||||
此可以作为进一步开发的基础,并且只能通过正式的变更控制过
|
||||
程才能够改变.
|
||||
|
||||
1.3. 术语和缩略语
|
||||
|
||||
术语/缩略语
|
||||
|
||||
SCI(Software Configuration Item:
|
||||
软件配置项)
|
||||
|
||||
BL (BaseLine:基线)
|
||||
|
||||
2. 角色与职责
|
||||
|
||||
无
|
||||
|
||||
3. 规范描述
|
||||
|
||||
主要从配置项和配置库对象两个方面来定义如何进行标识,从而使配置库整洁有序。
|
||||
|
||||
3.1. 配置项命名
|
||||
|
||||
3.1.1. 配置项/单元命名规范
|
||||
|
||||
配置项/单元命名规范为:项目简称_配置项/单元名称
|
||||
|
||||
项目简称:为客户简称-项目名称缩写,应该是长度 8 位以内的英文字母与连接符的组合。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
配置项标识规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD03
|
||||
2010-07-01
|
||||
|
||||
V1.1
|
||||
第 3 页 共 4 页
|
||||
|
||||
(项目简称由项目经理提供)
|
||||
|
||||
3.1.2. 配置单元中的配置项命名
|
||||
|
||||
对于测试用例等配置单元,其中的配置项的命名与编号规范,可以根据项目实际情况做相应约定,
|
||||
|
||||
要求是体现配置项内容和所属功能模块等信息。
|
||||
|
||||
文档类的配置项,以文档名称进行标识,标识时注意唯一性与可追溯性;
|
||||
|
||||
源码类的配置项,可以直接使用程序名称作为配置项标识。
|
||||
|
||||
3.2. 配置库对象标识
|
||||
|
||||
3.2.1. 版本管理
|
||||
|
||||
配置项每check out/in 一次,自身的版本号就会升一,可以直接看到。不允许随便删除版本,尤其是
|
||||
|
||||
已经打上label或者基线的版本。
|
||||
|
||||
3.2.2. 基线管理
|
||||
|
||||
参见文档《基线发布控制规程》
|
||||
|
||||
3.2.3. 项目
|
||||
|
||||
项目名字由项目经理提供,一般为项目简称。
|
||||
|
||||
3.2.4. 开发流
|
||||
|
||||
开发流的标识统一使用小写,命名约定:[主项目]_[用途标识],例如 ygerp_3.1_intergration、
|
||||
|
||||
ygerp_3.1_report、ygerp_3.1_release 等。
|
||||
|
||||
3.2.5. 活动
|
||||
|
||||
针对的单据类型:R 加需求单号,Y 加优化单号,W 加工作单号,其他的向组织级配置管理工程师
|
||||
|
||||
申报后再决定。
|
||||
|
||||
3.2.6. 视图
|
||||
|
||||
所有人员建立视图均采用以下模式:
|
||||
域用户名+流名称,如 admin_ ygerp_3.1_report,此为 admin 用户在 ygerp_3.1_report 上建立的视图,
|
||||
|
||||
不鼓励在同一流上建立多个视图。
|
||||
|
||||
3.2.7. VOB
|
||||
|
||||
按所存贮的数据类型命名,如 A.分析软件
|
||||
|
||||
3.2.8. componet 组件
|
||||
|
||||
管理组件统一采用 CBL.项目名称。如 CBL. ygerp_3.1。普通组件按功能进行命名。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
配置项标识规范
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-PD03
|
||||
2010-07-01
|
||||
|
||||
V1.1
|
||||
第 4 页 共 4 页
|
||||
|
||||
3.2.9. 文件及文件夹
|
||||
|
||||
统一采用小写字母进行命名。
|
||||
|
||||
4. 相关文档
|
||||
|
||||
无
|
||||
|
||||
5. 参考资料
|
||||
|
||||
名称
|
||||
|
||||
无
|
||||
|
||||
来源
|
||||
|
||||
版本/日期
|
||||
|
||||
商密【中】
|
||||
|
||||
@@ -0,0 +1,434 @@
|
||||
文件编号:YG-CMMI-CM-GD04
|
||||
发布日期:2023-06-30
|
||||
现行版本:1.1
|
||||
|
||||
商密【中】
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
修订历史记录
|
||||
|
||||
日期
|
||||
2022-08-03
|
||||
|
||||
版本
|
||||
1.0 新增
|
||||
|
||||
说明
|
||||
|
||||
作者/修改人
|
||||
王优、刘发、胡玲、张金金
|
||||
|
||||
审核
|
||||
黄德海
|
||||
|
||||
批准
|
||||
姚国全
|
||||
|
||||
2023-06-30
|
||||
|
||||
1.1
|
||||
|
||||
修订页眉中的商
|
||||
标引用
|
||||
|
||||
李锋
|
||||
|
||||
刘娟
|
||||
|
||||
向万红
|
||||
|
||||
远光软件股份有限公司 发布
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 1 页 共 8 页
|
||||
|
||||
目 录
|
||||
|
||||
第一章 总则 ........................................................................................................................................... 2
|
||||
第一条 目的 ........................................................................................................................................................2
|
||||
第二条 适用范围 ................................................................................................................................................2
|
||||
第三条 术语和缩略语 ........................................................................................................................................2
|
||||
第四条 职责分工 ................................................................................................................................................2
|
||||
第二章 云效构建流程 ............................................................................................................................. 3
|
||||
第五条 代码提交审批流程 ................................................................................................................................4
|
||||
第六条 平台代码提交流程 ................................................................................................................................5
|
||||
第七条 产品代码提交流程 ................................................................................................................................7
|
||||
第三章 其他 ........................................................................................................................................... 8
|
||||
第八条 依赖包白名单 ........................................................................................................................................8
|
||||
第九条 安全代码扫描 ........................................................................................................................................8
|
||||
第四章 附则 ........................................................................................................................................... 8
|
||||
第十条 本指南由 DAP 研发中心负责修订、解释 ............................................................................................8
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 2 页 共 8 页
|
||||
|
||||
第一章 总则
|
||||
|
||||
第一条 目的
|
||||
|
||||
为规范财务中台云效系统代码提交流程,促进各部门高效协作,提高研发项目组提交代码的质量和
|
||||
|
||||
效率,特制定本指南。
|
||||
|
||||
第二条 适用范围
|
||||
|
||||
适用于财务中台产品代码提交云效系统涉及的各研发部门。
|
||||
|
||||
第三条 术语和缩略语
|
||||
|
||||
术语/缩略语
|
||||
|
||||
解释
|
||||
|
||||
云效是阿里巴巴云原生时代一站式 BizDevOps 平台,A 集团引
|
||||
|
||||
入使用,进行端到端的全流程管理。
|
||||
|
||||
研发项目组自研程序包。
|
||||
|
||||
第三方开源程序包或付费购买的程序包。
|
||||
|
||||
云效
|
||||
|
||||
二方包
|
||||
|
||||
三方包
|
||||
|
||||
第四条 职责分工
|
||||
|
||||
序号
|
||||
|
||||
角色
|
||||
|
||||
职责
|
||||
|
||||
1
|
||||
|
||||
研发项目组
|
||||
|
||||
1. 项目经理负责云效代码提交申请;
|
||||
|
||||
2. 负责平台/产品功能测试,保证代码质量;
|
||||
|
||||
3. 负责输出静态资源到指定目录;
|
||||
|
||||
4. 项目组对应的部门经理负责审批代码提交申请。
|
||||
|
||||
2
|
||||
|
||||
DAP 研发中心-测
|
||||
试 及 交 付 中 心
|
||||
(下文简称:测
|
||||
|
||||
1. 负责准备测试环境;
|
||||
|
||||
2. 负责产品功能的联调测试和自动化测试;
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 3 页 共 8 页
|
||||
|
||||
试及交付中心)
|
||||
|
||||
3. 平台冒烟通过后,负责更新测试环境,组织产品冒烟。
|
||||
|
||||
信创平台部-测试
|
||||
部(下文简称:
|
||||
平台测试部)
|
||||
|
||||
DAP 研发中心-研
|
||||
发管理部-配置组
|
||||
(下文简称:配
|
||||
置组)
|
||||
|
||||
电力行业技术支
|
||||
持中心(下文简
|
||||
称:技术支持中
|
||||
心)
|
||||
|
||||
1. 负责准备测试环境;
|
||||
|
||||
2. 负责平台功能的联调测试和自动化测试,测试通过后邮件知会相关干系
|
||||
|
||||
人。
|
||||
|
||||
1. 负责代码本地编译验证并提取依赖包;
|
||||
|
||||
2. 负责上传代码、依赖包、静态资源及镜像依赖文件至云效;
|
||||
|
||||
3. 负责云效编译并输出镜像。
|
||||
|
||||
1. 负责提供部署环境需要的镜像依赖文件;
|
||||
|
||||
2. 负责组织在仿真环境和生产环境开展镜像部署;
|
||||
|
||||
3. 负责审批云效代码的提交。
|
||||
|
||||
电力行业一部
|
||||
|
||||
1. 负责组织在仿真环境和生产环境开展测试。
|
||||
|
||||
信创平台部-公共
|
||||
服务部-安全实验
|
||||
室(下文简称:
|
||||
安全实验室)
|
||||
|
||||
1. 负责对研发项目组提交云效的代码进行安全扫描。
|
||||
|
||||
3
|
||||
|
||||
4
|
||||
|
||||
5
|
||||
|
||||
6
|
||||
|
||||
7
|
||||
|
||||
第二章 云效构建流程
|
||||
|
||||
代码提交到云效系统有两种更新方式:
|
||||
|
||||
1、 增量更新:按需发起申请,适用于不影响其他组功能使用的代码提交;
|
||||
|
||||
2、 全量更新:按迭代或版本进行更新,由技术支持中心发起。更新前必须通过系统测试和安全测
|
||||
|
||||
试。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 4 页 共 8 页
|
||||
|
||||
第五条 代码提交审批流程
|
||||
|
||||
1、 此流程适用增量更新时使用,全量更新由技术支持中心根据具体问题判断,直接发起。
|
||||
|
||||
2、 发起申请:由研发项目组的项目经理申请提交代码到云效。
|
||||
|
||||
3、 部门审核:由项目组对应的部门经理判断新提交代码是否影响其他项目组重新编译,只有不影
|
||||
响或能明确列出影响范围更新清单并通过测试验证的,才能提交技术支持中心负责人审批;平
|
||||
台代码不仅需要判断对平台其他组是否有影响,还需判断对其他产品是否有影响(是否需要其
|
||||
他产品调整代码或重新编译),如有影响审批不通过;如需更新,由技术支持中心根据具体问
|
||||
题判断是否发起全量更新。
|
||||
|
||||
4、 技术支持中心审批:由技术支持中心负责人根据更新时间、更新内容等确定是否审批,审批通
|
||||
|
||||
过后方可启动提交代码。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 5 页 共 8 页
|
||||
|
||||
5、 启动云效代码提交流程:审批通过后,由配置组提取代码、依赖包和静态资源,启动提交代码
|
||||
|
||||
的工作。
|
||||
|
||||
第六条 平台代码提交流程
|
||||
|
||||
1、 提交代码:由平台研发项目组对准备提交云效的代码、依赖包、静态资源(需同步输出到指定
|
||||
目录)等进行测试验证,此过程需要本地编译构建成功,通过平台测试部的冒烟测试,同时通
|
||||
过测试及交付中心的冒烟测试。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 6 页 共 8 页
|
||||
|
||||
平台静态资源路径:
|
||||
\\10.50.9.101\server\modular whgz\ECP\ECPV8.0.0\finalZipFile
|
||||
|
||||
2、 编译构建:由配置组根据平台提供的代码(当前为 boot 包),进行纯环境编译,确认获取依赖
|
||||
包(二方包、三方包)。如果选择增量更新,由发起者提供当前变更二方包列表、三方包列表
|
||||
和静态资源列表,如果选择全量更新,则无需提供。
|
||||
|
||||
3、 获取镜像依赖文件:由技术支持中心按部署环境提供 dockerfile、配置文件和基础镜像等依赖文
|
||||
|
||||
件给配置组。
|
||||
|
||||
4、 云效提交:由配置组根据获取的依赖包,清除云效 maven 库相关二方包,提交更新的二方包、
|
||||
|
||||
三方包、静态资源和 boot 代码并通过云效编译。
|
||||
|
||||
5、 生成并推送镜像:由配置组云效编译并获取镜像依赖文件打包,输出镜像,并将生成的镜像推
|
||||
|
||||
送云效镜像库。
|
||||
|
||||
6、 仿真环境镜像部署:由技术支持中心组织在仿真环境进行镜像部署。
|
||||
|
||||
7、 仿真环境测试:由电力行业一部组织在仿真环境开展功能测试验证。
|
||||
|
||||
8、 生产环境镜像部署:由技术支持中心负责将镜像部署到生产环境,并在生产环境进行镜像部署。
|
||||
|
||||
9、 生产环境测试:由电力行业一部组织在生产环境开展功能测试验证。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 7 页 共 8 页
|
||||
|
||||
第七条 产品代码提交流程
|
||||
|
||||
1、 提交代码:由产品研发项目组对准备提交云效的代码、依赖包、静态资源(需同步输出到指定
|
||||
目录)进行测试验证。此过程需要本地编译构建成功,通过测试及交付中心的产品联调测试和
|
||||
自动化测试。
|
||||
|
||||
产品静态资源路径:
|
||||
\\10.50.9.101\server\modular whgz\dap9.0.0master_sp\fmp_resource\finalZipFile
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 8 页 共 8 页
|
||||
|
||||
2、 编译构建:由配置组根据项目组提交的代码,进行纯环境编译,确认获取依赖包(二方包、三
|
||||
方包)。如果选择增量更新,由发起者提供当前变更二方包列表、三方包列表、静态资源列表,
|
||||
如果选择全量更新,则无需提供。
|
||||
|
||||
3、 获取镜像所需依赖文件:由技术支持中心按部署环境提供 dockerfile、配置文件和基础镜像等依
|
||||
|
||||
赖文件给配置组。
|
||||
|
||||
4、 云效提交:由配置组根据获取的依赖包,清除云效 maven 库相关二方包,提交更新二方包、三
|
||||
|
||||
方包、静态资源和代码并通过云效编译。
|
||||
|
||||
5、 生成并推送镜像:由配置组云效编译并获取镜像依赖文件打包,输出镜像,并将生成的镜像推
|
||||
|
||||
送云效镜像库。
|
||||
|
||||
6、 仿真环境镜像部署:由技术支持中心组织在仿真环境进行镜像部署。
|
||||
|
||||
7、 仿真环境测试:由电力行业一部组织在仿真环境开展功能测试验证。
|
||||
|
||||
8、 生产环境镜像部署:由技术支持中心负责将镜像部署到生产环境,并在生产环境进行镜像部署。
|
||||
|
||||
9、 生产环境测试:由电力行业一部组织在生产环境开展功能测试验证。
|
||||
|
||||
第三章 其他
|
||||
|
||||
第八条 依赖包白名单
|
||||
|
||||
项目组提交云效的代码,编译所需依赖包,必须在配置组提供的依赖包白名单中,并通过 maven 编
|
||||
|
||||
译。
|
||||
|
||||
第九条 安全代码扫描
|
||||
|
||||
按生产环境更新要求,研发项目组提交云效的代码需通过安全实验室相关工具的安全扫描。
|
||||
|
||||
第四章 附则
|
||||
|
||||
第十条 本指南由 DAP 研发中心负责修订、解释
|
||||
|
||||
商密【中】
|
||||
|
||||
@@ -0,0 +1,434 @@
|
||||
文件编号:YG-CMMI-CM-GD04
|
||||
发布日期:2023-06-30
|
||||
现行版本:1.1
|
||||
|
||||
商密【中】
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
修订历史记录
|
||||
|
||||
日期
|
||||
2022-08-03
|
||||
|
||||
版本
|
||||
1.0 新增
|
||||
|
||||
说明
|
||||
|
||||
作者/修改人
|
||||
王优、刘发、胡玲、张金金
|
||||
|
||||
审核
|
||||
黄德海
|
||||
|
||||
批准
|
||||
姚国全
|
||||
|
||||
2023-06-30
|
||||
|
||||
1.1
|
||||
|
||||
修订页眉中的商
|
||||
标引用
|
||||
|
||||
李锋
|
||||
|
||||
刘娟
|
||||
|
||||
向万红
|
||||
|
||||
远光软件股份有限公司 发布
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 1 页 共 8 页
|
||||
|
||||
目 录
|
||||
|
||||
第一章 总则 ........................................................................................................................................... 2
|
||||
第一条 目的 ........................................................................................................................................................2
|
||||
第二条 适用范围 ................................................................................................................................................2
|
||||
第三条 术语和缩略语 ........................................................................................................................................2
|
||||
第四条 职责分工 ................................................................................................................................................2
|
||||
第二章 云效构建流程 ............................................................................................................................. 3
|
||||
第五条 代码提交审批流程 ................................................................................................................................4
|
||||
第六条 平台代码提交流程 ................................................................................................................................5
|
||||
第七条 产品代码提交流程 ................................................................................................................................7
|
||||
第三章 其他 ........................................................................................................................................... 8
|
||||
第八条 依赖包白名单 ........................................................................................................................................8
|
||||
第九条 安全代码扫描 ........................................................................................................................................8
|
||||
第四章 附则 ........................................................................................................................................... 8
|
||||
第十条 本指南由 DAP 研发中心负责修订、解释 ............................................................................................8
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 2 页 共 8 页
|
||||
|
||||
第一章 总则
|
||||
|
||||
第一条 目的
|
||||
|
||||
为规范财务中台云效系统代码提交流程,促进各部门高效协作,提高研发项目组提交代码的质量和
|
||||
|
||||
效率,特制定本指南。
|
||||
|
||||
第二条 适用范围
|
||||
|
||||
适用于财务中台产品代码提交云效系统涉及的各研发部门。
|
||||
|
||||
第三条 术语和缩略语
|
||||
|
||||
术语/缩略语
|
||||
|
||||
解释
|
||||
|
||||
云效是阿里巴巴云原生时代一站式 BizDevOps 平台,A 集团引
|
||||
|
||||
入使用,进行端到端的全流程管理。
|
||||
|
||||
研发项目组自研程序包。
|
||||
|
||||
第三方开源程序包或付费购买的程序包。
|
||||
|
||||
云效
|
||||
|
||||
二方包
|
||||
|
||||
三方包
|
||||
|
||||
第四条 职责分工
|
||||
|
||||
序号
|
||||
|
||||
角色
|
||||
|
||||
职责
|
||||
|
||||
1
|
||||
|
||||
研发项目组
|
||||
|
||||
1. 项目经理负责云效代码提交申请;
|
||||
|
||||
2. 负责平台/产品功能测试,保证代码质量;
|
||||
|
||||
3. 负责输出静态资源到指定目录;
|
||||
|
||||
4. 项目组对应的部门经理负责审批代码提交申请。
|
||||
|
||||
2
|
||||
|
||||
DAP 研发中心-测
|
||||
试 及 交 付 中 心
|
||||
(下文简称:测
|
||||
|
||||
1. 负责准备测试环境;
|
||||
|
||||
2. 负责产品功能的联调测试和自动化测试;
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 3 页 共 8 页
|
||||
|
||||
试及交付中心)
|
||||
|
||||
3. 平台冒烟通过后,负责更新测试环境,组织产品冒烟。
|
||||
|
||||
信创平台部-测试
|
||||
部(下文简称:
|
||||
平台测试部)
|
||||
|
||||
DAP 研发中心-研
|
||||
发管理部-配置组
|
||||
(下文简称:配
|
||||
置组)
|
||||
|
||||
电力行业技术支
|
||||
持中心(下文简
|
||||
称:技术支持中
|
||||
心)
|
||||
|
||||
1. 负责准备测试环境;
|
||||
|
||||
2. 负责平台功能的联调测试和自动化测试,测试通过后邮件知会相关干系
|
||||
|
||||
人。
|
||||
|
||||
1. 负责代码本地编译验证并提取依赖包;
|
||||
|
||||
2. 负责上传代码、依赖包、静态资源及镜像依赖文件至云效;
|
||||
|
||||
3. 负责云效编译并输出镜像。
|
||||
|
||||
1. 负责提供部署环境需要的镜像依赖文件;
|
||||
|
||||
2. 负责组织在仿真环境和生产环境开展镜像部署;
|
||||
|
||||
3. 负责审批云效代码的提交。
|
||||
|
||||
电力行业一部
|
||||
|
||||
1. 负责组织在仿真环境和生产环境开展测试。
|
||||
|
||||
信创平台部-公共
|
||||
服务部-安全实验
|
||||
室(下文简称:
|
||||
安全实验室)
|
||||
|
||||
1. 负责对研发项目组提交云效的代码进行安全扫描。
|
||||
|
||||
3
|
||||
|
||||
4
|
||||
|
||||
5
|
||||
|
||||
6
|
||||
|
||||
7
|
||||
|
||||
第二章 云效构建流程
|
||||
|
||||
代码提交到云效系统有两种更新方式:
|
||||
|
||||
1、 增量更新:按需发起申请,适用于不影响其他组功能使用的代码提交;
|
||||
|
||||
2、 全量更新:按迭代或版本进行更新,由技术支持中心发起。更新前必须通过系统测试和安全测
|
||||
|
||||
试。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 4 页 共 8 页
|
||||
|
||||
第五条 代码提交审批流程
|
||||
|
||||
1、 此流程适用增量更新时使用,全量更新由技术支持中心根据具体问题判断,直接发起。
|
||||
|
||||
2、 发起申请:由研发项目组的项目经理申请提交代码到云效。
|
||||
|
||||
3、 部门审核:由项目组对应的部门经理判断新提交代码是否影响其他项目组重新编译,只有不影
|
||||
响或能明确列出影响范围更新清单并通过测试验证的,才能提交技术支持中心负责人审批;平
|
||||
台代码不仅需要判断对平台其他组是否有影响,还需判断对其他产品是否有影响(是否需要其
|
||||
他产品调整代码或重新编译),如有影响审批不通过;如需更新,由技术支持中心根据具体问
|
||||
题判断是否发起全量更新。
|
||||
|
||||
4、 技术支持中心审批:由技术支持中心负责人根据更新时间、更新内容等确定是否审批,审批通
|
||||
|
||||
过后方可启动提交代码。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 5 页 共 8 页
|
||||
|
||||
5、 启动云效代码提交流程:审批通过后,由配置组提取代码、依赖包和静态资源,启动提交代码
|
||||
|
||||
的工作。
|
||||
|
||||
第六条 平台代码提交流程
|
||||
|
||||
1、 提交代码:由平台研发项目组对准备提交云效的代码、依赖包、静态资源(需同步输出到指定
|
||||
目录)等进行测试验证,此过程需要本地编译构建成功,通过平台测试部的冒烟测试,同时通
|
||||
过测试及交付中心的冒烟测试。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 6 页 共 8 页
|
||||
|
||||
平台静态资源路径:
|
||||
\\10.50.9.101\server\modular whgz\ECP\ECPV8.0.0\finalZipFile
|
||||
|
||||
2、 编译构建:由配置组根据平台提供的代码(当前为 boot 包),进行纯环境编译,确认获取依赖
|
||||
包(二方包、三方包)。如果选择增量更新,由发起者提供当前变更二方包列表、三方包列表
|
||||
和静态资源列表,如果选择全量更新,则无需提供。
|
||||
|
||||
3、 获取镜像依赖文件:由技术支持中心按部署环境提供 dockerfile、配置文件和基础镜像等依赖文
|
||||
|
||||
件给配置组。
|
||||
|
||||
4、 云效提交:由配置组根据获取的依赖包,清除云效 maven 库相关二方包,提交更新的二方包、
|
||||
|
||||
三方包、静态资源和 boot 代码并通过云效编译。
|
||||
|
||||
5、 生成并推送镜像:由配置组云效编译并获取镜像依赖文件打包,输出镜像,并将生成的镜像推
|
||||
|
||||
送云效镜像库。
|
||||
|
||||
6、 仿真环境镜像部署:由技术支持中心组织在仿真环境进行镜像部署。
|
||||
|
||||
7、 仿真环境测试:由电力行业一部组织在仿真环境开展功能测试验证。
|
||||
|
||||
8、 生产环境镜像部署:由技术支持中心负责将镜像部署到生产环境,并在生产环境进行镜像部署。
|
||||
|
||||
9、 生产环境测试:由电力行业一部组织在生产环境开展功能测试验证。
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 7 页 共 8 页
|
||||
|
||||
第七条 产品代码提交流程
|
||||
|
||||
1、 提交代码:由产品研发项目组对准备提交云效的代码、依赖包、静态资源(需同步输出到指定
|
||||
目录)进行测试验证。此过程需要本地编译构建成功,通过测试及交付中心的产品联调测试和
|
||||
自动化测试。
|
||||
|
||||
产品静态资源路径:
|
||||
\\10.50.9.101\server\modular whgz\dap9.0.0master_sp\fmp_resource\finalZipFile
|
||||
|
||||
商密【中】
|
||||
|
||||
远光软件股份有限公司
|
||||
|
||||
关于云效代码提交管理指南
|
||||
|
||||
文件编号
|
||||
发布日期
|
||||
|
||||
现行版本
|
||||
页 次
|
||||
|
||||
YG-CMMI-CM-GD04
|
||||
2023-06-30
|
||||
|
||||
V1.1
|
||||
第 8 页 共 8 页
|
||||
|
||||
2、 编译构建:由配置组根据项目组提交的代码,进行纯环境编译,确认获取依赖包(二方包、三
|
||||
方包)。如果选择增量更新,由发起者提供当前变更二方包列表、三方包列表、静态资源列表,
|
||||
如果选择全量更新,则无需提供。
|
||||
|
||||
3、 获取镜像所需依赖文件:由技术支持中心按部署环境提供 dockerfile、配置文件和基础镜像等依
|
||||
|
||||
赖文件给配置组。
|
||||
|
||||
4、 云效提交:由配置组根据获取的依赖包,清除云效 maven 库相关二方包,提交更新二方包、三
|
||||
|
||||
方包、静态资源和代码并通过云效编译。
|
||||
|
||||
5、 生成并推送镜像:由配置组云效编译并获取镜像依赖文件打包,输出镜像,并将生成的镜像推
|
||||
|
||||
送云效镜像库。
|
||||
|
||||
6、 仿真环境镜像部署:由技术支持中心组织在仿真环境进行镜像部署。
|
||||
|
||||
7、 仿真环境测试:由电力行业一部组织在仿真环境开展功能测试验证。
|
||||
|
||||
8、 生产环境镜像部署:由技术支持中心负责将镜像部署到生产环境,并在生产环境进行镜像部署。
|
||||
|
||||
9、 生产环境测试:由电力行业一部组织在生产环境开展功能测试验证。
|
||||
|
||||
第三章 其他
|
||||
|
||||
第八条 依赖包白名单
|
||||
|
||||
项目组提交云效的代码,编译所需依赖包,必须在配置组提供的依赖包白名单中,并通过 maven 编
|
||||
|
||||
译。
|
||||
|
||||
第九条 安全代码扫描
|
||||
|
||||
按生产环境更新要求,研发项目组提交云效的代码需通过安全实验室相关工具的安全扫描。
|
||||
|
||||
第四章 附则
|
||||
|
||||
第十条 本指南由 DAP 研发中心负责修订、解释
|
||||
|
||||
商密【中】
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import axios from 'axios'
|
||||
import type { AxiosInstance } from 'axios'
|
||||
import type { Project, ProjectCreate, ProjectUpdate, Model, ModelCreate } from '@/types'
|
||||
import type { Project, ProjectCreate, ProjectUpdate, Model, ModelCreate } from '@/shared/types'
|
||||
|
||||
const apiBaseURL = import.meta.env.VITE_API_BASE_URL
|
||||
|| (import.meta.env.PROD
|
||||
? '/api/v1'
|
||||
: `${window.location.protocol}//${window.location.hostname}:8000/api/v1`)
|
||||
|
||||
const request: AxiosInstance = axios.create({
|
||||
baseURL: import.meta.env.PROD
|
||||
? '/api/v1'
|
||||
: 'http://10.10.10.77:8000/api/v1',
|
||||
baseURL: apiBaseURL,
|
||||
timeout: 60000
|
||||
})
|
||||
|
||||
@@ -71,7 +74,10 @@ export const fileApi = {
|
||||
}
|
||||
|
||||
export const chunkApi = {
|
||||
split: (projectId: string, data: any) => request.post(`/projects/${projectId}/chunks/split`, data),
|
||||
split: (projectId: string, data: any) =>
|
||||
request.post(`/projects/${projectId}/chunks/split`, data, {
|
||||
timeout: 300000
|
||||
}),
|
||||
list: (projectId: string, params?: any) => request.get(`/projects/${projectId}/chunks`, { params }),
|
||||
get: (projectId: string, chunkId: string) => request.get(`/projects/${projectId}/chunks/${chunkId}`),
|
||||
update: (projectId: string, chunkId: string, data: any) => request.put(`/projects/${projectId}/chunks/${chunkId}`, data),
|
||||
@@ -79,8 +85,8 @@ export const chunkApi = {
|
||||
}
|
||||
|
||||
export const questionApi = {
|
||||
generate: (projectId: string, data: any) => request.post(`/projects/${projectId}/generate-questions`, data),
|
||||
list: (projectId: string, params: { chunkId: string }) => request.get(`/projects/${projectId}/chunks/${params.chunkId}/questions`),
|
||||
generate: (projectId: string, data: any) => request.post(`/projects/${projectId}/questions/generate`, data),
|
||||
list: (projectId: string, params?: any) => request.get(`/projects/${projectId}/questions`, { params }),
|
||||
update: (projectId: string, questionId: string, data: any) => request.put(`/projects/${projectId}/questions/${questionId}`, data),
|
||||
delete: (projectId: string, questionId: string) => request.delete(`/projects/${projectId}/questions/${questionId}`)
|
||||
}
|
||||
@@ -1,61 +1,61 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
|
||||
|
||||
const routes = [
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
component: () => import('@/views/HomeView.vue')
|
||||
component: () => import('@/pages/HomePage.vue')
|
||||
},
|
||||
{
|
||||
path: '/project/:id',
|
||||
name: 'Project',
|
||||
component: () => import('@/views/ProjectView.vue'),
|
||||
component: () => import('@/pages/ProjectPage.vue'),
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
redirect: to => `/project/${to.params.id}/files`
|
||||
redirect: to => `/project/${String(to.params.id)}/files`
|
||||
},
|
||||
{
|
||||
path: 'files',
|
||||
name: 'ProjectFiles',
|
||||
component: () => import('@/views/project/FileManage.vue')
|
||||
component: () => import('@/pages/ProjectFilePage.vue')
|
||||
},
|
||||
{
|
||||
path: 'split',
|
||||
name: 'ProjectSplit',
|
||||
component: () => import('@/views/project/TextSplit.vue')
|
||||
component: () => import('@/pages/ProjectTextSplitPage.vue')
|
||||
},
|
||||
{
|
||||
path: 'questions',
|
||||
name: 'ProjectQuestions',
|
||||
component: () => import('@/views/project/QuestionManage.vue')
|
||||
component: () => import('@/pages/ProjectQuestionPage.vue')
|
||||
},
|
||||
{
|
||||
path: 'datasets',
|
||||
name: 'ProjectDatasets',
|
||||
component: () => import('@/views/project/DatasetManage.vue')
|
||||
component: () => import('@/pages/ProjectDatasetPage.vue')
|
||||
},
|
||||
{
|
||||
path: 'eval',
|
||||
name: 'ProjectEval',
|
||||
component: () => import('@/views/project/EvalManage.vue')
|
||||
component: () => import('@/pages/ProjectEvalPage.vue')
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
name: 'ProjectSettings',
|
||||
component: () => import('@/views/project/Settings.vue')
|
||||
component: () => import('@/pages/ProjectSettingsPage.vue')
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/models',
|
||||
name: 'ModelSettings',
|
||||
component: () => import('@/views/ModelSettingsView.vue')
|
||||
component: () => import('@/pages/ModelSettingsPage.vue')
|
||||
},
|
||||
{
|
||||
path: '/crawler',
|
||||
name: 'Crawler',
|
||||
component: () => import('@/views/CrawlerView.vue')
|
||||
component: () => import('@/pages/CrawlerPage.vue')
|
||||
}
|
||||
]
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'ant-design-vue/dist/reset.css'
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import router from './core/router'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
260
frontend/src/page-logic/ModelSettingsPage.ts
Normal file
260
frontend/src/page-logic/ModelSettingsPage.ts
Normal file
@@ -0,0 +1,260 @@
|
||||
import { defineComponent } from 'vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { ModelConfig, ProviderOption, ModelCreate, ModelType } from '@/shared/types'
|
||||
import { modelApi } from '@/core/api'
|
||||
import { watch } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ModelSettingsView',
|
||||
setup() {
|
||||
const router = useRouter()
|
||||
|
||||
// 状态
|
||||
const loading = ref(false)
|
||||
const submitting = ref(false)
|
||||
const deleting = ref(false)
|
||||
const showAddDialog = ref(false)
|
||||
const deleteDialogVisible = ref(false)
|
||||
const modelToDelete = ref<ModelConfig | null>(null)
|
||||
const models = ref<ModelConfig[]>([])
|
||||
|
||||
// 表单
|
||||
const modelForm = reactive<ModelCreate>({
|
||||
provider: 'minimax',
|
||||
model_type: 'chat',
|
||||
model_name: '',
|
||||
api_key: '',
|
||||
api_base: 'https://api.minimax.chat/v1',
|
||||
is_default: false
|
||||
})
|
||||
|
||||
// 供应商默认 API 地址
|
||||
const providerDefaultUrls: Record<string, string> = {
|
||||
minimax: 'https://api.minimax.chat/v1',
|
||||
glm: 'https://open.bigmodel.cn/api/paas/v4',
|
||||
openai: 'https://api.openai.com/v1',
|
||||
ali: 'https://dashscope.aliyuncs.com/compatible-mode/v1'
|
||||
}
|
||||
|
||||
type ProviderOptionItem = ProviderOption & {
|
||||
desc: string
|
||||
}
|
||||
|
||||
type ModelTypeOption = {
|
||||
value: ModelType
|
||||
label: string
|
||||
abbr: string
|
||||
desc: string
|
||||
}
|
||||
|
||||
// 提供商
|
||||
const providers: ProviderOptionItem[] = [
|
||||
{ value: 'minimax', label: 'MiniMax', abbr: 'MM', desc: '适合国内接入,默认官方端点' },
|
||||
{ value: 'glm', label: 'GLM', abbr: 'GL', desc: '智谱接口,兼容常见模型配置' },
|
||||
{ value: 'openai', label: 'OpenAI Compatible', abbr: 'OP', desc: '适配 OpenAI 及兼容协议服务' },
|
||||
{ value: 'ali', label: '阿里云百炼', abbr: 'AL', desc: '默认走 DashScope 兼容模式端点' }
|
||||
]
|
||||
|
||||
const modelTypes: ModelTypeOption[] = [
|
||||
{ value: 'chat', label: 'Chat', abbr: 'CH', desc: '标准对话生成模型' },
|
||||
{ value: 'vlm', label: 'VLM', abbr: 'VL', desc: '视觉语言模型,适合图文输入' },
|
||||
{ value: 'embedding', label: 'Embedding', abbr: 'EM', desc: '文本向量化与语义检索' },
|
||||
{ value: 'rerank', label: 'Rerank', abbr: 'RR', desc: '重排模型,用于检索结果排序' }
|
||||
]
|
||||
|
||||
const normalizeModelType = (modelType?: string, modelName?: string): ModelType => {
|
||||
if (modelType && modelTypes.some(type => type.value === modelType) && modelType !== 'chat') {
|
||||
return modelType as ModelType
|
||||
}
|
||||
|
||||
const normalizedName = (modelName || '').trim().toLowerCase()
|
||||
|
||||
if (['rerank', 'bce-reranker', 'gte-rerank'].some(keyword => normalizedName.includes(keyword))) {
|
||||
return 'rerank'
|
||||
}
|
||||
|
||||
if (
|
||||
[
|
||||
'embedding',
|
||||
'embed',
|
||||
'text-embedding',
|
||||
'bge-',
|
||||
'bge_m3',
|
||||
'gte-',
|
||||
'm3e',
|
||||
'e5-',
|
||||
'jina-embeddings'
|
||||
].some(keyword => normalizedName.includes(keyword))
|
||||
) {
|
||||
return 'embedding'
|
||||
}
|
||||
|
||||
if (['vl', 'vision', 'visual', 'multimodal', 'qwen-vl', 'gpt-4o'].some(keyword => normalizedName.includes(keyword))) {
|
||||
return 'vlm'
|
||||
}
|
||||
|
||||
return 'chat'
|
||||
}
|
||||
|
||||
// 监听 provider 变化,自动设置默认 API 地址
|
||||
|
||||
watch(() => modelForm.provider, (newProvider) => {
|
||||
if (providerDefaultUrls[newProvider]) {
|
||||
modelForm.api_base = providerDefaultUrls[newProvider]
|
||||
}
|
||||
})
|
||||
|
||||
// 方法
|
||||
const goHome = () => router.push('/')
|
||||
|
||||
const getProviderAbbr = (provider: string) => {
|
||||
const p = providers.find(p => p.value === provider)
|
||||
return p?.abbr || '?'
|
||||
}
|
||||
|
||||
const getModelTypeLabel = (modelType?: string, modelName?: string) => {
|
||||
const item = modelTypes.find(type => type.value === normalizeModelType(modelType, modelName))
|
||||
return item?.label || 'Chat'
|
||||
}
|
||||
|
||||
const fetchModels = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await modelApi.list()
|
||||
// Handle different response formats
|
||||
if (Array.isArray(res)) {
|
||||
models.value = res.map(model => ({
|
||||
...model,
|
||||
model_type: normalizeModelType(model.model_type, model.model_name)
|
||||
}))
|
||||
} else if (res?.data && Array.isArray(res.data)) {
|
||||
models.value = res.data.map((model: ModelConfig) => ({
|
||||
...model,
|
||||
model_type: normalizeModelType(model.model_type, model.model_name)
|
||||
}))
|
||||
} else {
|
||||
models.value = []
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('获取模型列表失败:', error)
|
||||
ElMessage.error(error?.message || '加载失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const openAddDialog = () => {
|
||||
modelForm.provider = 'minimax'
|
||||
modelForm.model_type = 'chat'
|
||||
modelForm.model_name = ''
|
||||
modelForm.api_key = ''
|
||||
modelForm.api_base = providerDefaultUrls['minimax']
|
||||
modelForm.is_default = false
|
||||
showAddDialog.value = true
|
||||
}
|
||||
|
||||
const addModel = async () => {
|
||||
if (!modelForm.model_name || !modelForm.api_key) {
|
||||
ElMessage.warning('请填写模型名称和 API Key')
|
||||
return
|
||||
}
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
// Convert is_default from boolean to string
|
||||
const data = {
|
||||
provider: modelForm.provider,
|
||||
model_type: modelForm.model_type,
|
||||
model_name: modelForm.model_name,
|
||||
api_key: modelForm.api_key,
|
||||
api_base: modelForm.api_base,
|
||||
is_default: modelForm.is_default ? 'true' : 'false'
|
||||
}
|
||||
await modelApi.create(data)
|
||||
ElMessage.success('添加成功')
|
||||
showAddDialog.value = false
|
||||
fetchModels()
|
||||
} catch (error: any) {
|
||||
console.error('添加模型失败:', error)
|
||||
ElMessage.error(error?.message || '添加失败')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const confirmDelete = (model: ModelConfig) => {
|
||||
modelToDelete.value = model
|
||||
deleteDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleDelete = async () => {
|
||||
if (!modelToDelete.value?.id) return
|
||||
deleting.value = true
|
||||
try {
|
||||
await modelApi.delete(modelToDelete.value.id)
|
||||
ElMessage.success('删除成功')
|
||||
deleteDialogVisible.value = false
|
||||
modelToDelete.value = null
|
||||
fetchModels()
|
||||
} catch (error: any) {
|
||||
console.error('删除模型失败:', error)
|
||||
ElMessage.error(error?.message || '删除失败')
|
||||
} finally {
|
||||
deleting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const testConnection = async (model: ModelConfig) => {
|
||||
ElMessage.info(`正在测试 ${model.model_name}...`)
|
||||
try {
|
||||
const res = await modelApi.test(model.id)
|
||||
// Update model connection status from response
|
||||
const modelItem = models.value.find(m => m.id === model.id)
|
||||
if (modelItem && res?.model) {
|
||||
modelItem.connection_status = res.model.connection_status
|
||||
if (res.test_result?.success) {
|
||||
ElMessage.success('连接成功!')
|
||||
} else {
|
||||
ElMessage.error(res.test_result?.message || '连接失败')
|
||||
}
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('测试连接失败:', error)
|
||||
const modelItem = models.value.find(m => m.id === model.id)
|
||||
if (modelItem) {
|
||||
modelItem.connection_status = 'disconnected'
|
||||
}
|
||||
ElMessage.error(error?.message || '连接失败')
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => fetchModels())
|
||||
|
||||
return {
|
||||
router,
|
||||
loading,
|
||||
submitting,
|
||||
deleting,
|
||||
showAddDialog,
|
||||
deleteDialogVisible,
|
||||
modelToDelete,
|
||||
models,
|
||||
modelForm,
|
||||
providerDefaultUrls,
|
||||
providers,
|
||||
modelTypes,
|
||||
normalizeModelType,
|
||||
goHome,
|
||||
getProviderAbbr,
|
||||
getModelTypeLabel,
|
||||
fetchModels,
|
||||
openAddDialog,
|
||||
addModel,
|
||||
confirmDelete,
|
||||
handleDelete,
|
||||
testConnection
|
||||
}
|
||||
}
|
||||
})
|
||||
377
frontend/src/page-logic/ProjectFilePage.ts
Normal file
377
frontend/src/page-logic/ProjectFilePage.ts
Normal file
@@ -0,0 +1,377 @@
|
||||
import { defineComponent } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { fileApi } from '@/core/api'
|
||||
import DeleteDialog from '@/shared/components/common/DeleteDialog.vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'FileManage',
|
||||
components: { DeleteDialog },
|
||||
setup() {
|
||||
const route = useRoute()
|
||||
const projectId = computed(() => route.params.id)
|
||||
|
||||
const loading = ref(false)
|
||||
const files = ref([])
|
||||
const filterStatus = ref('')
|
||||
const isInitialLoad = ref(true)
|
||||
|
||||
const filteredFiles = computed(() => {
|
||||
if (!filterStatus.value) return files.value
|
||||
return files.value.filter(f => f.status === filterStatus.value)
|
||||
})
|
||||
const uploadDialogVisible = ref(false)
|
||||
const uploading = ref(false)
|
||||
const uploadRef = ref(null)
|
||||
const fileList = ref([])
|
||||
const deleteDialogVisible = ref(false)
|
||||
const pendingDeleteFile = ref(null)
|
||||
const deletingFile = ref(false)
|
||||
|
||||
// Multi-select
|
||||
const selectedFiles = ref([])
|
||||
|
||||
const isAllSelected = computed(() => filteredFiles.value.length > 0 && selectedFiles.value.length === filteredFiles.value.length)
|
||||
const selectedCount = computed(() => selectedFiles.value.length)
|
||||
|
||||
const toggleSelectAll = () => {
|
||||
if (isAllSelected.value) {
|
||||
selectedFiles.value = []
|
||||
} else {
|
||||
selectedFiles.value = filteredFiles.value.map(f => f.id)
|
||||
}
|
||||
}
|
||||
|
||||
const toggleSelect = (fileId) => {
|
||||
const index = selectedFiles.value.indexOf(fileId)
|
||||
if (index === -1) {
|
||||
selectedFiles.value.push(fileId)
|
||||
} else {
|
||||
selectedFiles.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
const isSelected = (fileId) => selectedFiles.value.includes(fileId)
|
||||
|
||||
const clearSelection = () => {
|
||||
selectedFiles.value = []
|
||||
}
|
||||
|
||||
const batchDeleteDialogVisible = ref(false)
|
||||
const batchDeleting = ref(false)
|
||||
const batchDeleteFiles = ref([])
|
||||
|
||||
const batchDelete = async () => {
|
||||
if (selectedFiles.value.length === 0) return
|
||||
batchDeleteFiles.value = files.value.filter(f => selectedFiles.value.includes(f.id))
|
||||
batchDeleteDialogVisible.value = true
|
||||
}
|
||||
|
||||
const executeBatchDelete = async () => {
|
||||
if (selectedFiles.value.length === 0) return
|
||||
batchDeleting.value = true
|
||||
try {
|
||||
for (const fileId of selectedFiles.value) {
|
||||
await fileApi.delete(projectId.value, fileId)
|
||||
}
|
||||
ElMessage.success(`已删除 ${selectedFiles.value.length} 个文件`)
|
||||
selectedFiles.value = []
|
||||
batchDeleteDialogVisible.value = false
|
||||
fetchFiles()
|
||||
} catch (error) {
|
||||
ElMessage.error('删除失败')
|
||||
} finally {
|
||||
batchDeleting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// Preview
|
||||
const previewVisible = ref(false)
|
||||
const previewFile = ref(null)
|
||||
const previewContent = ref('')
|
||||
const previewLoading = ref(false)
|
||||
const previewMode = ref('source') // 'source' | 'markdown'
|
||||
const isPdfPreview = ref(false)
|
||||
const pdfDataUrl = ref('')
|
||||
const previewError = ref('')
|
||||
|
||||
const completedFiles = computed(() => files.value.filter(f => f.status === 'completed').length)
|
||||
const processingFiles = computed(() => files.value.filter(f => f.status === 'processing' || f.status === 'pending'))
|
||||
const failedFiles = computed(() => files.value.filter(f => f.status === 'failed').length)
|
||||
|
||||
const fetchFiles = async () => {
|
||||
const wasInitial = isInitialLoad.value
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await fileApi.list(projectId.value)
|
||||
files.value = res || []
|
||||
} catch (error) {
|
||||
files.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (wasInitial) {
|
||||
isInitialLoad.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleUpload = () => {
|
||||
fileList.value = []
|
||||
uploadDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleChange = (file, files) => { fileList.value = files }
|
||||
const handleRemove = (file, files) => { fileList.value = files }
|
||||
|
||||
const triggerUpload = () => {
|
||||
const input = uploadRef.value?.$el?.querySelector('input')
|
||||
if (input) {
|
||||
input.click()
|
||||
}
|
||||
}
|
||||
|
||||
const submitUpload = async () => {
|
||||
if (fileList.value.length === 0) {
|
||||
ElMessage.warning('请先选择文件')
|
||||
return
|
||||
}
|
||||
|
||||
// 保存上传前的文件数量
|
||||
const prevFileCount = files.value.length
|
||||
|
||||
// 先关闭对话框
|
||||
uploadDialogVisible.value = false
|
||||
ElMessage.success('已开始上传文件')
|
||||
|
||||
// 设置上传状态,防止显示空状态
|
||||
uploading.value = true
|
||||
|
||||
// 在后台逐个上传(不等待上传完成)
|
||||
const uploadPromises = fileList.value.map(async (item) => {
|
||||
try {
|
||||
const formData = new FormData()
|
||||
formData.append('file', item.raw)
|
||||
await fileApi.upload(projectId.value, formData)
|
||||
} catch (error) {
|
||||
console.error('上传失败:', error)
|
||||
}
|
||||
})
|
||||
|
||||
// 立即刷新文件列表,显示新增的文件(状态为 processing)
|
||||
await fetchFiles()
|
||||
|
||||
// 如果之前没有文件,需要等待上传的Promise完成后再刷新一次
|
||||
if (prevFileCount === 0) {
|
||||
await Promise.all(uploadPromises)
|
||||
await fetchFiles()
|
||||
}
|
||||
|
||||
// 持续轮询文件列表,直到没有 processing 状态的文件
|
||||
const pollInterval = setInterval(async () => {
|
||||
await fetchFiles()
|
||||
// 检查是否还有处理中的文件
|
||||
const hasProcessing = files.value.some(f => f.status === 'processing')
|
||||
if (!hasProcessing) {
|
||||
clearInterval(pollInterval)
|
||||
uploading.value = false
|
||||
}
|
||||
}, 2000)
|
||||
|
||||
// 最多轮询60秒
|
||||
setTimeout(() => {
|
||||
clearInterval(pollInterval)
|
||||
uploading.value = false
|
||||
}, 60000)
|
||||
}
|
||||
|
||||
const handleDelete = async (file) => {
|
||||
try {
|
||||
deletingFile.value = true
|
||||
await fileApi.delete(projectId.value, file.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchFiles()
|
||||
} catch (error) {
|
||||
ElMessage.error('删除失败')
|
||||
} finally {
|
||||
deletingFile.value = false
|
||||
deleteDialogVisible.value = false
|
||||
pendingDeleteFile.value = null
|
||||
}
|
||||
}
|
||||
|
||||
const openDeleteDialog = (file) => {
|
||||
pendingDeleteFile.value = file
|
||||
deleteDialogVisible.value = true
|
||||
}
|
||||
|
||||
const confirmDeleteFile = async () => {
|
||||
if (!pendingDeleteFile.value) return
|
||||
await handleDelete(pendingDeleteFile.value)
|
||||
}
|
||||
|
||||
const handlePreview = async (file) => {
|
||||
previewFile.value = file
|
||||
previewVisible.value = true
|
||||
previewContent.value = ''
|
||||
previewError.value = ''
|
||||
previewLoading.value = true
|
||||
previewMode.value = 'source'
|
||||
|
||||
try {
|
||||
await loadPreviewContent()
|
||||
} finally {
|
||||
previewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadPreviewContent = async () => {
|
||||
if (!previewFile.value) return
|
||||
previewLoading.value = true
|
||||
previewContent.value = ''
|
||||
previewError.value = ''
|
||||
isPdfPreview.value = false
|
||||
pdfDataUrl.value = ''
|
||||
|
||||
try {
|
||||
const endpoint = previewMode.value === 'source' ? 'raw' : 'content'
|
||||
const response = await fetch(`/api/v1/projects/${projectId.value}/files/${previewFile.value.id}/${endpoint}`)
|
||||
|
||||
if (response.ok) {
|
||||
const text = await response.text()
|
||||
if (text.startsWith('data:application/pdf;base64,')) {
|
||||
isPdfPreview.value = true
|
||||
pdfDataUrl.value = text
|
||||
previewContent.value = ''
|
||||
} else {
|
||||
previewContent.value = text
|
||||
}
|
||||
} else if (response.status === 404) {
|
||||
previewError.value = previewMode.value === 'source'
|
||||
? '源文件不存在或已被删除'
|
||||
: 'Markdown 内容不存在,请等待处理完成'
|
||||
} else if (response.status === 500) {
|
||||
previewError.value = '服务器内部错误,请稍后重试'
|
||||
} else {
|
||||
previewError.value = `加载失败 (${response.status})`
|
||||
}
|
||||
} catch (error) {
|
||||
previewError.value = '网络错误,请检查网络连接'
|
||||
} finally {
|
||||
previewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const switchPreviewMode = async (mode) => {
|
||||
previewMode.value = mode
|
||||
await loadPreviewContent()
|
||||
}
|
||||
|
||||
const getFileIcon = (type) => {
|
||||
const map = { pdf: 'Document', docx: 'Document', xlsx: 'Grid', csv: 'Document', epub: 'Notebook', md: 'Document', txt: 'Document' }
|
||||
return map[type] || 'Document'
|
||||
}
|
||||
|
||||
const getTypeColor = (type) => {
|
||||
const map = {
|
||||
pdf: '#ef4444',
|
||||
docx: '#3b82f6',
|
||||
xlsx: '#22c55e',
|
||||
csv: '#22c55e',
|
||||
epub: '#f59e0b',
|
||||
md: '#8b5cf6',
|
||||
txt: '#6b7280'
|
||||
}
|
||||
return map[type] || '#6b7280'
|
||||
}
|
||||
|
||||
const getFileExt = (filename) => {
|
||||
if (!filename) return ''
|
||||
const ext = filename.split('.').pop()?.toLowerCase()
|
||||
return ext ? '.' + ext : ''
|
||||
}
|
||||
|
||||
const getStatusText = (status) => {
|
||||
const map = {
|
||||
processing: '处理中',
|
||||
completed: '已完成',
|
||||
failed: '失败',
|
||||
pending: '待处理'
|
||||
}
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
const formatSize = (bytes) => {
|
||||
if (!bytes) return '0 B'
|
||||
const k = 1024
|
||||
const sizes = ['B', 'KB', 'MB', 'GB']
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i]
|
||||
}
|
||||
|
||||
const formatDate = (date) => {
|
||||
if (!date) return ''
|
||||
return new Date(date).toLocaleDateString('zh-CN', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' })
|
||||
}
|
||||
|
||||
onMounted(() => fetchFiles())
|
||||
|
||||
return {
|
||||
route,
|
||||
projectId,
|
||||
loading,
|
||||
files,
|
||||
filterStatus,
|
||||
isInitialLoad,
|
||||
filteredFiles,
|
||||
uploadDialogVisible,
|
||||
uploading,
|
||||
uploadRef,
|
||||
fileList,
|
||||
deleteDialogVisible,
|
||||
pendingDeleteFile,
|
||||
deletingFile,
|
||||
selectedFiles,
|
||||
isAllSelected,
|
||||
selectedCount,
|
||||
toggleSelectAll,
|
||||
toggleSelect,
|
||||
isSelected,
|
||||
clearSelection,
|
||||
batchDeleteDialogVisible,
|
||||
batchDeleting,
|
||||
batchDeleteFiles,
|
||||
batchDelete,
|
||||
executeBatchDelete,
|
||||
previewVisible,
|
||||
previewFile,
|
||||
previewContent,
|
||||
previewLoading,
|
||||
previewMode,
|
||||
isPdfPreview,
|
||||
pdfDataUrl,
|
||||
previewError,
|
||||
completedFiles,
|
||||
processingFiles,
|
||||
failedFiles,
|
||||
fetchFiles,
|
||||
handleUpload,
|
||||
handleChange,
|
||||
handleRemove,
|
||||
triggerUpload,
|
||||
submitUpload,
|
||||
handleDelete,
|
||||
openDeleteDialog,
|
||||
confirmDeleteFile,
|
||||
handlePreview,
|
||||
loadPreviewContent,
|
||||
switchPreviewMode,
|
||||
getFileIcon,
|
||||
getTypeColor,
|
||||
getFileExt,
|
||||
getStatusText,
|
||||
formatSize,
|
||||
formatDate
|
||||
}
|
||||
}
|
||||
})
|
||||
252
frontend/src/page-logic/ProjectQuestionPage.ts
Normal file
252
frontend/src/page-logic/ProjectQuestionPage.ts
Normal file
@@ -0,0 +1,252 @@
|
||||
import { defineComponent } from 'vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { chunkApi, questionApi, modelApi } from '@/core/api'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'QuestionManage',
|
||||
setup() {
|
||||
const route = useRoute()
|
||||
const projectId = computed(() => route.params.id)
|
||||
|
||||
const loading = ref(false)
|
||||
const isInitialLoad = ref(true)
|
||||
const generating = ref(false)
|
||||
const questions = ref([])
|
||||
const chunks = ref([])
|
||||
const availableModels = ref([])
|
||||
const showGenerateDialog = ref(false)
|
||||
const filterStatus = ref('')
|
||||
const chunkMap = ref({})
|
||||
|
||||
const DEFAULT_GENERATE_PROMPT = '你是一名高质量中文问答数据构建助手。请基于给定 chunk 内容生成准确、自然、可用于训练的数据集问答对。问题必须清晰具体,答案必须直接来自内容或基于内容做合理概括,不要编造原文没有的信息,不要输出与目录、导航、页眉页脚、噪声文字相关的问题。'
|
||||
|
||||
const generateConfig = reactive({
|
||||
model_id: '',
|
||||
chunk_ids: [],
|
||||
count: 3,
|
||||
dirty_data_filter: true,
|
||||
thinking_mode: true,
|
||||
preset_prompt: DEFAULT_GENERATE_PROMPT
|
||||
})
|
||||
|
||||
// Multi-select
|
||||
const selectedQuestions = ref([])
|
||||
|
||||
const filteredQuestions = computed(() => {
|
||||
if (!filterStatus.value) return questions.value
|
||||
return questions.value.filter(q => q.source === filterStatus.value)
|
||||
})
|
||||
|
||||
const generatedCount = computed(() => questions.value.filter(q => q.source === 'generated').length)
|
||||
const manualCount = computed(() => questions.value.filter(q => q.source === 'manual').length)
|
||||
const failedCount = computed(() => questions.value.filter(q => q.status === 'failed').length)
|
||||
const generateModels = computed(() => {
|
||||
return availableModels.value.filter(model => {
|
||||
const type = normalizeModelType(model.model_type, model.model_name)
|
||||
return type === 'chat' || type === 'vlm'
|
||||
})
|
||||
})
|
||||
|
||||
const isAllSelected = computed(() => filteredQuestions.value.length > 0 && selectedQuestions.value.length === filteredQuestions.value.length)
|
||||
const selectedCount = computed(() => selectedQuestions.value.length)
|
||||
|
||||
const toggleSelectAll = () => {
|
||||
if (isAllSelected.value) {
|
||||
selectedQuestions.value = []
|
||||
} else {
|
||||
selectedQuestions.value = filteredQuestions.value.map(q => q.id)
|
||||
}
|
||||
}
|
||||
|
||||
const toggleSelect = (id) => {
|
||||
const index = selectedQuestions.value.indexOf(id)
|
||||
if (index === -1) {
|
||||
selectedQuestions.value.push(id)
|
||||
} else {
|
||||
selectedQuestions.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
const isSelected = (id) => selectedQuestions.value.includes(id)
|
||||
|
||||
const clearSelection = () => {
|
||||
selectedQuestions.value = []
|
||||
}
|
||||
|
||||
const batchDelete = async () => {
|
||||
if (selectedQuestions.value.length === 0) return
|
||||
try {
|
||||
for (const id of selectedQuestions.value) {
|
||||
await questionApi.delete(projectId.value, id)
|
||||
}
|
||||
ElMessage.success(`已删除 ${selectedQuestions.value.length} 个问题`)
|
||||
selectedQuestions.value = []
|
||||
fetchQuestions()
|
||||
} catch (error) {
|
||||
ElMessage.error('删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
const normalizeModelType = (modelType, modelName = '') => {
|
||||
if (modelType && modelType !== 'chat') {
|
||||
return modelType
|
||||
}
|
||||
const normalizedName = String(modelName).trim().toLowerCase()
|
||||
if (['rerank', 'bce-reranker', 'gte-rerank'].some(keyword => normalizedName.includes(keyword))) return 'rerank'
|
||||
if (['embedding', 'embed', 'text-embedding', 'bge-', 'gte-', 'm3e', 'e5-', 'jina-embeddings'].some(keyword => normalizedName.includes(keyword))) return 'embedding'
|
||||
if (['vl', 'vision', 'visual', 'multimodal', 'qwen-vl', 'gpt-4o'].some(keyword => normalizedName.includes(keyword))) return 'vlm'
|
||||
return 'chat'
|
||||
}
|
||||
|
||||
const getProviderLabel = (provider) => {
|
||||
const map = {
|
||||
openai: 'OpenAI Compatible',
|
||||
minimax: 'MiniMax',
|
||||
glm: 'GLM',
|
||||
ali: '阿里云百炼'
|
||||
}
|
||||
return map[provider] || provider
|
||||
}
|
||||
|
||||
const fetchAvailableModels = async () => {
|
||||
try {
|
||||
const res = await modelApi.list()
|
||||
availableModels.value = Array.isArray(res) ? res : (res?.data || [])
|
||||
if (!generateConfig.model_id && generateModels.value.length) {
|
||||
const defaultModel = generateModels.value.find(model => model.is_default === 'true') || generateModels.value[0]
|
||||
generateConfig.model_id = defaultModel?.id || ''
|
||||
}
|
||||
} catch (error) {
|
||||
availableModels.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const fetchAllChunks = async () => {
|
||||
const allChunks = []
|
||||
let page = 1
|
||||
let total = 0
|
||||
do {
|
||||
const res = await chunkApi.list(projectId.value, { page, page_size: 100 })
|
||||
const items = res.items || res.data || []
|
||||
total = res.total || res.pagination?.total || items.length
|
||||
allChunks.push(...items)
|
||||
page += 1
|
||||
} while (allChunks.length < total)
|
||||
return allChunks
|
||||
}
|
||||
|
||||
const fetchQuestions = async () => {
|
||||
const wasInitial = isInitialLoad.value
|
||||
loading.value = true
|
||||
try {
|
||||
const [chunkList, questionRes] = await Promise.all([
|
||||
fetchAllChunks(),
|
||||
questionApi.list(projectId.value, { page: 1, page_size: 500 })
|
||||
])
|
||||
chunks.value = chunkList
|
||||
chunkMap.value = Object.fromEntries(chunkList.map(chunk => [chunk.id, chunk]))
|
||||
questions.value = questionRes.items || questionRes.data || []
|
||||
} catch (error) {
|
||||
questions.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (wasInitial) {
|
||||
isInitialLoad.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleGenerate = async () => {
|
||||
if (generateConfig.chunk_ids.length === 0) {
|
||||
ElMessage.warning('请选择文本块')
|
||||
return
|
||||
}
|
||||
if (!generateConfig.model_id) {
|
||||
ElMessage.warning('请选择生成模型')
|
||||
return
|
||||
}
|
||||
generating.value = true
|
||||
try {
|
||||
await questionApi.generate(projectId.value, generateConfig)
|
||||
ElMessage.success('问题生成任务已启动')
|
||||
showGenerateDialog.value = false
|
||||
setTimeout(fetchQuestions, 2000)
|
||||
} catch (error) {
|
||||
ElMessage.error('生成失败')
|
||||
} finally {
|
||||
generating.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = async (question) => {
|
||||
try {
|
||||
await questionApi.delete(projectId.value, question.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchQuestions()
|
||||
} catch (error) {
|
||||
ElMessage.error('删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
const getTypeColor = (type) => {
|
||||
const map = { 'fact': '#22c55e', 'summary': '#818cf8', 'reasoning': '#f59e0b' }
|
||||
return map[type] || '#818cf8'
|
||||
}
|
||||
|
||||
const getTypeName = (type) => {
|
||||
const map = { 'fact': '事实性', 'summary': '总结性', 'reasoning': '推理性' }
|
||||
return map[type] || type
|
||||
}
|
||||
|
||||
const getSourceName = (source) => {
|
||||
const map = { 'generated': 'AI生成', 'manual': '手动', 'failed': '失败' }
|
||||
return map[source] || source
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchAvailableModels()
|
||||
fetchQuestions()
|
||||
})
|
||||
|
||||
return {
|
||||
route,
|
||||
projectId,
|
||||
loading,
|
||||
isInitialLoad,
|
||||
generating,
|
||||
questions,
|
||||
chunks,
|
||||
availableModels,
|
||||
showGenerateDialog,
|
||||
filterStatus,
|
||||
chunkMap,
|
||||
DEFAULT_GENERATE_PROMPT,
|
||||
generateConfig,
|
||||
selectedQuestions,
|
||||
filteredQuestions,
|
||||
generatedCount,
|
||||
manualCount,
|
||||
failedCount,
|
||||
generateModels,
|
||||
isAllSelected,
|
||||
selectedCount,
|
||||
toggleSelectAll,
|
||||
toggleSelect,
|
||||
isSelected,
|
||||
clearSelection,
|
||||
batchDelete,
|
||||
normalizeModelType,
|
||||
getProviderLabel,
|
||||
fetchAvailableModels,
|
||||
fetchAllChunks,
|
||||
fetchQuestions,
|
||||
handleGenerate,
|
||||
handleDelete,
|
||||
getTypeColor,
|
||||
getTypeName,
|
||||
getSourceName
|
||||
}
|
||||
}
|
||||
})
|
||||
839
frontend/src/page-logic/ProjectTextSplitPage.ts
Normal file
839
frontend/src/page-logic/ProjectTextSplitPage.ts
Normal file
@@ -0,0 +1,839 @@
|
||||
import { defineComponent } from 'vue'
|
||||
import { ref, reactive, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { fileApi, chunkApi, modelApi, questionApi } from '@/core/api'
|
||||
import DeleteDialog from '@/shared/components/common/DeleteDialog.vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TextSplit',
|
||||
components: { DeleteDialog },
|
||||
setup() {
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const projectId = computed(() => route.params.id)
|
||||
|
||||
const loading = ref(false)
|
||||
const splitting = ref(false)
|
||||
const files = ref([])
|
||||
const filterStatus = ref('')
|
||||
const fileChunks = ref({})
|
||||
const isInitialLoad = ref(true)
|
||||
const availableModels = ref([])
|
||||
const filePollingTimer = ref(null)
|
||||
const generateDialogVisible = ref(false)
|
||||
const generatingQuestions = ref(false)
|
||||
|
||||
const DEFAULT_GENERATE_PROMPT = '你是一名高质量中文问答数据构建助手。请基于给定 chunk 内容生成准确、自然、可用于训练的数据集问答对。问题必须清晰具体,答案必须直接来自内容或基于内容做合理概括,不要编造原文没有的信息,不要输出与目录、导航、页眉页脚、噪声文字相关的问题。'
|
||||
|
||||
// Multi-select
|
||||
const selectedFiles = ref([])
|
||||
const splitDialogVisible = ref(false)
|
||||
|
||||
// Chunk Preview Dialog
|
||||
const chunkPreviewVisible = ref(false)
|
||||
const previewFile = ref(null)
|
||||
const previewChunks = ref([])
|
||||
const previewLoading = ref(false)
|
||||
const savingChunks = ref(false)
|
||||
const deletingChunkId = ref('')
|
||||
const deletingFileChunksId = ref('')
|
||||
const deleteDialogVisible = ref(false)
|
||||
const deleteDialogMode = ref('')
|
||||
const deleteDialogTarget = ref(null)
|
||||
const previewSearch = ref('')
|
||||
const previewFilter = ref('all')
|
||||
const previewJumpInput = ref('')
|
||||
const selectedPreviewChunkId = ref('')
|
||||
|
||||
const isAllSelected = computed(() => filteredFiles.value.length > 0 && selectedFiles.value.length === filteredFiles.value.length)
|
||||
const selectedCount = computed(() => selectedFiles.value.length)
|
||||
|
||||
const filteredFiles = computed(() => {
|
||||
if (!filterStatus.value) return files.value
|
||||
return files.value.filter(f => {
|
||||
if (filterStatus.value === 'completed') {
|
||||
return fileChunks.value[f.id]
|
||||
}
|
||||
if (filterStatus.value === 'processing') {
|
||||
return f.status === 'processing'
|
||||
}
|
||||
return true
|
||||
})
|
||||
})
|
||||
|
||||
const toggleSelectAll = () => {
|
||||
if (isAllSelected.value) {
|
||||
selectedFiles.value = []
|
||||
} else {
|
||||
selectedFiles.value = filteredFiles.value.map(f => f.id)
|
||||
}
|
||||
}
|
||||
|
||||
const toggleSelect = (fileId) => {
|
||||
const index = selectedFiles.value.indexOf(fileId)
|
||||
if (index === -1) {
|
||||
selectedFiles.value.push(fileId)
|
||||
} else {
|
||||
selectedFiles.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
const isSelected = (fileId) => selectedFiles.value.includes(fileId)
|
||||
|
||||
const clearSelection = () => {
|
||||
selectedFiles.value = []
|
||||
}
|
||||
|
||||
const splitConfig = reactive({
|
||||
method: 'recursive',
|
||||
chunk_size: 500,
|
||||
overlap: 50,
|
||||
separator: '\n\n',
|
||||
embedding_model_id: '',
|
||||
similarity_threshold: 0.3,
|
||||
min_chunk_size: 100,
|
||||
})
|
||||
|
||||
const generateConfig = reactive({
|
||||
model_id: '',
|
||||
dirty_data_filter: true,
|
||||
thinking_mode: true,
|
||||
preset_prompt: DEFAULT_GENERATE_PROMPT,
|
||||
count: 3,
|
||||
})
|
||||
|
||||
const methods = [
|
||||
{ value: 'recursive', label: '递归字符', tag: '基础' },
|
||||
{ value: 'semantic', label: '句段优先', tag: '规则' },
|
||||
{ value: 'semantic_embedding', label: '语义嵌入', tag: 'API' },
|
||||
{ value: 'markdown_structure', label: 'Markdown', tag: '结构' },
|
||||
]
|
||||
|
||||
const completedFiles = computed(() => {
|
||||
return Object.keys(fileChunks.value).length
|
||||
})
|
||||
|
||||
const processingCount = computed(() => {
|
||||
return files.value.filter(f => f.status === 'processing').length
|
||||
})
|
||||
|
||||
const totalChunks = computed(() => {
|
||||
return Object.values(fileChunks.value).reduce((sum, count) => sum + count, 0)
|
||||
})
|
||||
|
||||
const normalizeModelType = (modelType, modelName = '') => {
|
||||
if (modelType && modelType !== 'chat') {
|
||||
return modelType
|
||||
}
|
||||
|
||||
const normalizedName = String(modelName).trim().toLowerCase()
|
||||
|
||||
if (['rerank', 'bce-reranker', 'gte-rerank'].some(keyword => normalizedName.includes(keyword))) {
|
||||
return 'rerank'
|
||||
}
|
||||
|
||||
if ([
|
||||
'embedding',
|
||||
'embed',
|
||||
'text-embedding',
|
||||
'bge-',
|
||||
'bge_m3',
|
||||
'gte-',
|
||||
'm3e',
|
||||
'e5-',
|
||||
'jina-embeddings'
|
||||
].some(keyword => normalizedName.includes(keyword))) {
|
||||
return 'embedding'
|
||||
}
|
||||
|
||||
if (['vl', 'vision', 'visual', 'multimodal', 'qwen-vl', 'gpt-4o'].some(keyword => normalizedName.includes(keyword))) {
|
||||
return 'vlm'
|
||||
}
|
||||
|
||||
return 'chat'
|
||||
}
|
||||
|
||||
const embeddingModels = computed(() => {
|
||||
return availableModels.value.filter(model => normalizeModelType(model.model_type, model.model_name) === 'embedding')
|
||||
})
|
||||
|
||||
const selectedEmbeddingModel = computed(() => {
|
||||
return embeddingModels.value.find(model => model.id === splitConfig.embedding_model_id) || null
|
||||
})
|
||||
|
||||
const generateModels = computed(() => {
|
||||
return availableModels.value.filter(model => {
|
||||
const type = normalizeModelType(model.model_type, model.model_name)
|
||||
return type === 'chat' || type === 'vlm'
|
||||
})
|
||||
})
|
||||
|
||||
const getProviderLabel = (provider) => {
|
||||
const providerMap = {
|
||||
openai: 'OpenAI Compatible',
|
||||
minimax: 'MiniMax',
|
||||
glm: 'GLM',
|
||||
ali: '阿里云百炼'
|
||||
}
|
||||
return providerMap[provider] || provider
|
||||
}
|
||||
|
||||
const fetchAllChunks = async () => {
|
||||
const allChunks = []
|
||||
let page = 1
|
||||
let total = 0
|
||||
|
||||
do {
|
||||
const res = await chunkApi.list(projectId.value, { page, page_size: 100 })
|
||||
const items = res.items || res.data || []
|
||||
total = res.total || res.pagination?.total || items.length
|
||||
allChunks.push(...items)
|
||||
page += 1
|
||||
} while (allChunks.length < total)
|
||||
|
||||
return allChunks
|
||||
}
|
||||
|
||||
const goToModelSettings = () => {
|
||||
splitDialogVisible.value = false
|
||||
generateDialogVisible.value = false
|
||||
router.push('/models')
|
||||
}
|
||||
|
||||
const fetchAvailableModels = async () => {
|
||||
try {
|
||||
const res = await modelApi.list()
|
||||
if (Array.isArray(res)) {
|
||||
availableModels.value = res
|
||||
} else if (res?.data && Array.isArray(res.data)) {
|
||||
availableModels.value = res.data
|
||||
} else {
|
||||
availableModels.value = []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
availableModels.value = []
|
||||
}
|
||||
}
|
||||
|
||||
watch(embeddingModels, (models) => {
|
||||
if (!models.length) {
|
||||
splitConfig.embedding_model_id = ''
|
||||
return
|
||||
}
|
||||
|
||||
if (!models.some(model => model.id === splitConfig.embedding_model_id)) {
|
||||
const defaultModel = models.find(model => model.is_default === 'true') || models[0]
|
||||
splitConfig.embedding_model_id = defaultModel?.id || ''
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
watch(generateModels, (models) => {
|
||||
if (!models.length) {
|
||||
generateConfig.model_id = ''
|
||||
return
|
||||
}
|
||||
|
||||
if (!models.some(model => model.id === generateConfig.model_id)) {
|
||||
const defaultModel = models.find(model => model.is_default === 'true') || models[0]
|
||||
generateConfig.model_id = defaultModel?.id || ''
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
const fetchFiles = async () => {
|
||||
const wasInitial = isInitialLoad.value
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await fileApi.list(projectId.value)
|
||||
files.value = res || []
|
||||
// 获取每个文件的 chunk 数量
|
||||
await fetchChunksCount()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (wasInitial) {
|
||||
isInitialLoad.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const fetchChunksCount = async () => {
|
||||
const counts = {}
|
||||
for (const file of files.value) {
|
||||
try {
|
||||
const res = await chunkApi.list(projectId.value, { file_id: file.id })
|
||||
const chunkList = res.items || res || []
|
||||
if (chunkList.length > 0) {
|
||||
counts[file.id] = chunkList.length
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
fileChunks.value = counts
|
||||
}
|
||||
|
||||
const openSplitDialog = () => {
|
||||
if (selectedFiles.value.length === 0) {
|
||||
ElMessage.warning('请先选择要分割的文件')
|
||||
return
|
||||
}
|
||||
if (!availableModels.value.length) {
|
||||
fetchAvailableModels()
|
||||
}
|
||||
splitDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleBatchSplit = async () => {
|
||||
if (selectedFiles.value.length === 0) {
|
||||
ElMessage.warning('请先选择文件')
|
||||
return
|
||||
}
|
||||
if (splitConfig.method === 'semantic_embedding' && !selectedEmbeddingModel.value) {
|
||||
ElMessage.warning('请先选择已配置的 embedding 模型')
|
||||
return
|
||||
}
|
||||
if (splitConfig.method === 'semantic_embedding' && !selectedEmbeddingModel.value?.api_key) {
|
||||
ElMessage.warning('当前 embedding 模型缺少 API Key,请先到模型配置补全')
|
||||
return
|
||||
}
|
||||
splitting.value = true
|
||||
splitDialogVisible.value = false
|
||||
|
||||
const successFiles = []
|
||||
const failedFiles = []
|
||||
|
||||
try {
|
||||
for (const fileId of selectedFiles.value) {
|
||||
const file = files.value.find(item => item.id === fileId)
|
||||
const payload = {
|
||||
file_id: fileId,
|
||||
method: splitConfig.method,
|
||||
chunk_size: splitConfig.chunk_size,
|
||||
overlap: splitConfig.overlap,
|
||||
separator: splitConfig.separator,
|
||||
similarity_threshold: splitConfig.similarity_threshold,
|
||||
min_chunk_size: splitConfig.min_chunk_size,
|
||||
}
|
||||
|
||||
if (splitConfig.method === 'semantic_embedding' && selectedEmbeddingModel.value) {
|
||||
payload.embedding_provider = selectedEmbeddingModel.value.provider
|
||||
payload.embedding_api_key = selectedEmbeddingModel.value.api_key
|
||||
payload.embedding_base_url = selectedEmbeddingModel.value.api_base
|
||||
payload.embedding_model = selectedEmbeddingModel.value.model_name
|
||||
}
|
||||
|
||||
try {
|
||||
await chunkApi.split(projectId.value, payload)
|
||||
successFiles.push(file?.filename || fileId)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
failedFiles.push({
|
||||
name: file?.filename || fileId,
|
||||
message: error?.message || '分割失败'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (successFiles.length && !failedFiles.length) {
|
||||
ElMessage.success(`已为 ${successFiles.length} 个文件启动后台分割任务`)
|
||||
} else if (successFiles.length && failedFiles.length) {
|
||||
ElMessage.warning(`已启动 ${successFiles.length} 个,失败 ${failedFiles.length} 个:${failedFiles[0].name} - ${failedFiles[0].message}`)
|
||||
} else if (failedFiles.length) {
|
||||
ElMessage.error(`分割失败:${failedFiles[0].name} - ${failedFiles[0].message}`)
|
||||
return
|
||||
}
|
||||
|
||||
// 清除选择
|
||||
selectedFiles.value = []
|
||||
|
||||
fetchFiles()
|
||||
} finally {
|
||||
splitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const openGenerateDialog = () => {
|
||||
if (completedFiles.value === 0) {
|
||||
ElMessage.warning('没有已分割的文件可生成')
|
||||
return
|
||||
}
|
||||
if (!availableModels.value.length) {
|
||||
fetchAvailableModels()
|
||||
}
|
||||
generateDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleBatchGenerate = async () => {
|
||||
if (!generateConfig.model_id) {
|
||||
ElMessage.warning('请选择用于生成问答的大语言模型')
|
||||
return
|
||||
}
|
||||
|
||||
generatingQuestions.value = true
|
||||
try {
|
||||
const allChunks = await fetchAllChunks()
|
||||
if (!allChunks.length) {
|
||||
ElMessage.warning('当前项目还没有可用文本块')
|
||||
return
|
||||
}
|
||||
|
||||
await questionApi.generate(projectId.value, {
|
||||
chunk_ids: allChunks.map(chunk => chunk.id),
|
||||
model_id: generateConfig.model_id,
|
||||
dirty_data_filter: generateConfig.dirty_data_filter,
|
||||
thinking_mode: generateConfig.thinking_mode,
|
||||
preset_prompt: generateConfig.preset_prompt,
|
||||
count: generateConfig.count
|
||||
})
|
||||
|
||||
generateDialogVisible.value = false
|
||||
ElMessage.success(`已为 ${allChunks.length} 个文本块启动后台问答生成任务`)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
ElMessage.error(error?.message || '问答生成启动失败')
|
||||
} finally {
|
||||
generatingQuestions.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// Chunk Preview Methods
|
||||
const openChunkPreview = async (file) => {
|
||||
previewFile.value = file
|
||||
previewSearch.value = ''
|
||||
previewFilter.value = 'all'
|
||||
previewJumpInput.value = ''
|
||||
selectedPreviewChunkId.value = ''
|
||||
chunkPreviewVisible.value = true
|
||||
await fetchPreviewChunks(file.id)
|
||||
}
|
||||
|
||||
const previewChunksWithIndex = computed(() => {
|
||||
return previewChunks.value.map((chunk, index) => ({
|
||||
...chunk,
|
||||
displayIndex: index + 1
|
||||
}))
|
||||
})
|
||||
|
||||
const isChunkModified = (chunk) => chunk.editingContent !== chunk.content
|
||||
|
||||
const filteredPreviewChunks = computed(() => {
|
||||
const keyword = previewSearch.value.trim().toLowerCase()
|
||||
|
||||
return previewChunksWithIndex.value.filter(chunk => {
|
||||
const matchesFilter = previewFilter.value !== 'modified' || isChunkModified(chunk)
|
||||
if (!matchesFilter) return false
|
||||
if (!keyword) return true
|
||||
|
||||
return String(chunk.displayIndex).includes(keyword) || chunk.content.toLowerCase().includes(keyword) || chunk.editingContent.toLowerCase().includes(keyword)
|
||||
})
|
||||
})
|
||||
|
||||
const activePreviewChunk = computed(() => {
|
||||
return previewChunks.value.find(chunk => chunk.id === selectedPreviewChunkId.value) || null
|
||||
})
|
||||
|
||||
const activePreviewChunkIndex = computed(() => {
|
||||
const index = previewChunks.value.findIndex(chunk => chunk.id === selectedPreviewChunkId.value)
|
||||
return index === -1 ? 0 : index + 1
|
||||
})
|
||||
|
||||
const modifiedPreviewCount = computed(() => {
|
||||
return previewChunks.value.filter(chunk => isChunkModified(chunk)).length
|
||||
})
|
||||
|
||||
const deleteDialogTitle = computed(() => {
|
||||
if (deleteDialogMode.value === 'chunk') return '删除分片'
|
||||
if (deleteDialogMode.value === 'file-chunks') return '删除全部分块'
|
||||
return '删除'
|
||||
})
|
||||
|
||||
const deleteDialogItemName = computed(() => {
|
||||
if (deleteDialogMode.value === 'chunk') {
|
||||
return `块 ${activePreviewChunkIndex.value || ''}`.trim()
|
||||
}
|
||||
if (deleteDialogMode.value === 'file-chunks') {
|
||||
return deleteDialogTarget.value?.filename || ''
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
const deleteDialogDetail = computed(() => {
|
||||
if (deleteDialogMode.value === 'chunk') {
|
||||
return '这会移除当前选中的单个文本分片,适用于清理错误切分或无效内容。'
|
||||
}
|
||||
if (deleteDialogMode.value === 'file-chunks') {
|
||||
return '这会清空当前文件已生成的全部分块,但不会删除文件本身。'
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
const deleteDialogWarning = computed(() => {
|
||||
if (deleteDialogMode.value === 'chunk') {
|
||||
return '删除后不可恢复,和该分片关联的后续内容可能需要重新生成。'
|
||||
}
|
||||
if (deleteDialogMode.value === 'file-chunks') {
|
||||
return '删除后不可恢复,该文件的全部分块将被清空,你需要重新执行分割才能恢复。'
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
const deleteDialogConfirmText = computed(() => {
|
||||
if (deleteDialogMode.value === 'chunk') return '确认删除分片'
|
||||
if (deleteDialogMode.value === 'file-chunks') return '确认删除全部分块'
|
||||
return '确认删除'
|
||||
})
|
||||
|
||||
const deleteDialogLoading = computed(() => {
|
||||
if (deleteDialogMode.value === 'chunk') {
|
||||
return !!deleteDialogTarget.value && deletingChunkId.value === deleteDialogTarget.value.id
|
||||
}
|
||||
if (deleteDialogMode.value === 'file-chunks') {
|
||||
return !!deleteDialogTarget.value && deletingFileChunksId.value === deleteDialogTarget.value.id
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
const selectPreviewChunk = (chunkId) => {
|
||||
selectedPreviewChunkId.value = chunkId
|
||||
}
|
||||
|
||||
const getChunkSnippet = (chunk) => {
|
||||
return (chunk.editingContent || chunk.content || '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim()
|
||||
.slice(0, 110) || '空白分片'
|
||||
}
|
||||
|
||||
const jumpToChunk = () => {
|
||||
const index = Number(previewJumpInput.value)
|
||||
if (!Number.isInteger(index) || index < 1) {
|
||||
ElMessage.warning('请输入有效的块号')
|
||||
return
|
||||
}
|
||||
|
||||
const target = previewChunksWithIndex.value.find(chunk => chunk.displayIndex === index)
|
||||
if (!target) {
|
||||
ElMessage.warning('未找到对应块号')
|
||||
return
|
||||
}
|
||||
|
||||
if (previewFilter.value === 'modified' && !isChunkModified(target)) {
|
||||
previewFilter.value = 'all'
|
||||
}
|
||||
|
||||
selectedPreviewChunkId.value = target.id
|
||||
}
|
||||
|
||||
const resetChunk = (chunk) => {
|
||||
chunk.editingContent = chunk.content
|
||||
}
|
||||
|
||||
const openDeleteChunkDialog = (chunk) => {
|
||||
deleteDialogMode.value = 'chunk'
|
||||
deleteDialogTarget.value = chunk
|
||||
deleteDialogVisible.value = true
|
||||
}
|
||||
|
||||
const openDeleteFileChunksDialog = (file) => {
|
||||
deleteDialogMode.value = 'file-chunks'
|
||||
deleteDialogTarget.value = file
|
||||
deleteDialogVisible.value = true
|
||||
}
|
||||
|
||||
const fetchPreviewChunks = async (fileId) => {
|
||||
previewLoading.value = true
|
||||
try {
|
||||
const res = await chunkApi.list(projectId.value, { file_id: fileId })
|
||||
previewChunks.value = (res.items || res || []).map(c => ({
|
||||
...c,
|
||||
editingContent: c.content
|
||||
}))
|
||||
selectedPreviewChunkId.value = previewChunks.value[0]?.id || ''
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
ElMessage.error('获取 chunks 失败')
|
||||
} finally {
|
||||
previewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const saveChunk = async (chunk) => {
|
||||
savingChunks.value = true
|
||||
try {
|
||||
await chunkApi.update(projectId.value, chunk.id, {
|
||||
content: chunk.editingContent
|
||||
})
|
||||
ElMessage.success('保存成功')
|
||||
// Update local state
|
||||
chunk.content = chunk.editingContent
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
ElMessage.error('保存失败')
|
||||
} finally {
|
||||
savingChunks.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const deleteChunk = async (chunk) => {
|
||||
deletingChunkId.value = chunk.id
|
||||
try {
|
||||
await chunkApi.delete(projectId.value, chunk.id)
|
||||
previewChunks.value = previewChunks.value.filter(item => item.id !== chunk.id)
|
||||
|
||||
if (previewFile.value?.id) {
|
||||
const nextCount = Math.max((fileChunks.value[previewFile.value.id] || 1) - 1, 0)
|
||||
if (nextCount > 0) {
|
||||
fileChunks.value = {
|
||||
...fileChunks.value,
|
||||
[previewFile.value.id]: nextCount
|
||||
}
|
||||
} else {
|
||||
const { [previewFile.value.id]: _, ...rest } = fileChunks.value
|
||||
fileChunks.value = rest
|
||||
}
|
||||
}
|
||||
|
||||
ElMessage.success('删除成功')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
ElMessage.error('删除失败')
|
||||
} finally {
|
||||
deletingChunkId.value = ''
|
||||
deleteDialogVisible.value = false
|
||||
deleteDialogMode.value = ''
|
||||
deleteDialogTarget.value = null
|
||||
}
|
||||
}
|
||||
|
||||
const deleteFileChunks = async (file) => {
|
||||
deletingFileChunksId.value = file.id
|
||||
try {
|
||||
const allChunks = []
|
||||
let page = 1
|
||||
let total = 0
|
||||
|
||||
do {
|
||||
const res = await chunkApi.list(projectId.value, {
|
||||
file_id: file.id,
|
||||
page,
|
||||
page_size: 100
|
||||
})
|
||||
const items = res.items || []
|
||||
total = res.total || items.length
|
||||
allChunks.push(...items)
|
||||
page += 1
|
||||
} while (allChunks.length < total)
|
||||
|
||||
for (const chunk of allChunks) {
|
||||
await chunkApi.delete(projectId.value, chunk.id)
|
||||
}
|
||||
|
||||
const { [file.id]: _, ...rest } = fileChunks.value
|
||||
fileChunks.value = rest
|
||||
|
||||
if (previewFile.value?.id === file.id) {
|
||||
previewChunks.value = []
|
||||
selectedPreviewChunkId.value = ''
|
||||
}
|
||||
|
||||
ElMessage.success(`已删除 ${allChunks.length} 个分块`)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
ElMessage.error('删除全部分块失败')
|
||||
} finally {
|
||||
deletingFileChunksId.value = ''
|
||||
deleteDialogVisible.value = false
|
||||
deleteDialogMode.value = ''
|
||||
deleteDialogTarget.value = null
|
||||
}
|
||||
}
|
||||
|
||||
const confirmDeleteAction = async () => {
|
||||
if (!deleteDialogTarget.value) return
|
||||
|
||||
if (deleteDialogMode.value === 'chunk') {
|
||||
await deleteChunk(deleteDialogTarget.value)
|
||||
return
|
||||
}
|
||||
|
||||
if (deleteDialogMode.value === 'file-chunks') {
|
||||
await deleteFileChunks(deleteDialogTarget.value)
|
||||
}
|
||||
}
|
||||
|
||||
watch(filteredPreviewChunks, (chunks) => {
|
||||
if (!chunks.length) {
|
||||
selectedPreviewChunkId.value = ''
|
||||
return
|
||||
}
|
||||
|
||||
if (!chunks.some(chunk => chunk.id === selectedPreviewChunkId.value)) {
|
||||
selectedPreviewChunkId.value = chunks[0].id
|
||||
}
|
||||
})
|
||||
|
||||
const refreshFiles = () => {
|
||||
fetchFiles()
|
||||
}
|
||||
|
||||
const startFilePolling = () => {
|
||||
if (filePollingTimer.value) return
|
||||
filePollingTimer.value = window.setInterval(() => {
|
||||
fetchFiles()
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
const stopFilePolling = () => {
|
||||
if (!filePollingTimer.value) return
|
||||
window.clearInterval(filePollingTimer.value)
|
||||
filePollingTimer.value = null
|
||||
}
|
||||
|
||||
const formatSize = (bytes) => {
|
||||
if (!bytes) return '0 B'
|
||||
const units = ['B', 'KB', 'MB', 'GB']
|
||||
let i = 0
|
||||
while (bytes >= 1024 && i < units.length - 1) {
|
||||
bytes /= 1024
|
||||
i++
|
||||
}
|
||||
return `${bytes.toFixed(1)} ${units[i]}`
|
||||
}
|
||||
|
||||
const getFileBg = (type) => {
|
||||
const colors = {
|
||||
pdf: '#ef4444',
|
||||
docx: '#3b82f6',
|
||||
xlsx: '#22c55e',
|
||||
csv: '#f59e0b',
|
||||
md: '#8b5cf6',
|
||||
txt: '#6b7280',
|
||||
epub: '#ec4899'
|
||||
}
|
||||
return colors[type] || '#6b7280'
|
||||
}
|
||||
|
||||
const getFileIcon = (type) => {
|
||||
const icons = {
|
||||
pdf: 'Document',
|
||||
docx: 'Document',
|
||||
xlsx: 'Grid',
|
||||
csv: 'Grid',
|
||||
md: 'Document',
|
||||
txt: 'Document',
|
||||
epub: 'Book'
|
||||
}
|
||||
return icons[type] || 'Document'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchAvailableModels()
|
||||
fetchFiles()
|
||||
})
|
||||
|
||||
watch(processingCount, (count) => {
|
||||
if (count > 0) {
|
||||
startFilePolling()
|
||||
} else {
|
||||
stopFilePolling()
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
onUnmounted(() => {
|
||||
stopFilePolling()
|
||||
})
|
||||
|
||||
return {
|
||||
router,
|
||||
route,
|
||||
projectId,
|
||||
loading,
|
||||
splitting,
|
||||
files,
|
||||
filterStatus,
|
||||
fileChunks,
|
||||
isInitialLoad,
|
||||
availableModels,
|
||||
filePollingTimer,
|
||||
generateDialogVisible,
|
||||
generatingQuestions,
|
||||
DEFAULT_GENERATE_PROMPT,
|
||||
selectedFiles,
|
||||
splitDialogVisible,
|
||||
chunkPreviewVisible,
|
||||
previewFile,
|
||||
previewChunks,
|
||||
previewLoading,
|
||||
savingChunks,
|
||||
deletingChunkId,
|
||||
deletingFileChunksId,
|
||||
deleteDialogVisible,
|
||||
deleteDialogMode,
|
||||
deleteDialogTarget,
|
||||
previewSearch,
|
||||
previewFilter,
|
||||
previewJumpInput,
|
||||
selectedPreviewChunkId,
|
||||
isAllSelected,
|
||||
selectedCount,
|
||||
filteredFiles,
|
||||
toggleSelectAll,
|
||||
toggleSelect,
|
||||
isSelected,
|
||||
clearSelection,
|
||||
splitConfig,
|
||||
generateConfig,
|
||||
methods,
|
||||
completedFiles,
|
||||
processingCount,
|
||||
totalChunks,
|
||||
normalizeModelType,
|
||||
embeddingModels,
|
||||
selectedEmbeddingModel,
|
||||
generateModels,
|
||||
getProviderLabel,
|
||||
fetchAllChunks,
|
||||
goToModelSettings,
|
||||
fetchAvailableModels,
|
||||
fetchFiles,
|
||||
fetchChunksCount,
|
||||
openSplitDialog,
|
||||
handleBatchSplit,
|
||||
openGenerateDialog,
|
||||
handleBatchGenerate,
|
||||
openChunkPreview,
|
||||
previewChunksWithIndex,
|
||||
isChunkModified,
|
||||
filteredPreviewChunks,
|
||||
activePreviewChunk,
|
||||
activePreviewChunkIndex,
|
||||
modifiedPreviewCount,
|
||||
deleteDialogTitle,
|
||||
deleteDialogItemName,
|
||||
deleteDialogDetail,
|
||||
deleteDialogWarning,
|
||||
deleteDialogConfirmText,
|
||||
deleteDialogLoading,
|
||||
selectPreviewChunk,
|
||||
getChunkSnippet,
|
||||
jumpToChunk,
|
||||
resetChunk,
|
||||
openDeleteChunkDialog,
|
||||
openDeleteFileChunksDialog,
|
||||
fetchPreviewChunks,
|
||||
saveChunk,
|
||||
deleteChunk,
|
||||
deleteFileChunks,
|
||||
confirmDeleteAction,
|
||||
refreshFiles,
|
||||
startFilePolling,
|
||||
stopFilePolling,
|
||||
formatSize,
|
||||
getFileBg,
|
||||
getFileIcon
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -137,7 +137,7 @@ import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Link, Download, FolderAdd } from '@element-plus/icons-vue'
|
||||
import { projectApi } from '@/api'
|
||||
import { projectApi } from '@/core/api'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -257,14 +257,14 @@ import { ref, onMounted, computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { FolderAdd, Check, Connection, Clock, Lock, TrendCharts, ArrowLeft, ArrowRight } from '@element-plus/icons-vue'
|
||||
import { projectApi } from '@/api'
|
||||
import type { Project, ProjectCreate } from '@/types'
|
||||
import { projectApi } from '@/core/api'
|
||||
import type { Project, ProjectCreate } from '@/shared/types'
|
||||
|
||||
// Components
|
||||
import EmptyState from '@/components/common/EmptyState.vue'
|
||||
import ProjectCard from '@/components/common/ProjectCard.vue'
|
||||
import CreateProjectDialog from '@/components/common/CreateProjectDialog.vue'
|
||||
import DeleteDialog from '@/components/common/DeleteDialog.vue'
|
||||
import EmptyState from '@/shared/components/common/EmptyState.vue'
|
||||
import ProjectCard from '@/shared/components/common/ProjectCard.vue'
|
||||
import CreateProjectDialog from '@/shared/components/common/CreateProjectDialog.vue'
|
||||
import DeleteDialog from '@/shared/components/common/DeleteDialog.vue'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
262
frontend/src/pages/ModelSettingsPage.vue
Normal file
262
frontend/src/pages/ModelSettingsPage.vue
Normal file
@@ -0,0 +1,262 @@
|
||||
<template>
|
||||
<div class="model-settings">
|
||||
<!-- 背景效果 -->
|
||||
<div class="bg-effects">
|
||||
<div class="glow-orb glow-1"></div>
|
||||
<div class="glow-orb glow-2"></div>
|
||||
</div>
|
||||
|
||||
<!-- 页面头部 -->
|
||||
<header class="page-header">
|
||||
<div class="header-left">
|
||||
<el-button text class="back-btn" @click="goHome">
|
||||
<el-icon><ArrowLeft /></el-icon>
|
||||
<span>返回</span>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="header-content">
|
||||
<h1 class="page-title">
|
||||
<el-icon class="title-icon"><Cpu /></el-icon>
|
||||
模型管理
|
||||
</h1>
|
||||
<p class="page-subtitle">管理您的 AI 模型 API</p>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<el-button type="primary" class="add-btn" @click="openAddDialog">
|
||||
<el-icon><Plus /></el-icon>
|
||||
<span>添加模型</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 主内容 -->
|
||||
<main class="page-main">
|
||||
<!-- 模型列表 -->
|
||||
<section class="models-section">
|
||||
<div class="section-header">
|
||||
<h2 class="section-title">
|
||||
<span class="title-line"></span>
|
||||
已配置的模型
|
||||
</h2>
|
||||
<span class="count-badge">{{ models.length }} 个</span>
|
||||
</div>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<div v-if="models.length === 0 && !loading" class="empty-state">
|
||||
<div class="empty-illustration">
|
||||
<div class="pulse-ring"></div>
|
||||
<el-icon size="48"><Setting /></el-icon>
|
||||
</div>
|
||||
<h3>暂无模型配置</h3>
|
||||
<p>添加您的第一个 AI 模型开始使用</p>
|
||||
<el-button type="primary" @click="openAddDialog">添加模型</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 模型卡片 -->
|
||||
<div v-else class="models-grid">
|
||||
<article
|
||||
v-for="(model, index) in models"
|
||||
:key="model.id"
|
||||
class="model-card"
|
||||
:class="{ 'is-default': model.is_default === 'true' }"
|
||||
:style="{ '--delay': index * 0.08 + 's' }"
|
||||
>
|
||||
<div class="card-glow"></div>
|
||||
|
||||
<!-- 默认标识 -->
|
||||
<div v-if="model.is_default === 'true'" class="default-badge">
|
||||
<el-icon><Star /></el-icon>
|
||||
默认
|
||||
</div>
|
||||
|
||||
<!-- 提供商图标 -->
|
||||
<div class="provider-logo" :class="model.provider">
|
||||
{{ getProviderAbbr(model.provider) }}
|
||||
</div>
|
||||
|
||||
<!-- 模型信息 -->
|
||||
<div class="model-info">
|
||||
<div class="model-name-row">
|
||||
<h3 class="model-name">{{ model.model_name }}</h3>
|
||||
<span class="model-type-badge" :class="`type-${normalizeModelType(model.model_type, model.model_name)}`">
|
||||
{{ getModelTypeLabel(model.model_type, model.model_name) }}
|
||||
</span>
|
||||
</div>
|
||||
<p class="model-endpoint">
|
||||
<el-icon><Link /></el-icon>
|
||||
{{ model.api_base || '默认端点' }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 底部操作 -->
|
||||
<div class="card-footer">
|
||||
<div class="status-badge" :class="model.connection_status">
|
||||
<span class="status-dot" :class="model.connection_status"></span>
|
||||
<template v-if="model.connection_status === 'connected'">已联通</template>
|
||||
<template v-else-if="model.connection_status === 'failed'">连接失败</template>
|
||||
<template v-else>未测试</template>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<el-button text class="action-btn test" @click="testConnection(model)">
|
||||
测试连接
|
||||
</el-button>
|
||||
<el-button text class="action-btn delete" @click="confirmDelete(model)">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<el-dialog
|
||||
v-model="showAddDialog"
|
||||
:show-close="false"
|
||||
width="560px"
|
||||
class="add-dialog"
|
||||
:append-to-body="true"
|
||||
>
|
||||
<template #header>
|
||||
<div class="dialog-header">
|
||||
<div class="dialog-icon">
|
||||
<el-icon size="20"><Plus /></el-icon>
|
||||
</div>
|
||||
<div class="dialog-title">
|
||||
<h3>添加模型</h3>
|
||||
<p>配置新的 AI 模型</p>
|
||||
</div>
|
||||
<button class="dialog-close" @click="showAddDialog = false">
|
||||
<el-icon><Close /></el-icon>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="modelForm" label-position="top" class="model-form">
|
||||
<el-form-item label="选择提供商">
|
||||
<el-select
|
||||
v-model="modelForm.provider"
|
||||
placeholder="选择 AI 服务提供商"
|
||||
size="large"
|
||||
class="provider-select"
|
||||
popper-class="provider-select-dropdown"
|
||||
>
|
||||
<el-option
|
||||
v-for="provider in providers"
|
||||
:key="provider.value"
|
||||
:label="provider.label"
|
||||
:value="provider.value"
|
||||
>
|
||||
<div class="provider-option-item">
|
||||
<span class="provider-icon">{{ provider.abbr }}</span>
|
||||
<div class="provider-copy">
|
||||
<span>{{ provider.label }}</span>
|
||||
<small>{{ provider.desc }}</small>
|
||||
</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="模型类型">
|
||||
<el-select
|
||||
v-model="modelForm.model_type"
|
||||
placeholder="选择模型类型"
|
||||
size="large"
|
||||
class="provider-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="type in modelTypes"
|
||||
:key="type.value"
|
||||
:label="type.label"
|
||||
:value="type.value"
|
||||
>
|
||||
<div class="provider-option-item">
|
||||
<span class="provider-icon">{{ type.abbr }}</span>
|
||||
<div class="provider-copy">
|
||||
<span>{{ type.label }}</span>
|
||||
<small>{{ type.desc }}</small>
|
||||
</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="模型名称" required>
|
||||
<el-input
|
||||
v-model="modelForm.model_name"
|
||||
placeholder="例如: gpt-4o-mini / text-embedding-v3-small"
|
||||
size="large"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="API Key" required>
|
||||
<el-input
|
||||
v-model="modelForm.api_key"
|
||||
type="password"
|
||||
placeholder="输入 API Key"
|
||||
size="large"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="API 地址">
|
||||
<el-input
|
||||
v-model="modelForm.api_base"
|
||||
placeholder="自定义 API 地址"
|
||||
size="large"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-checkbox v-model="modelForm.is_default">
|
||||
设为默认模型
|
||||
</el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="showAddDialog = false" size="large">取消</el-button>
|
||||
<el-button type="primary" @click="addModel" :loading="submitting" size="large">
|
||||
添加模型
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="deleteDialogVisible"
|
||||
:show-close="false"
|
||||
width="400"
|
||||
class="delete-dialog"
|
||||
:append-to-body="true"
|
||||
>
|
||||
<template #header>
|
||||
<div class="delete-header">
|
||||
<div class="delete-icon">
|
||||
<el-icon size="24"><WarningFilled /></el-icon>
|
||||
</div>
|
||||
<h3>确认删除</h3>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="delete-content">
|
||||
<p>确定要删除模型 <strong>{{ modelToDelete?.model_name }}</strong> 吗?</p>
|
||||
<p class="warning-text">此操作不可恢复</p>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="delete-footer">
|
||||
<el-button @click="deleteDialogVisible = false" size="large">取消</el-button>
|
||||
<el-button type="danger" @click="handleDelete" :loading="deleting" size="large">
|
||||
确认删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="../page-logic/ModelSettingsPage.ts"></script>
|
||||
<style scoped src="../styles/pages/model-settings.css"></style>
|
||||
@@ -128,7 +128,7 @@
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { datasetApi } from '@/api'
|
||||
import { datasetApi } from '@/core/api'
|
||||
|
||||
const route = useRoute()
|
||||
const projectId = computed(() => route.params.id)
|
||||
@@ -294,7 +294,7 @@
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { evalApi } from '@/api'
|
||||
import { evalApi } from '@/core/api'
|
||||
|
||||
const route = useRoute()
|
||||
const projectId = computed(() => route.params.id)
|
||||
319
frontend/src/pages/ProjectFilePage.vue
Normal file
319
frontend/src/pages/ProjectFilePage.vue
Normal file
@@ -0,0 +1,319 @@
|
||||
<template>
|
||||
<div class="file-manage">
|
||||
<!-- Header -->
|
||||
<div class="page-header">
|
||||
<div class="header-left">
|
||||
<h2 class="page-title">文件管理</h2>
|
||||
<p class="page-subtitle">管理您的文档集合</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<el-button type="primary" @click="handleUpload" class="upload-btn">
|
||||
<el-icon><Upload /></el-icon>
|
||||
<span>上传文件</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats Cards -->
|
||||
<div class="stats-grid">
|
||||
<div
|
||||
class="stat-card stat-total"
|
||||
:class="{ active: filterStatus === '' }"
|
||||
@click="filterStatus = ''"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><Document /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ files.length }}</span>
|
||||
<span class="stat-label">总文件数</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-completed"
|
||||
:class="{ active: filterStatus === 'completed' }"
|
||||
@click="filterStatus = filterStatus === 'completed' ? '' : 'completed'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><CircleCheckFilled /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ completedFiles }}</span>
|
||||
<span class="stat-label">已完成</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-processing"
|
||||
:class="{ active: filterStatus === 'processing' }"
|
||||
@click="filterStatus = filterStatus === 'processing' ? '' : 'processing'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><Loading /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ processingFiles.length }}</span>
|
||||
<span class="stat-label">处理中</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-failed"
|
||||
:class="{ active: filterStatus === 'failed' }"
|
||||
@click="filterStatus = filterStatus === 'failed' ? '' : 'failed'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><CircleCloseFilled /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ failedFiles }}</span>
|
||||
<span class="stat-label">失败</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- File List Container -->
|
||||
<div class="file-container" v-loading="loading && isInitialLoad">
|
||||
<!-- Empty State -->
|
||||
<div v-if="!loading && !isInitialLoad && filteredFiles.length === 0 && !uploading" class="empty-state">
|
||||
<div class="empty-illustration">
|
||||
<div class="orbit orbit-1"></div>
|
||||
<div class="orbit orbit-2"></div>
|
||||
<div class="orbit orbit-3"></div>
|
||||
<div class="empty-core">
|
||||
<el-icon size="40"><FolderOpened /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="empty-title">暂无文件</h3>
|
||||
<p class="empty-desc">上传您的第一个文档,开启智能处理之旅</p>
|
||||
</div>
|
||||
|
||||
<!-- Files Table -->
|
||||
<div v-else class="files-table-wrapper">
|
||||
<!-- Table Header -->
|
||||
<div class="table-header">
|
||||
<div class="table-select">
|
||||
<el-checkbox
|
||||
:model-value="isAllSelected"
|
||||
@change="toggleSelectAll"
|
||||
class="select-all"
|
||||
>
|
||||
<span v-if="selectedCount > 0" class="selected-text">已选择 {{ selectedCount }} 项</span>
|
||||
<span v-else>全选</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
<div class="table-actions" v-if="selectedCount > 0">
|
||||
<el-button type="danger" size="small" plain @click="clearSelection" class="batch-clear-btn">
|
||||
<el-icon><Close /></el-icon>
|
||||
<span>清除选择</span>
|
||||
</el-button>
|
||||
<el-button type="danger" size="small" plain @click="batchDelete" class="batch-delete-btn">
|
||||
<el-icon><Delete /></el-icon>
|
||||
<span>批量删除</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table Body -->
|
||||
<div class="files-table">
|
||||
<div
|
||||
v-for="(file, index) in filteredFiles"
|
||||
:key="file.id"
|
||||
class="file-row"
|
||||
:class="{
|
||||
'is-selected': isSelected(file.id),
|
||||
'is-processing': file.status === 'processing',
|
||||
'row-animated': isInitialLoad
|
||||
}"
|
||||
:style="{ '--delay': index * 0.04 + 's' }"
|
||||
@click="toggleSelect(file.id)"
|
||||
>
|
||||
<!-- Select Checkbox -->
|
||||
<div class="col-select" @click.stop>
|
||||
<el-checkbox
|
||||
:model-value="isSelected(file.id)"
|
||||
@change="toggleSelect(file.id)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- File Icon -->
|
||||
<div class="col-icon">
|
||||
<div class="file-type-icon" :style="{ '--type-color': getTypeColor(file.file_type) }">
|
||||
<el-icon size="18">
|
||||
<component :is="getFileIcon(file.file_type)" />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- File Name -->
|
||||
<div class="col-name">
|
||||
<span class="filename-text">{{ file.filename }}</span>
|
||||
<span class="file-ext">{{ getFileExt(file.filename) }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Size -->
|
||||
<div class="col-size">
|
||||
{{ formatSize(file.size) }}
|
||||
</div>
|
||||
|
||||
<!-- Date -->
|
||||
<div class="col-date">
|
||||
{{ formatDate(file.created_at) }}
|
||||
</div>
|
||||
|
||||
<!-- Status -->
|
||||
<div class="col-status">
|
||||
<div class="status-pill" :class="'status-' + file.status">
|
||||
<span class="status-dot"></span>
|
||||
<span class="status-text">{{ getStatusText(file.status) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="col-actions" @click.stop>
|
||||
<el-tooltip content="预览" placement="top" v-if="file.status === 'completed'">
|
||||
<el-button text size="small" class="action-btn preview" @click="handlePreview(file)">
|
||||
<el-icon><View /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-button text size="small" class="action-btn delete" @click="openDeleteDialog(file)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Upload Dialog -->
|
||||
<el-dialog v-model="uploadDialogVisible" title="上传文件" width="520px" class="upload-dialog" :close-on-click-modal="false">
|
||||
<div class="upload-area" @click="triggerUpload">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
class="upload-component"
|
||||
:auto-upload="false"
|
||||
:limit="10"
|
||||
:on-change="handleChange"
|
||||
:on-remove="handleRemove"
|
||||
:file-list="fileList"
|
||||
drag
|
||||
multiple
|
||||
accept=".pdf,.docx,.doc,.xlsx,.xls,.csv,.epub,.md,.txt"
|
||||
style="display: none;"
|
||||
/>
|
||||
<div class="upload-content">
|
||||
<div class="upload-illustration">
|
||||
<div class="upload-ring"></div>
|
||||
<div class="upload-core">
|
||||
<el-icon size="32"><UploadFilled /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upload-text">
|
||||
拖拽文件到此处,或 <em>点击选择</em>
|
||||
</div>
|
||||
<div class="upload-hint">
|
||||
支持 PDF、DOCX、Excel、EPUB、Markdown 等格式
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Selected Files -->
|
||||
<div v-if="fileList.length > 0" class="selected-area">
|
||||
<div class="selected-header">
|
||||
<span>已选择 <strong>{{ fileList.length }}</strong> 个文件</span>
|
||||
<el-button text size="small" @click="fileList = []">清空</el-button>
|
||||
</div>
|
||||
<div class="selected-list">
|
||||
<div v-for="item in fileList" :key="item.uid" class="selected-item">
|
||||
<el-icon size="14"><Document /></el-icon>
|
||||
<span>{{ item.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="uploadDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitUpload" :loading="uploading" :disabled="fileList.length === 0">
|
||||
开始上传
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<Teleport to="body">
|
||||
<Transition name="fade">
|
||||
<div
|
||||
v-if="previewVisible"
|
||||
class="preview-backdrop"
|
||||
@click="previewVisible = false"
|
||||
></div>
|
||||
</Transition>
|
||||
|
||||
<Transition name="slide-right">
|
||||
<div v-if="previewVisible" class="preview-modal">
|
||||
<div class="preview-header">
|
||||
<div class="header-title">
|
||||
<el-icon class="title-icon"><Document /></el-icon>
|
||||
<span class="filename">{{ previewFile?.filename }}</span>
|
||||
</div>
|
||||
<el-button class="close-btn" text @click="previewVisible = false">
|
||||
<el-icon><Close /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div class="preview-tabs-wrapper">
|
||||
<div class="preview-tabs">
|
||||
<button
|
||||
class="tab-item"
|
||||
:class="{ active: previewMode === 'source' }"
|
||||
@click="switchPreviewMode('source')"
|
||||
>
|
||||
源文件
|
||||
</button>
|
||||
<button
|
||||
class="tab-item"
|
||||
:class="{ active: previewMode === 'markdown' }"
|
||||
@click="switchPreviewMode('markdown')"
|
||||
>
|
||||
Markdown
|
||||
</button>
|
||||
<div class="tab-indicator" :class="{ 'at-right': previewMode === 'markdown' }"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="preview-content" v-loading="previewLoading">
|
||||
<iframe v-if="isPdfPreview && pdfDataUrl" :src="pdfDataUrl" class="pdf-viewer"></iframe>
|
||||
<pre v-else-if="previewContent" class="code-content">{{ previewContent }}</pre>
|
||||
<div v-else-if="!previewLoading && !isPdfPreview" class="preview-empty">
|
||||
<el-icon size="32"><Document /></el-icon>
|
||||
<span>暂无内容</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
|
||||
<DeleteDialog
|
||||
v-model:visible="deleteDialogVisible"
|
||||
title="删除文件"
|
||||
:item-name="pendingDeleteFile?.filename || ''"
|
||||
detail-text="该操作会移除原始文件以及关联的处理结果,请确认当前项目内不再需要它。"
|
||||
warning-text="删除后不可恢复,文件相关的分割结果和后续数据将一并失效。"
|
||||
confirm-text="确认删除文件"
|
||||
:loading="deletingFile"
|
||||
@confirm="confirmDeleteFile"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="../page-logic/ProjectFilePage.ts"></script>
|
||||
<style scoped src="../styles/pages/project-file.css"></style>
|
||||
@@ -44,7 +44,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { projectApi } from '@/api'
|
||||
import { projectApi } from '@/core/api'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const route = useRoute()
|
||||
244
frontend/src/pages/ProjectQuestionPage.vue
Normal file
244
frontend/src/pages/ProjectQuestionPage.vue
Normal file
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div class="question-manage">
|
||||
<!-- Header -->
|
||||
<div class="page-header">
|
||||
<div class="header-left">
|
||||
<h2 class="page-title">问答管理</h2>
|
||||
<p class="page-subtitle">管理和生成问答数据</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<el-button type="primary" @click="showGenerateDialog = true" class="generate-btn">
|
||||
<el-icon><Plus /></el-icon>
|
||||
<span>生成问题</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats Cards -->
|
||||
<div class="stats-grid">
|
||||
<div
|
||||
class="stat-card stat-total"
|
||||
:class="{ active: filterStatus === '' }"
|
||||
@click="filterStatus = ''"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><ChatDotSquare /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ questions.length }}</span>
|
||||
<span class="stat-label">总问题数</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-completed"
|
||||
:class="{ active: filterStatus === 'generated' }"
|
||||
@click="filterStatus = filterStatus === 'generated' ? '' : 'generated'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><MagicStick /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ generatedCount }}</span>
|
||||
<span class="stat-label">AI 生成</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-processing"
|
||||
:class="{ active: filterStatus === 'manual' }"
|
||||
@click="filterStatus = filterStatus === 'manual' ? '' : 'manual'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><EditPen /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ manualCount }}</span>
|
||||
<span class="stat-label">手动添加</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-failed"
|
||||
:class="{ active: filterStatus === 'failed' }"
|
||||
@click="filterStatus = filterStatus === 'failed' ? '' : 'failed'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><CircleCloseFilled /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ failedCount }}</span>
|
||||
<span class="stat-label">失败</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Question Container -->
|
||||
<div class="question-container" v-loading="loading && isInitialLoad">
|
||||
<!-- Empty State -->
|
||||
<div v-if="!loading && !isInitialLoad && filteredQuestions.length === 0" class="empty-state">
|
||||
<div class="empty-illustration">
|
||||
<div class="orbit orbit-1"></div>
|
||||
<div class="orbit orbit-2"></div>
|
||||
<div class="orbit orbit-3"></div>
|
||||
<div class="empty-core">
|
||||
<el-icon size="40"><ChatDotSquare /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="empty-title">暂无问答数据</h3>
|
||||
<p class="empty-desc">生成您的第一个问答数据集</p>
|
||||
<el-button type="primary" @click="showGenerateDialog = true" class="empty-btn">生成问题</el-button>
|
||||
</div>
|
||||
|
||||
<!-- Question Table -->
|
||||
<div v-else class="question-table-wrapper">
|
||||
<!-- Table Header -->
|
||||
<div class="table-header">
|
||||
<div class="table-select">
|
||||
<el-checkbox
|
||||
:model-value="isAllSelected"
|
||||
@change="toggleSelectAll"
|
||||
class="select-all"
|
||||
>
|
||||
<span v-if="selectedCount > 0" class="selected-text">已选择 {{ selectedCount }} 项</span>
|
||||
<span v-else>全选</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
<div class="table-actions" v-if="selectedCount > 0">
|
||||
<el-button type="danger" size="small" plain @click="clearSelection" class="batch-clear-btn">
|
||||
<el-icon><Close /></el-icon>
|
||||
<span>清除选择</span>
|
||||
</el-button>
|
||||
<el-button type="danger" size="small" plain @click="batchDelete" class="batch-delete-btn">
|
||||
<el-icon><Delete /></el-icon>
|
||||
<span>批量删除</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table Body -->
|
||||
<div class="question-table">
|
||||
<div
|
||||
v-for="(question, index) in filteredQuestions"
|
||||
:key="question.id"
|
||||
class="question-row"
|
||||
:class="{
|
||||
'is-selected': isSelected(question.id),
|
||||
'row-animated': isInitialLoad
|
||||
}"
|
||||
:style="{ '--delay': index * 0.04 + 's' }"
|
||||
@click="toggleSelect(question.id)"
|
||||
>
|
||||
<!-- Select Checkbox -->
|
||||
<div class="col-select" @click.stop>
|
||||
<el-checkbox
|
||||
:model-value="isSelected(question.id)"
|
||||
@change="toggleSelect(question.id)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Question Content -->
|
||||
<div class="col-content">
|
||||
<div class="question-text">{{ question.content }}</div>
|
||||
<div class="answer-text" v-if="question.answer">答: {{ question.answer }}</div>
|
||||
</div>
|
||||
|
||||
<!-- Type -->
|
||||
<div class="col-type">
|
||||
<el-tag size="small" :style="{ '--tag-color': getTypeColor(question.question_type) }" effect="dark">
|
||||
{{ getTypeName(question.question_type) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
|
||||
<!-- Source -->
|
||||
<div class="col-source">
|
||||
<span class="source-badge" :class="'source-' + question.source">{{ getSourceName(question.source) }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="col-actions" @click.stop>
|
||||
<el-popconfirm title="确定删除此问题?" @confirm="handleDelete(question)">
|
||||
<template #reference>
|
||||
<el-button text size="small" class="action-btn delete">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="showGenerateDialog" title="生成问题" width="640px" class="generate-dialog">
|
||||
<el-form :model="generateConfig" label-position="top">
|
||||
<el-form-item label="生成模型">
|
||||
<el-select
|
||||
v-model="generateConfig.model_id"
|
||||
placeholder="选择 chat / vlm 模型"
|
||||
style="width: 100%"
|
||||
size="large"
|
||||
>
|
||||
<el-option
|
||||
v-for="model in generateModels"
|
||||
:key="model.id"
|
||||
:label="`${model.model_name} · ${getProviderLabel(model.provider)}`"
|
||||
:value="model.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="文本块">
|
||||
<el-select
|
||||
v-model="generateConfig.chunk_ids"
|
||||
multiple
|
||||
placeholder="选择文本块"
|
||||
style="width: 100%"
|
||||
size="large"
|
||||
>
|
||||
<el-option
|
||||
v-for="chunk in chunks"
|
||||
:key="chunk.id"
|
||||
:label="chunk.name || chunk.content.slice(0, 50) + '...'"
|
||||
:value="chunk.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div class="form-row">
|
||||
<el-form-item label="每个块生成数量">
|
||||
<el-input-number v-model="generateConfig.count" :min="1" :max="8" size="large" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="生成策略">
|
||||
<div style="display: flex; gap: 16px; flex-wrap: wrap;">
|
||||
<el-checkbox v-model="generateConfig.dirty_data_filter">脏数据过滤</el-checkbox>
|
||||
<el-checkbox v-model="generateConfig.thinking_mode">思考模式</el-checkbox>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="预设提示语">
|
||||
<el-input
|
||||
v-model="generateConfig.preset_prompt"
|
||||
type="textarea"
|
||||
:rows="8"
|
||||
resize="none"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="showGenerateDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleGenerate" :loading="generating">开始生成</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="../page-logic/ProjectQuestionPage.ts"></script>
|
||||
<style scoped src="../styles/pages/project-question.css"></style>
|
||||
@@ -95,7 +95,7 @@
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { projectApi } from '@/api'
|
||||
import { projectApi } from '@/core/api'
|
||||
|
||||
const route = useRoute()
|
||||
const projectId = computed(() => route.params.id)
|
||||
830
frontend/src/pages/ProjectTextSplitPage.vue
Normal file
830
frontend/src/pages/ProjectTextSplitPage.vue
Normal file
@@ -0,0 +1,830 @@
|
||||
<template>
|
||||
<div class="text-split">
|
||||
<!-- Header -->
|
||||
<div class="page-header">
|
||||
<div class="header-left">
|
||||
<h2 class="page-title">分割生成</h2>
|
||||
<p class="page-subtitle">选择文件进行智能分割</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<el-button
|
||||
@click="openSplitDialog"
|
||||
:disabled="selectedFiles.length === 0"
|
||||
class="split-btn"
|
||||
>
|
||||
<el-icon><ChatDotSquare /></el-icon>
|
||||
<span>批量分割</span>
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="openGenerateDialog"
|
||||
:disabled="completedFiles === 0"
|
||||
class="generate-btn"
|
||||
>
|
||||
<el-icon><VideoPlay /></el-icon>
|
||||
<span>批量生成</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats Cards -->
|
||||
<div class="stats-grid">
|
||||
<div
|
||||
class="stat-card stat-total"
|
||||
:class="{ active: filterStatus === '' }"
|
||||
@click="filterStatus = ''"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><Document /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ files.length }}</span>
|
||||
<span class="stat-label">总文件</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-completed"
|
||||
:class="{ active: filterStatus === 'completed' }"
|
||||
@click="filterStatus = filterStatus === 'completed' ? '' : 'completed'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><CircleCheckFilled /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ completedFiles }}</span>
|
||||
<span class="stat-label">已分割</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-processing"
|
||||
:class="{ active: filterStatus === 'processing' }"
|
||||
@click="filterStatus = filterStatus === 'processing' ? '' : 'processing'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><Loading /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ processingCount }}</span>
|
||||
<span class="stat-label">分割中</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-chunks"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><List /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ totalChunks }}</span>
|
||||
<span class="stat-label">总文本块</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- File List / Split View -->
|
||||
<div class="content-area">
|
||||
<!-- Empty State -->
|
||||
<div v-if="!loading && !isInitialLoad && filteredFiles.length === 0" class="empty-state">
|
||||
<div class="empty-illustration">
|
||||
<div class="orbit orbit-1"></div>
|
||||
<div class="orbit orbit-2"></div>
|
||||
<div class="orbit orbit-3"></div>
|
||||
<div class="empty-core">
|
||||
<el-icon size="40"><FolderOpened /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="empty-title">暂无可分割文件</h3>
|
||||
<p class="empty-desc">请先在文件管理中上传文档</p>
|
||||
</div>
|
||||
|
||||
<!-- File Table -->
|
||||
<div v-else class="files-table-wrapper">
|
||||
<div class="table-header">
|
||||
<div class="table-select">
|
||||
<el-checkbox
|
||||
:model-value="isAllSelected"
|
||||
@change="toggleSelectAll"
|
||||
class="select-all"
|
||||
>
|
||||
<span v-if="selectedCount > 0" class="selected-text">已选择 {{ selectedCount }} 项</span>
|
||||
<span v-else>全选</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
<div class="table-actions" v-if="selectedCount > 0">
|
||||
<el-button type="danger" size="small" plain @click="clearSelection" class="batch-clear-btn">
|
||||
<el-icon><Close /></el-icon>
|
||||
<span>清除选择</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="files-list">
|
||||
<div
|
||||
v-for="(file, index) in filteredFiles"
|
||||
:key="file.id"
|
||||
class="file-row"
|
||||
:class="{
|
||||
'is-selected': isSelected(file.id),
|
||||
'is-processing': file.status === 'processing'
|
||||
}"
|
||||
:style="{ '--delay': index * 0.04 + 's' }"
|
||||
@click="toggleSelect(file.id)"
|
||||
>
|
||||
<div class="col-select">
|
||||
<el-checkbox
|
||||
:model-value="isSelected(file.id)"
|
||||
@click.stop
|
||||
@change="toggleSelect(file.id)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-icon">
|
||||
<div class="file-type-icon" style="background: #8b5cf6;">
|
||||
<el-icon size="18" color="white">
|
||||
<Document />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-name">
|
||||
<span class="file-name">{{ file.filename }}.md</span>
|
||||
<span class="file-meta">{{ formatSize(file.size) }}</span>
|
||||
</div>
|
||||
<div class="col-chunks">
|
||||
<span v-if="fileChunks[file.id]" class="chunk-count">
|
||||
{{ fileChunks[file.id] }} 块
|
||||
</span>
|
||||
<span v-else class="chunk-count empty">-</span>
|
||||
</div>
|
||||
<div class="col-status">
|
||||
<div v-if="file.status === 'processing'" class="status-badge processing">
|
||||
<el-icon class="spin" size="12"><Loading /></el-icon>
|
||||
<span>分割中</span>
|
||||
</div>
|
||||
<div v-else-if="fileChunks[file.id]" class="status-badge success">
|
||||
<el-icon size="12"><CircleCheckFilled /></el-icon>
|
||||
<span>已完成</span>
|
||||
</div>
|
||||
<div v-else class="status-badge pending">
|
||||
<el-icon size="12"><Clock /></el-icon>
|
||||
<span>待分割</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-operations" v-if="fileChunks[file.id]">
|
||||
<el-tooltip content="预览修改" placement="top">
|
||||
<el-button text size="small" class="op-btn" @click.stop="openChunkPreview(file)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除该文件的所有块" placement="top">
|
||||
<el-button
|
||||
text
|
||||
size="small"
|
||||
class="op-btn delete"
|
||||
:loading="deletingFileChunksId === file.id"
|
||||
@click.stop="openDeleteFileChunksDialog(file)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Batch Split Dialog -->
|
||||
<Teleport to="body">
|
||||
<Transition name="dialog-fade">
|
||||
<div v-if="splitDialogVisible" class="split-dialog-overlay" @click.self="splitDialogVisible = false">
|
||||
<div class="split-dialog">
|
||||
<!-- Header -->
|
||||
<div class="dialog-header">
|
||||
<div class="header-icon">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 2L2 7l10 5 10-5-10-5z"/>
|
||||
<path d="M2 17l10 5 10-5"/>
|
||||
<path d="M2 12l10 5 10-5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="header-text">
|
||||
<h3>批量分割配置</h3>
|
||||
<span class="header-sub">{{ selectedFiles.length }} 个文件待处理</span>
|
||||
</div>
|
||||
<button class="close-btn" @click="splitDialogVisible = false">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M18 6L6 18M6 6l12 12"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Dialog Body -->
|
||||
<div class="dialog-body">
|
||||
<!-- Split Method Selector -->
|
||||
<div class="method-selector">
|
||||
<div class="method-label">
|
||||
<span class="label-icon">◆</span>
|
||||
<span>分割算法</span>
|
||||
</div>
|
||||
<div class="method-grid">
|
||||
<button
|
||||
v-for="m in methods"
|
||||
:key="m.value"
|
||||
class="method-btn"
|
||||
:class="{ active: splitConfig.method === m.value }"
|
||||
@click="splitConfig.method = m.value"
|
||||
>
|
||||
<span class="method-name">{{ m.label }}</span>
|
||||
<span class="method-tag">{{ m.tag }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Parameters Panel -->
|
||||
<div class="params-panel">
|
||||
<!-- Panel Grid Background -->
|
||||
<div class="panel-grid"></div>
|
||||
|
||||
<!-- Common Parameters -->
|
||||
<div class="param-section" v-if="splitConfig.method !== 'paragraph'">
|
||||
<div class="section-header">
|
||||
<span class="section-num">01</span>
|
||||
<span class="section-title">块大小控制</span>
|
||||
</div>
|
||||
<div class="param-row">
|
||||
<div class="param-info">
|
||||
<span class="param-name">chunk_size</span>
|
||||
<span class="param-desc">每个文本块的字符数</span>
|
||||
</div>
|
||||
<div class="param-control">
|
||||
<input
|
||||
type="range"
|
||||
v-model.number="splitConfig.chunk_size"
|
||||
:min="100"
|
||||
:max="2000"
|
||||
:step="100"
|
||||
class="cyber-slider"
|
||||
/>
|
||||
<div class="param-value">
|
||||
<span class="value-num">{{ splitConfig.chunk_size }}</span>
|
||||
<span class="value-unit">chars</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Visual Preview -->
|
||||
<div class="chunk-preview">
|
||||
<div class="preview-label">预览</div>
|
||||
<div class="preview-bars">
|
||||
<div
|
||||
v-for="i in 5"
|
||||
:key="i"
|
||||
class="preview-bar"
|
||||
:style="{ width: (splitConfig.chunk_size / 20) + 'px' }"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="param-section" v-if="splitConfig.method !== 'sentence'">
|
||||
<div class="section-header">
|
||||
<span class="section-num">02</span>
|
||||
<span class="section-title">重叠控制</span>
|
||||
</div>
|
||||
<div class="param-row">
|
||||
<div class="param-info">
|
||||
<span class="param-name">overlap</span>
|
||||
<span class="param-desc">相邻块之间的重叠字符数</span>
|
||||
</div>
|
||||
<div class="param-control">
|
||||
<input
|
||||
type="range"
|
||||
v-model.number="splitConfig.overlap"
|
||||
:min="0"
|
||||
:max="500"
|
||||
:step="50"
|
||||
class="cyber-slider"
|
||||
/>
|
||||
<div class="param-value">
|
||||
<span class="value-num">{{ splitConfig.overlap }}</span>
|
||||
<span class="value-unit">chars</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Overlap Visual -->
|
||||
<div class="overlap-preview">
|
||||
<div class="overlap-block" :style="{ width: (splitConfig.chunk_size / 4) + 'px' }"></div>
|
||||
<div class="overlap-zone" :style="{ width: (splitConfig.overlap / 4) + 'px' }"></div>
|
||||
<div class="overlap-block" :style="{ width: (splitConfig.chunk_size / 4) + 'px' }"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Custom Separator -->
|
||||
<div class="param-section" v-if="splitConfig.method === 'custom'">
|
||||
<div class="section-header">
|
||||
<span class="section-num">03</span>
|
||||
<span class="section-title">自定义分隔符</span>
|
||||
</div>
|
||||
<div class="param-row">
|
||||
<div class="param-info">
|
||||
<span class="param-name">separator</span>
|
||||
<span class="param-desc">用于分割文本的字符序列</span>
|
||||
</div>
|
||||
<div class="param-control full">
|
||||
<input
|
||||
type="text"
|
||||
v-model="splitConfig.separator"
|
||||
placeholder="\n\n"
|
||||
class="cyber-input"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="splitConfig.method === 'semantic'">
|
||||
<div class="param-section">
|
||||
<div class="section-header highlight">
|
||||
<span class="section-num">04</span>
|
||||
<span class="section-title">句段优先说明</span>
|
||||
<span class="section-badge">RULE</span>
|
||||
</div>
|
||||
<div class="param-row full">
|
||||
<div class="param-info">
|
||||
<span class="param-name">规则型切分</span>
|
||||
<span class="param-desc">按段落和句子边界优先切分,不调用 embedding API,更接近“句段优先的递归切分”。</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="splitConfig.method === 'semantic_embedding'">
|
||||
<div class="param-section">
|
||||
<div class="section-header highlight">
|
||||
<span class="section-num">04</span>
|
||||
<span class="section-title">Embedding 模型</span>
|
||||
<span class="section-badge">API</span>
|
||||
</div>
|
||||
<div class="api-grid">
|
||||
<div class="param-row full">
|
||||
<div class="param-info">
|
||||
<span class="param-name">embedding_model</span>
|
||||
<span class="param-desc">直接使用模型管理中已配置的 embedding 模型</span>
|
||||
</div>
|
||||
<div class="param-control full">
|
||||
<select v-model="splitConfig.embedding_model_id" class="cyber-select" :disabled="embeddingModels.length === 0">
|
||||
<option value="" disabled>
|
||||
{{ embeddingModels.length ? '选择 embedding 模型' : '暂无可用 embedding 模型' }}
|
||||
</option>
|
||||
<option
|
||||
v-for="model in embeddingModels"
|
||||
:key="model.id"
|
||||
:value="model.id"
|
||||
>
|
||||
{{ model.model_name }} · {{ getProviderLabel(model.provider) }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="param-row full" v-if="embeddingModels.length === 0">
|
||||
<div class="embedding-empty-hint">
|
||||
<span>还没有可用的 embedding 模型。</span>
|
||||
<button type="button" class="text-link-btn" @click="goToModelSettings">
|
||||
去模型配置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="param-section">
|
||||
<div class="section-header highlight">
|
||||
<span class="section-num">05</span>
|
||||
<span class="section-title">语义边界参数</span>
|
||||
<span class="section-badge">AI</span>
|
||||
</div>
|
||||
<div class="param-row">
|
||||
<div class="param-info">
|
||||
<span class="param-name">similarity_threshold</span>
|
||||
<span class="param-desc">越高越保守,越低越容易切出新块</span>
|
||||
</div>
|
||||
<div class="param-control">
|
||||
<input
|
||||
type="range"
|
||||
v-model.number="splitConfig.similarity_threshold"
|
||||
:min="0.1"
|
||||
:max="0.9"
|
||||
:step="0.05"
|
||||
class="cyber-slider accent"
|
||||
/>
|
||||
<div class="param-value accent">
|
||||
<span class="value-num">{{ splitConfig.similarity_threshold.toFixed(2) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="param-row">
|
||||
<div class="param-info">
|
||||
<span class="param-name">min_chunk_size</span>
|
||||
<span class="param-desc">最小块大小,避免语义过碎</span>
|
||||
</div>
|
||||
<div class="param-control">
|
||||
<input
|
||||
type="range"
|
||||
v-model.number="splitConfig.min_chunk_size"
|
||||
:min="50"
|
||||
:max="500"
|
||||
:step="10"
|
||||
class="cyber-slider accent"
|
||||
/>
|
||||
<div class="param-value accent">
|
||||
<span class="value-num">{{ splitConfig.min_chunk_size }}</span>
|
||||
<span class="value-unit">chars</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<button class="btn-cancel" @click="splitDialogVisible = false">
|
||||
<span>取消</span>
|
||||
</button>
|
||||
<button class="btn-confirm" @click="handleBatchSplit" :class="{ loading: splitting }">
|
||||
<span v-if="!splitting" class="btn-text">
|
||||
<svg class="btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<polygon points="5 3 19 12 5 21 5 3"/>
|
||||
</svg>
|
||||
开始生成
|
||||
</span>
|
||||
<span v-else class="btn-loading">
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
|
||||
<Teleport to="body">
|
||||
<Transition name="dialog-fade">
|
||||
<div v-if="generateDialogVisible" class="split-dialog-overlay" @click.self="generateDialogVisible = false">
|
||||
<div class="split-dialog generate-dialog-shell">
|
||||
<div class="dialog-header">
|
||||
<div class="header-icon">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 2l2.4 5.8L20 10l-4 4 1 6-5-3-5 3 1-6-4-4 5.6-2.2L12 2z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="header-text">
|
||||
<h3>批量生成问答</h3>
|
||||
<span class="header-sub">面向当前项目全部已分割文本块</span>
|
||||
</div>
|
||||
<button class="close-btn" @click="generateDialogVisible = false">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M18 6L6 18M6 6l12 12"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body">
|
||||
<div class="params-panel">
|
||||
<div class="panel-grid"></div>
|
||||
|
||||
<div class="param-section">
|
||||
<div class="section-header">
|
||||
<span class="section-num">01</span>
|
||||
<span class="section-title">大语言模型</span>
|
||||
</div>
|
||||
<div class="param-row full">
|
||||
<div class="param-info">
|
||||
<span class="param-name">model</span>
|
||||
<span class="param-desc">选择用于生成问答对的 chat / vlm 模型</span>
|
||||
</div>
|
||||
<div class="param-control full">
|
||||
<el-select
|
||||
v-model="generateConfig.model_id"
|
||||
class="cyber-select generate-model-select"
|
||||
:disabled="generateModels.length === 0"
|
||||
:teleported="false"
|
||||
placement="bottom-start"
|
||||
popper-class="generate-model-dropdown"
|
||||
placeholder="选择生成模型"
|
||||
>
|
||||
<el-option
|
||||
v-for="model in generateModels"
|
||||
:key="model.id"
|
||||
:label="`${model.model_name} · ${getProviderLabel(model.provider)}`"
|
||||
:value="model.id"
|
||||
>
|
||||
<div class="generate-option">
|
||||
<div class="generate-option__title">{{ model.model_name }}</div>
|
||||
<div class="generate-option__meta">{{ getProviderLabel(model.provider) }}</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="param-row full" v-if="generateModels.length === 0">
|
||||
<div class="embedding-empty-hint">
|
||||
<span>还没有可用的 chat / vlm 模型。</span>
|
||||
<button type="button" class="text-link-btn" @click="goToModelSettings">
|
||||
去模型配置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="param-section generate-strategy-section">
|
||||
<div class="section-header">
|
||||
<span class="section-num">02</span>
|
||||
<span class="section-title">生成策略</span>
|
||||
</div>
|
||||
<div class="generate-strategy-grid">
|
||||
<button
|
||||
type="button"
|
||||
class="strategy-card"
|
||||
:class="{ active: generateConfig.dirty_data_filter }"
|
||||
@click="generateConfig.dirty_data_filter = !generateConfig.dirty_data_filter"
|
||||
>
|
||||
<div class="strategy-card__head">
|
||||
<span class="strategy-card__title">脏数据过滤</span>
|
||||
<span class="strategy-card__switch" :class="{ active: generateConfig.dirty_data_filter }">
|
||||
<span class="strategy-card__switch-handle"></span>
|
||||
</span>
|
||||
</div>
|
||||
<p class="strategy-card__desc">过滤目录、极短内容和明显噪声,减少无效调用。</p>
|
||||
<span class="strategy-card__state">{{ generateConfig.dirty_data_filter ? '已开启' : '已关闭' }}</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="strategy-card"
|
||||
:class="{ active: generateConfig.thinking_mode }"
|
||||
@click="generateConfig.thinking_mode = !generateConfig.thinking_mode"
|
||||
>
|
||||
<div class="strategy-card__head">
|
||||
<span class="strategy-card__title">思考模式</span>
|
||||
<span class="strategy-card__switch" :class="{ active: generateConfig.thinking_mode }">
|
||||
<span class="strategy-card__switch-handle"></span>
|
||||
</span>
|
||||
</div>
|
||||
<p class="strategy-card__desc">生成前强化内容分析,提升问题质量与覆盖度。</p>
|
||||
<span class="strategy-card__state">{{ generateConfig.thinking_mode ? '已开启' : '已关闭' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="param-row">
|
||||
<div class="param-info">
|
||||
<span class="param-name">single_chunk_count</span>
|
||||
<span class="param-desc">每个 chunk 生成多少组问答</span>
|
||||
</div>
|
||||
<div class="param-control">
|
||||
<input
|
||||
type="range"
|
||||
v-model.number="generateConfig.count"
|
||||
:min="1"
|
||||
:max="8"
|
||||
:step="1"
|
||||
class="cyber-slider accent"
|
||||
/>
|
||||
<div class="param-value accent">
|
||||
<span class="value-num">{{ generateConfig.count }}</span>
|
||||
<span class="value-unit">pairs</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="param-section generate-prompt-section">
|
||||
<div class="section-header">
|
||||
<span class="section-num">03</span>
|
||||
<span class="section-title">预设提示语</span>
|
||||
</div>
|
||||
<div class="generate-prompt-box">
|
||||
<textarea
|
||||
v-model="generateConfig.preset_prompt"
|
||||
class="cyber-textarea generate-prompt-textarea"
|
||||
rows="9"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<button class="btn-cancel" @click="generateDialogVisible = false">
|
||||
<span>取消</span>
|
||||
</button>
|
||||
<button class="btn-confirm" @click="handleBatchGenerate" :class="{ loading: generatingQuestions }">
|
||||
<span v-if="!generatingQuestions" class="btn-text">
|
||||
<svg class="btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<polygon points="5 3 19 12 5 21 5 3"/>
|
||||
</svg>
|
||||
开始生成
|
||||
</span>
|
||||
<span v-else class="btn-loading">
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
|
||||
<Teleport to="body">
|
||||
<Transition name="dialog-fade">
|
||||
<div v-if="chunkPreviewVisible" class="chunk-preview-overlay" @click.self="chunkPreviewVisible = false">
|
||||
<div class="chunk-preview-dialog">
|
||||
<div class="dialog-header">
|
||||
<div class="header-icon">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 2L2 7l10 5 10-5-10-5z"/>
|
||||
<path d="M2 17l10 5 10-5"/>
|
||||
<path d="M2 12l10 5 10-5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="header-text">
|
||||
<h3>预览修改</h3>
|
||||
<span class="header-sub">{{ previewFile?.filename }} - {{ previewChunks.length }} 个块</span>
|
||||
</div>
|
||||
<button class="close-btn" @click="chunkPreviewVisible = false">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M18 6L6 18M6 6l12 12"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="chunk-preview-toolbar">
|
||||
<label class="preview-search">
|
||||
<span class="preview-search-label">检索</span>
|
||||
<input
|
||||
v-model.trim="previewSearch"
|
||||
type="text"
|
||||
class="cyber-input"
|
||||
placeholder="搜索块内容、块号"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div class="preview-filter-group">
|
||||
<button
|
||||
class="preview-filter-btn"
|
||||
:class="{ active: previewFilter === 'all' }"
|
||||
@click="previewFilter = 'all'"
|
||||
>
|
||||
全部
|
||||
</button>
|
||||
<button
|
||||
class="preview-filter-btn"
|
||||
:class="{ active: previewFilter === 'modified' }"
|
||||
@click="previewFilter = 'modified'"
|
||||
>
|
||||
仅已修改
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<label class="preview-jump">
|
||||
<span class="preview-search-label">跳转</span>
|
||||
<input
|
||||
v-model.trim="previewJumpInput"
|
||||
type="text"
|
||||
inputmode="numeric"
|
||||
class="cyber-input"
|
||||
placeholder="块号"
|
||||
@keydown.enter.prevent="jumpToChunk"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div class="preview-stats">
|
||||
<span>{{ filteredPreviewChunks.length }} / {{ previewChunks.length }} 块</span>
|
||||
<span>{{ modifiedPreviewCount }} 已修改</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body chunk-workspace">
|
||||
<div v-if="previewLoading" class="loading-state">
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
</div>
|
||||
<div v-else-if="previewChunks.length" class="chunk-workspace-grid">
|
||||
<aside class="chunk-nav-panel">
|
||||
<div class="chunk-nav-list">
|
||||
<button
|
||||
v-for="chunk in filteredPreviewChunks"
|
||||
:key="chunk.id"
|
||||
class="chunk-nav-item"
|
||||
:class="{
|
||||
active: chunk.id === selectedPreviewChunkId,
|
||||
modified: isChunkModified(chunk)
|
||||
}"
|
||||
@click="selectPreviewChunk(chunk.id)"
|
||||
>
|
||||
<div class="chunk-nav-meta">
|
||||
<span class="chunk-nav-index">块 {{ chunk.displayIndex }}</span>
|
||||
<span class="chunk-nav-words">{{ chunk.word_count || 0 }} 字</span>
|
||||
</div>
|
||||
<p class="chunk-nav-snippet">{{ getChunkSnippet(chunk) }}</p>
|
||||
<div class="chunk-nav-footer">
|
||||
<span class="chunk-nav-status">{{ isChunkModified(chunk) ? '已修改' : '原始' }}</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<section v-if="activePreviewChunk" class="chunk-editor-panel">
|
||||
<div class="chunk-item">
|
||||
<div class="chunk-header">
|
||||
<div class="chunk-header-main">
|
||||
<span class="chunk-index">块 {{ activePreviewChunkIndex }} / {{ previewChunks.length }}</span>
|
||||
<span class="chunk-state-pill" :class="{ modified: isChunkModified(activePreviewChunk) }">
|
||||
{{ isChunkModified(activePreviewChunk) ? '已修改未保存' : '内容未变更' }}
|
||||
</span>
|
||||
</div>
|
||||
<span class="chunk-words">{{ activePreviewChunk.word_count || 0 }} 字</span>
|
||||
</div>
|
||||
<div class="chunk-form">
|
||||
<div class="form-group">
|
||||
<label>内容</label>
|
||||
<textarea
|
||||
v-model="activePreviewChunk.editingContent"
|
||||
class="cyber-textarea preview-editor"
|
||||
rows="20"
|
||||
></textarea>
|
||||
</div>
|
||||
<div class="chunk-actions">
|
||||
<button
|
||||
class="btn-secondary"
|
||||
:disabled="!isChunkModified(activePreviewChunk)"
|
||||
@click="resetChunk(activePreviewChunk)"
|
||||
>
|
||||
还原
|
||||
</button>
|
||||
<button
|
||||
class="btn-save"
|
||||
:class="{ loading: savingChunks }"
|
||||
:disabled="!isChunkModified(activePreviewChunk)"
|
||||
@click="saveChunk(activePreviewChunk)"
|
||||
>
|
||||
<span v-if="!savingChunks">保存</span>
|
||||
<span v-else class="btn-loading">
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="btn-delete"
|
||||
:class="{ loading: deletingChunkId === activePreviewChunk.id }"
|
||||
:disabled="deletingChunkId === activePreviewChunk.id"
|
||||
@click="openDeleteChunkDialog(activePreviewChunk)"
|
||||
>
|
||||
<span v-if="deletingChunkId !== activePreviewChunk.id">删除</span>
|
||||
<span v-else class="btn-loading">
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
<span class="loading-dot"></span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div v-else class="chunk-empty-state">
|
||||
<h4>没有匹配的分片</h4>
|
||||
<p>试试清空搜索词,或切回“全部”查看所有分片。</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
|
||||
<DeleteDialog
|
||||
v-model:visible="deleteDialogVisible"
|
||||
:title="deleteDialogTitle"
|
||||
:item-name="deleteDialogItemName"
|
||||
:detail-text="deleteDialogDetail"
|
||||
:warning-text="deleteDialogWarning"
|
||||
:confirm-text="deleteDialogConfirmText"
|
||||
:loading="deleteDialogLoading"
|
||||
@confirm="confirmDeleteAction"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="../page-logic/ProjectTextSplitPage.ts"></script>
|
||||
<style scoped src="../styles/pages/project-text-split.css"></style>
|
||||
@@ -2,8 +2,8 @@
|
||||
* 模型相关业务逻辑
|
||||
*/
|
||||
import { ref } from 'vue'
|
||||
import { modelApi } from '@/api'
|
||||
import type { Model } from '@/types'
|
||||
import { modelApi } from '@/core/api'
|
||||
import type { Model } from '@/shared/types'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
export function useModels() {
|
||||
@@ -2,8 +2,8 @@
|
||||
* 项目相关业务逻辑
|
||||
*/
|
||||
import { ref } from 'vue'
|
||||
import { projectApi } from '@/api'
|
||||
import type { Project, ProjectCreate } from '@/types'
|
||||
import { projectApi } from '@/core/api'
|
||||
import type { Project, ProjectCreate } from '@/shared/types'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
export function useProjects() {
|
||||
@@ -5,6 +5,7 @@
|
||||
export interface Model {
|
||||
id: string
|
||||
provider: ModelProvider
|
||||
model_type: ModelType
|
||||
model_name: string
|
||||
api_key?: string
|
||||
api_base?: string
|
||||
@@ -17,6 +18,7 @@ export interface Model {
|
||||
export interface ModelConfig {
|
||||
id: string
|
||||
provider: ModelProvider
|
||||
model_type: ModelType
|
||||
model_name: string
|
||||
api_key?: string
|
||||
api_base?: string
|
||||
@@ -26,10 +28,12 @@ export interface ModelConfig {
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export type ModelProvider = 'minimax' | 'glm' | 'openai'
|
||||
export type ModelProvider = 'minimax' | 'glm' | 'openai' | 'ali'
|
||||
export type ModelType = 'chat' | 'vlm' | 'embedding' | 'rerank'
|
||||
|
||||
export interface ModelCreate {
|
||||
provider: ModelProvider
|
||||
model_type: ModelType
|
||||
model_name: string
|
||||
api_key: string
|
||||
api_base?: string
|
||||
750
frontend/src/styles/pages/model-settings.css
Normal file
750
frontend/src/styles/pages/model-settings.css
Normal file
@@ -0,0 +1,750 @@
|
||||
/* 使用全局 CSS 变量 */
|
||||
.model-settings {
|
||||
min-height: 100vh;
|
||||
background: var(--bg-primary);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 背景效果 */
|
||||
.bg-effects {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.glow-orb {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(120px);
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.glow-1 {
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
background: var(--accent-primary);
|
||||
top: -200px;
|
||||
right: -100px;
|
||||
}
|
||||
|
||||
.glow-2 {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
background: var(--accent-secondary);
|
||||
bottom: -100px;
|
||||
left: -100px;
|
||||
}
|
||||
|
||||
/* 页面头部 */
|
||||
.page-header {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20px 32px;
|
||||
background: var(--bg-secondary);
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.title-icon {
|
||||
color: var(--accent-primary);
|
||||
}
|
||||
|
||||
.page-subtitle {
|
||||
font-size: 13px;
|
||||
color: var(--text-tertiary);
|
||||
margin: 4px 0 0;
|
||||
}
|
||||
|
||||
.header-left, .header-right {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.back-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--text-secondary);
|
||||
padding: 8px 16px;
|
||||
border-radius: var(--radius-md);
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
.back-btn:hover {
|
||||
background: var(--bg-hover) !important;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: var(--accent-primary);
|
||||
border: none;
|
||||
color: #030407;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.add-btn:hover {
|
||||
background: var(--accent-primary-hover);
|
||||
}
|
||||
|
||||
/* 主内容 */
|
||||
.page-main {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
/* 模型列表 */
|
||||
.models-section {
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-xl);
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.title-line {
|
||||
width: 4px;
|
||||
height: 18px;
|
||||
background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.count-badge {
|
||||
font-size: 12px;
|
||||
color: var(--text-tertiary);
|
||||
background: var(--bg-hover);
|
||||
padding: 6px 14px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 80px 20px;
|
||||
}
|
||||
|
||||
.empty-illustration {
|
||||
position: relative;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
margin: 0 auto 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.pulse-ring {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border: 2px solid var(--border-subtle);
|
||||
border-radius: 50%;
|
||||
animation: pulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%, 100% { transform: scale(1); opacity: 1; }
|
||||
50% { transform: scale(1.1); opacity: 0.5; }
|
||||
}
|
||||
|
||||
.empty-state h3 {
|
||||
font-size: 18px;
|
||||
color: var(--text-primary);
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.empty-state p {
|
||||
color: var(--text-tertiary);
|
||||
margin: 0 0 24px;
|
||||
}
|
||||
|
||||
/* 模型网格 */
|
||||
.models-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.model-card {
|
||||
position: relative;
|
||||
padding: 24px;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 16px;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
animation: fadeInUp 0.4s ease backwards;
|
||||
animation-delay: var(--delay);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@keyframes fadeInUp {
|
||||
from { opacity: 0; transform: translateY(20px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.model-card:hover {
|
||||
border-color: rgba(0, 212, 255, 0.4);
|
||||
transform: translateY(-6px);
|
||||
box-shadow: 0 12px 40px rgba(0, 212, 255, 0.15);
|
||||
}
|
||||
|
||||
.model-card.is-default {
|
||||
border-color: rgba(52, 211, 153, 0.4);
|
||||
}
|
||||
|
||||
.card-glow {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: 16px;
|
||||
background: radial-gradient(circle at top right, rgba(0, 212, 255, 0.15), transparent 60%);
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.model-card:hover .card-glow {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.default-badge {
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
right: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 11px;
|
||||
color: var(--success);
|
||||
background: var(--success-muted);
|
||||
padding: 4px 10px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.provider-logo {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
margin-bottom: 16px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||
background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
|
||||
}
|
||||
|
||||
.model-info {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.model-name-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.model-name {
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.model-type-badge {
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 72px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.03em;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.model-type-badge.type-chat {
|
||||
color: #38bdf8;
|
||||
background: rgba(56, 189, 248, 0.12);
|
||||
border-color: rgba(56, 189, 248, 0.25);
|
||||
}
|
||||
|
||||
.model-type-badge.type-vlm {
|
||||
color: #fbbf24;
|
||||
background: rgba(251, 191, 36, 0.12);
|
||||
border-color: rgba(251, 191, 36, 0.25);
|
||||
}
|
||||
|
||||
.model-type-badge.type-embedding {
|
||||
color: #34d399;
|
||||
background: rgba(52, 211, 153, 0.12);
|
||||
border-color: rgba(52, 211, 153, 0.25);
|
||||
}
|
||||
|
||||
.model-type-badge.type-rerank {
|
||||
color: #c084fc;
|
||||
background: rgba(192, 132, 252, 0.12);
|
||||
border-color: rgba(192, 132, 252, 0.25);
|
||||
}
|
||||
|
||||
.model-endpoint {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.status-badge.connected {
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.status-badge.disconnected {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.status-badge.untested {
|
||||
color: var(--warning);
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--text-muted);
|
||||
}
|
||||
|
||||
.status-dot.online,
|
||||
.status-dot.connected {
|
||||
background: var(--success);
|
||||
box-shadow: 0 0 8px var(--success);
|
||||
animation: pulse 2s infinite;
|
||||
}
|
||||
|
||||
.status-dot.disconnected {
|
||||
background: var(--danger);
|
||||
box-shadow: 0 0 8px var(--danger);
|
||||
}
|
||||
|
||||
.status-dot.untested {
|
||||
background: var(--warning);
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%, 100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
color: var(--text-tertiary);
|
||||
background: var(--bg-hover);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.action-btn:hover {
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.action-btn.delete:hover {
|
||||
color: var(--danger);
|
||||
background: var(--danger-muted);
|
||||
}
|
||||
|
||||
/* 弹窗样式 */
|
||||
:deep(.model-dialog .el-dialog) {
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.model-dialog .el-dialog__header) {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.model-dialog .el-dialog__body) {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.dialog-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 24px;
|
||||
background: linear-gradient(135deg, var(--accent-primary-muted), rgba(124, 58, 237, 0.1));
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.dialog-icon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
|
||||
border-radius: 12px;
|
||||
color: #030407;
|
||||
box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
|
||||
}
|
||||
|
||||
.dialog-title h3 {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.dialog-title p {
|
||||
font-size: 13px;
|
||||
color: var(--text-tertiary);
|
||||
margin: 4px 0 0;
|
||||
}
|
||||
|
||||
.dialog-close {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 10px;
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.dialog-close:hover {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-primary);
|
||||
border-color: var(--border-default);
|
||||
}
|
||||
|
||||
.provider-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__wrapper),
|
||||
.provider-select :deep(.el-input__wrapper),
|
||||
.dialog-input :deep(.el-input__wrapper) {
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 12px;
|
||||
padding: 4px 16px;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__wrapper:hover),
|
||||
.provider-select :deep(.el-input__wrapper:hover),
|
||||
.dialog-input :deep(.el-input__wrapper:hover) {
|
||||
border-color: var(--border-default);
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__wrapper.is-focused),
|
||||
.provider-select :deep(.el-input__wrapper.is-focus),
|
||||
.dialog-input :deep(.el-input__wrapper.is-focus) {
|
||||
border-color: var(--accent-primary);
|
||||
box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15) !important;
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__placeholder),
|
||||
.provider-select :deep(.el-input__inner),
|
||||
.dialog-input :deep(.el-input__inner) {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__placeholder.is-transparent),
|
||||
.provider-select :deep(.el-input__inner::placeholder),
|
||||
.dialog-input :deep(.el-input__inner::placeholder) {
|
||||
color: rgba(226, 232, 240, 0.38) !important;
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__caret) {
|
||||
color: var(--text-tertiary);
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__placeholder) {
|
||||
color: rgba(226, 232, 240, 0.32);
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__selected-item) {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__selection) {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.provider-select :deep(.el-select__selection),
|
||||
.provider-select :deep(.el-select__selected-item),
|
||||
.provider-select :deep(.el-select__selected-item span) {
|
||||
color: var(--text-primary) !important;
|
||||
}
|
||||
|
||||
:global(.provider-select-dropdown.el-popper) {
|
||||
background: transparent !important;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
:global(.provider-select-dropdown .el-select-dropdown) {
|
||||
background: var(--bg-elevated) !important;
|
||||
border: 1px solid var(--border-subtle) !important;
|
||||
border-radius: 14px;
|
||||
padding: 8px;
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
|
||||
backdrop-filter: blur(18px);
|
||||
}
|
||||
|
||||
:global(.provider-select-dropdown .el-select-dropdown__item) {
|
||||
background: transparent !important;
|
||||
color: var(--text-primary) !important;
|
||||
min-height: 64px;
|
||||
border-radius: 10px;
|
||||
padding: 10px 12px;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
:global(.provider-select-dropdown .el-select-dropdown__item.hover),
|
||||
:global(.provider-select-dropdown .el-select-dropdown__item:hover) {
|
||||
background: rgba(148, 163, 184, 0.08) !important;
|
||||
}
|
||||
|
||||
:global(.provider-select-dropdown .el-select-dropdown__item.is-selected) {
|
||||
background: var(--accent-primary-muted) !important;
|
||||
color: var(--accent-primary) !important;
|
||||
box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.18);
|
||||
}
|
||||
|
||||
:global(.provider-select-dropdown .el-popper__arrow),
|
||||
:global(.provider-select-dropdown .el-select-dropdown__loading),
|
||||
:global(.provider-select-dropdown .el-select-dropdown__empty) {
|
||||
color: var(--text-secondary) !important;
|
||||
}
|
||||
|
||||
.provider-option-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
width: 100%;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.provider-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
flex: 0 0 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 8px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
color: #030407;
|
||||
background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
|
||||
}
|
||||
|
||||
.model-type-icon {
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.provider-option-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.provider-option-name {
|
||||
color: var(--text-primary);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.provider-option-desc {
|
||||
color: rgba(226, 232, 240, 0.48);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
padding: 20px 24px;
|
||||
background: var(--bg-tertiary);
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
/* 删除弹窗 */
|
||||
:deep(.delete-dialog .el-dialog) {
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--danger-muted);
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.delete-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 32px 24px 24px;
|
||||
}
|
||||
|
||||
.delete-icon {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(248, 113, 113, 0.1));
|
||||
border: 1px solid var(--danger-muted);
|
||||
border-radius: 16px;
|
||||
color: var(--danger);
|
||||
box-shadow: 0 4px 20px rgba(248, 113, 113, 0.2);
|
||||
}
|
||||
|
||||
.delete-header h3 {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.delete-content {
|
||||
text-align: center;
|
||||
padding: 0 32px 24px;
|
||||
}
|
||||
|
||||
.delete-content p {
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.delete-content p strong {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.warning-text {
|
||||
color: var(--danger) !important;
|
||||
font-size: 13px;
|
||||
margin-top: 12px !important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.delete-footer {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
padding: 20px 24px;
|
||||
background: var(--bg-tertiary);
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
border-radius: 0 0 16px 16px;
|
||||
}
|
||||
|
||||
/* 响应式 */
|
||||
@media (max-width: 768px) {
|
||||
.page-header {
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.page-main {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.provider-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
697
frontend/src/styles/pages/project-eval.css
Normal file
697
frontend/src/styles/pages/project-eval.css
Normal file
@@ -0,0 +1,697 @@
|
||||
/* ========================
|
||||
CSS Variables
|
||||
======================== */
|
||||
.eval-manage {
|
||||
--accent-cyan: #00d4ff;
|
||||
--accent-cyan-dim: rgba(0, 212, 255, 0.15);
|
||||
--accent-cyan-glow: rgba(0, 212, 255, 0.4);
|
||||
--bg-elevated: #0f1117;
|
||||
--bg-card: #161920;
|
||||
--bg-hover: #1c2029;
|
||||
--border-subtle: rgba(255, 255, 255, 0.08);
|
||||
--border-active: rgba(0, 212, 255, 0.3);
|
||||
--text-secondary: #9ca3af;
|
||||
--text-muted: #6b7280;
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--radius-lg: 12px;
|
||||
--radius-md: 8px;
|
||||
--radius-sm: 6px;
|
||||
padding: 28px 32px;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Header
|
||||
======================== */
|
||||
.page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
margin: 0;
|
||||
background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.page-subtitle {
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
margin: 6px 0 0;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.create-btn {
|
||||
background: var(--accent-cyan) !important;
|
||||
border: none !important;
|
||||
color: #030407 !important;
|
||||
font-weight: 600;
|
||||
padding: 10px 22px;
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: 0 0 20px var(--accent-cyan-dim);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.create-btn:hover {
|
||||
box-shadow: 0 0 35px var(--accent-cyan-glow);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Stats Grid
|
||||
======================== */
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
position: relative;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
transition: all 0.25s ease;
|
||||
}
|
||||
|
||||
.stat-card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.25s ease;
|
||||
}
|
||||
|
||||
.stat-card:hover {
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--border-active);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stat-card:hover::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.stat-card.active {
|
||||
border-color: var(--accent-cyan);
|
||||
box-shadow: 0 0 20px var(--accent-cyan-dim);
|
||||
}
|
||||
|
||||
.stat-card.active::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.stat-card.active .stat-glow {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.stat-glow {
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
left: -50%;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.stat-card:hover .stat-glow {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Stat variations */
|
||||
.stat-total {
|
||||
--stat-color: #818cf8;
|
||||
}
|
||||
|
||||
.stat-total::before {
|
||||
background: linear-gradient(90deg, #6366f1, #818cf8);
|
||||
}
|
||||
|
||||
.stat-total .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-completed {
|
||||
--stat-color: var(--success);
|
||||
}
|
||||
|
||||
.stat-completed::before {
|
||||
background: linear-gradient(90deg, #16a34a, var(--success));
|
||||
}
|
||||
|
||||
.stat-completed .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(34, 197, 94, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-processing {
|
||||
--stat-color: var(--warning);
|
||||
}
|
||||
|
||||
.stat-processing::before {
|
||||
background: linear-gradient(90deg, #d97706, var(--warning));
|
||||
}
|
||||
|
||||
.stat-processing .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(245, 158, 11, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-failed {
|
||||
--stat-color: var(--danger);
|
||||
}
|
||||
|
||||
.stat-failed::before {
|
||||
background: linear-gradient(90deg, #dc2626, var(--danger));
|
||||
}
|
||||
|
||||
.stat-failed .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(239, 68, 68, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-inner {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 20px 22px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.stat-icon-wrap {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--stat-color);
|
||||
}
|
||||
|
||||
.stat-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
font-family: 'SF Mono', 'JetBrains Mono', monospace;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Tabs
|
||||
======================== */
|
||||
.eval-tabs {
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.eval-container,
|
||||
.blind-test-container {
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Empty State
|
||||
======================== */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 80px 40px;
|
||||
min-height: 450px;
|
||||
}
|
||||
|
||||
.empty-illustration {
|
||||
position: relative;
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.orbit {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
border: 1px dashed rgba(0, 212, 255, 0.2);
|
||||
}
|
||||
|
||||
.orbit-1 {
|
||||
inset: 10px;
|
||||
animation: orbit-rotate 20s linear infinite;
|
||||
}
|
||||
|
||||
.orbit-2 {
|
||||
inset: 30px;
|
||||
border-color: rgba(0, 212, 255, 0.15);
|
||||
animation: orbit-rotate 15s linear infinite reverse;
|
||||
}
|
||||
|
||||
.orbit-3 {
|
||||
inset: 50px;
|
||||
border-color: rgba(0, 212, 255, 0.1);
|
||||
animation: orbit-rotate 10s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes orbit-rotate {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.empty-core {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-card) 100%);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 50%;
|
||||
color: var(--accent-cyan);
|
||||
box-shadow: 0 0 40px var(--accent-cyan-dim);
|
||||
}
|
||||
|
||||
.empty-title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.empty-desc {
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
margin: 0 0 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-btn {
|
||||
background: var(--accent-cyan) !important;
|
||||
border: none !important;
|
||||
color: #030407 !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Eval Table
|
||||
======================== */
|
||||
.eval-table-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 800px;
|
||||
}
|
||||
|
||||
.table-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 14px 20px;
|
||||
background: var(--bg-elevated);
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.table-select .select-all {
|
||||
--el-checkbox-text-color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.selected-text {
|
||||
color: var(--accent-cyan);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.batch-delete-btn {
|
||||
background: transparent !important;
|
||||
border-color: var(--danger) !important;
|
||||
color: var(--danger) !important;
|
||||
}
|
||||
|
||||
.batch-delete-btn:hover {
|
||||
background: var(--danger) !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.batch-clear-btn {
|
||||
background: transparent !important;
|
||||
border-color: var(--text-muted) !important;
|
||||
color: var(--text-secondary) !important;
|
||||
}
|
||||
|
||||
.batch-clear-btn:hover {
|
||||
background: var(--bg-hover) !important;
|
||||
border-color: var(--text-secondary) !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.eval-table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.eval-row {
|
||||
display: grid;
|
||||
grid-template-columns: 40px 50px 1fr 80px 80px 100px 90px;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 14px 20px;
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
transition: background 0.15s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.eval-row.row-animated {
|
||||
animation: row-in 0.3s ease backwards;
|
||||
animation-delay: var(--delay);
|
||||
}
|
||||
|
||||
@keyframes row-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(-10px);
|
||||
}
|
||||
}
|
||||
|
||||
.eval-row:hover {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.eval-row.is-selected {
|
||||
background: rgba(0, 212, 255, 0.05);
|
||||
}
|
||||
|
||||
/* Column styles */
|
||||
.col-select {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.col-icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.eval-type-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: color-mix(in srgb, var(--type-color) 15%, transparent);
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--type-color);
|
||||
}
|
||||
|
||||
.col-name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.eval-name-text {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.col-count {
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
font-family: 'SF Mono', monospace;
|
||||
}
|
||||
|
||||
.col-date {
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
font-family: 'SF Mono', monospace;
|
||||
}
|
||||
|
||||
/* Status Pill */
|
||||
.col-status {
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.status-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 20px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.status-running {
|
||||
background: rgba(245, 158, 11, 0.1);
|
||||
color: var(--warning);
|
||||
}
|
||||
|
||||
.status-running .status-dot {
|
||||
background: var(--warning);
|
||||
animation: pulse 1.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.4; }
|
||||
}
|
||||
|
||||
.status-completed {
|
||||
background: rgba(34, 197, 94, 0.1);
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.status-completed .status-dot {
|
||||
background: var(--success);
|
||||
}
|
||||
|
||||
.status-failed {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.status-failed .status-dot {
|
||||
background: var(--danger);
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
background: rgba(107, 114, 128, 0.1);
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.status-pending .status-dot {
|
||||
background: var(--text-muted);
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
.col-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 4px;
|
||||
min-width: 90px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
color: var(--text-muted) !important;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.action-btn:hover {
|
||||
color: var(--accent-cyan) !important;
|
||||
background: var(--accent-cyan-dim) !important;
|
||||
}
|
||||
|
||||
.action-btn.run:hover {
|
||||
color: var(--success) !important;
|
||||
background: rgba(34, 197, 94, 0.1) !important;
|
||||
}
|
||||
|
||||
.action-btn.delete:hover {
|
||||
color: var(--danger) !important;
|
||||
background: rgba(239, 68, 68, 0.1) !important;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Blind Test Tasks Grid
|
||||
======================== */
|
||||
.tasks-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.task-card {
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 20px;
|
||||
transition: all var(--transition-base);
|
||||
animation: cardIn 0.4s ease backwards;
|
||||
animation-delay: var(--delay);
|
||||
}
|
||||
|
||||
@keyframes cardIn {
|
||||
from { opacity: 0; transform: translateY(15px); }
|
||||
}
|
||||
|
||||
.task-card:hover {
|
||||
border-color: var(--accent-cyan);
|
||||
transform: translateY(-3px);
|
||||
}
|
||||
|
||||
.task-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.task-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg-secondary);
|
||||
}
|
||||
|
||||
.task-icon.running {
|
||||
background: rgba(251, 191, 36, 0.15);
|
||||
color: var(--warning);
|
||||
animation: pulse 2s infinite;
|
||||
}
|
||||
|
||||
.task-icon.completed {
|
||||
background: var(--success-muted);
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.task-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.task-meta {
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.task-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Dialog
|
||||
======================== */
|
||||
.eval-dialog,
|
||||
.blind-dialog {
|
||||
--el-dialog-bg-color: var(--bg-elevated);
|
||||
--el-dialog-border-radius: var(--radius-xl);
|
||||
border: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.model-check-group {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Responsive
|
||||
======================== */
|
||||
@media (max-width: 900px) {
|
||||
.eval-manage {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.page-header {
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header-actions .el-button {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.eval-row {
|
||||
grid-template-columns: 40px 40px 1fr 60px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.col-date,
|
||||
.col-status {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.col-actions {
|
||||
min-width: 50px;
|
||||
}
|
||||
}
|
||||
1190
frontend/src/styles/pages/project-file.css
Normal file
1190
frontend/src/styles/pages/project-file.css
Normal file
File diff suppressed because it is too large
Load Diff
557
frontend/src/styles/pages/project-question.css
Normal file
557
frontend/src/styles/pages/project-question.css
Normal file
@@ -0,0 +1,557 @@
|
||||
/* ========================
|
||||
CSS Variables
|
||||
======================== */
|
||||
.question-manage {
|
||||
--accent-cyan: #00d4ff;
|
||||
--accent-cyan-dim: rgba(0, 212, 255, 0.15);
|
||||
--accent-cyan-glow: rgba(0, 212, 255, 0.4);
|
||||
--bg-elevated: #0f1117;
|
||||
--bg-card: #161920;
|
||||
--bg-hover: #1c2029;
|
||||
--border-subtle: rgba(255, 255, 255, 0.08);
|
||||
--border-active: rgba(0, 212, 255, 0.3);
|
||||
--text-secondary: #9ca3af;
|
||||
--text-muted: #6b7280;
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--radius-lg: 12px;
|
||||
--radius-md: 8px;
|
||||
--radius-sm: 6px;
|
||||
padding: 28px 32px;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Header
|
||||
======================== */
|
||||
.page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
margin: 0;
|
||||
background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.page-subtitle {
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
margin: 6px 0 0;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.generate-btn {
|
||||
background: var(--accent-cyan) !important;
|
||||
border: none !important;
|
||||
color: #030407 !important;
|
||||
font-weight: 600;
|
||||
padding: 10px 22px;
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: 0 0 20px var(--accent-cyan-dim);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.generate-btn:hover {
|
||||
box-shadow: 0 0 35px var(--accent-cyan-glow);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Stats Grid
|
||||
======================== */
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
position: relative;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
transition: all 0.25s ease;
|
||||
}
|
||||
|
||||
.stat-card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.25s ease;
|
||||
}
|
||||
|
||||
.stat-card:hover {
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--border-active);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stat-card:hover::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.stat-card.active {
|
||||
border-color: var(--accent-cyan);
|
||||
box-shadow: 0 0 20px var(--accent-cyan-dim);
|
||||
}
|
||||
|
||||
.stat-card.active::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.stat-card.active .stat-glow {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.stat-glow {
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
left: -50%;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.stat-card:hover .stat-glow {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Stat variations */
|
||||
.stat-total {
|
||||
--stat-color: #818cf8;
|
||||
}
|
||||
|
||||
.stat-total::before {
|
||||
background: linear-gradient(90deg, #6366f1, #818cf8);
|
||||
}
|
||||
|
||||
.stat-total .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-completed {
|
||||
--stat-color: var(--success);
|
||||
}
|
||||
|
||||
.stat-completed::before {
|
||||
background: linear-gradient(90deg, #16a34a, var(--success));
|
||||
}
|
||||
|
||||
.stat-completed .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(34, 197, 94, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-processing {
|
||||
--stat-color: var(--warning);
|
||||
}
|
||||
|
||||
.stat-processing::before {
|
||||
background: linear-gradient(90deg, #d97706, var(--warning));
|
||||
}
|
||||
|
||||
.stat-processing .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(245, 158, 11, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-failed {
|
||||
--stat-color: var(--danger);
|
||||
}
|
||||
|
||||
.stat-failed::before {
|
||||
background: linear-gradient(90deg, #dc2626, var(--danger));
|
||||
}
|
||||
|
||||
.stat-failed .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(239, 68, 68, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-inner {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 20px 22px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.stat-icon-wrap {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--stat-color);
|
||||
}
|
||||
|
||||
.stat-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
font-family: 'SF Mono', 'JetBrains Mono', monospace;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Question Container
|
||||
======================== */
|
||||
.question-container {
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Empty State
|
||||
======================== */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 80px 40px;
|
||||
min-height: 450px;
|
||||
}
|
||||
|
||||
.empty-illustration {
|
||||
position: relative;
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.orbit {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
border: 1px dashed rgba(0, 212, 255, 0.2);
|
||||
}
|
||||
|
||||
.orbit-1 {
|
||||
inset: 10px;
|
||||
animation: orbit-rotate 20s linear infinite;
|
||||
}
|
||||
|
||||
.orbit-2 {
|
||||
inset: 30px;
|
||||
border-color: rgba(0, 212, 255, 0.15);
|
||||
animation: orbit-rotate 15s linear infinite reverse;
|
||||
}
|
||||
|
||||
.orbit-3 {
|
||||
inset: 50px;
|
||||
border-color: rgba(0, 212, 255, 0.1);
|
||||
animation: orbit-rotate 10s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes orbit-rotate {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.empty-core {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-card) 100%);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 50%;
|
||||
color: var(--accent-cyan);
|
||||
box-shadow: 0 0 40px var(--accent-cyan-dim);
|
||||
}
|
||||
|
||||
.empty-title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.empty-desc {
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
margin: 0 0 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-btn {
|
||||
background: var(--accent-cyan) !important;
|
||||
border: none !important;
|
||||
color: #030407 !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Question Table
|
||||
======================== */
|
||||
.question-table-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 800px;
|
||||
}
|
||||
|
||||
.table-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 14px 20px;
|
||||
background: var(--bg-elevated);
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.table-select .select-all {
|
||||
--el-checkbox-text-color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.selected-text {
|
||||
color: var(--accent-cyan);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.batch-delete-btn {
|
||||
background: transparent !important;
|
||||
border-color: var(--danger) !important;
|
||||
color: var(--danger) !important;
|
||||
}
|
||||
|
||||
.batch-delete-btn:hover {
|
||||
background: var(--danger) !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.batch-clear-btn {
|
||||
background: transparent !important;
|
||||
border-color: var(--text-muted) !important;
|
||||
color: var(--text-secondary) !important;
|
||||
}
|
||||
|
||||
.batch-clear-btn:hover {
|
||||
background: var(--bg-hover) !important;
|
||||
border-color: var(--text-secondary) !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.question-table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.question-row {
|
||||
display: grid;
|
||||
grid-template-columns: 40px 1fr 90px 80px 60px;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 14px 20px;
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
transition: background 0.15s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.question-row.row-animated {
|
||||
animation: row-in 0.3s ease backwards;
|
||||
animation-delay: var(--delay);
|
||||
}
|
||||
|
||||
@keyframes row-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(-10px);
|
||||
}
|
||||
}
|
||||
|
||||
.question-row:hover {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.question-row.is-selected {
|
||||
background: rgba(0, 212, 255, 0.05);
|
||||
}
|
||||
|
||||
/* Column styles */
|
||||
.col-select {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.col-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.question-text {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.answer-text {
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.col-type {
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.col-type .el-tag {
|
||||
background: color-mix(in srgb, var(--tag-color) 15%, transparent) !important;
|
||||
border-color: transparent !important;
|
||||
color: var(--tag-color) !important;
|
||||
}
|
||||
|
||||
.col-source {
|
||||
min-width: 70px;
|
||||
}
|
||||
|
||||
.source-badge {
|
||||
font-size: 12px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 12px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.source-badge.source-generated {
|
||||
background: rgba(34, 197, 94, 0.1);
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.source-badge.source-manual {
|
||||
background: rgba(0, 212, 255, 0.1);
|
||||
color: var(--accent-cyan);
|
||||
}
|
||||
|
||||
.source-badge.source-failed {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
.col-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 4px;
|
||||
min-width: 60px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
color: var(--text-muted) !important;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.action-btn.delete:hover {
|
||||
color: var(--danger) !important;
|
||||
background: rgba(239, 68, 68, 0.1) !important;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Dialog
|
||||
======================== */
|
||||
.generate-dialog {
|
||||
--el-dialog-bg-color: var(--bg-elevated);
|
||||
--el-dialog-border-radius: var(--radius-xl);
|
||||
border: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.generate-dialog :deep(.el-form-item__label) {
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Responsive
|
||||
======================== */
|
||||
@media (max-width: 900px) {
|
||||
.question-manage {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.page-header {
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header-actions .el-button {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.question-row {
|
||||
grid-template-columns: 40px 1fr 60px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.col-type,
|
||||
.col-source {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.col-actions {
|
||||
min-width: 50px;
|
||||
}
|
||||
}
|
||||
1999
frontend/src/styles/pages/project-text-split.css
Normal file
1999
frontend/src/styles/pages/project-text-split.css
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,918 +0,0 @@
|
||||
<template>
|
||||
<div class="question-manage">
|
||||
<!-- Header -->
|
||||
<div class="page-header">
|
||||
<div class="header-left">
|
||||
<h2 class="page-title">问答管理</h2>
|
||||
<p class="page-subtitle">管理和生成问答数据</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<el-button type="primary" @click="showGenerateDialog = true" class="generate-btn">
|
||||
<el-icon><Plus /></el-icon>
|
||||
<span>生成问题</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats Cards -->
|
||||
<div class="stats-grid">
|
||||
<div
|
||||
class="stat-card stat-total"
|
||||
:class="{ active: filterStatus === '' }"
|
||||
@click="filterStatus = ''"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><ChatDotSquare /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ questions.length }}</span>
|
||||
<span class="stat-label">总问题数</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-completed"
|
||||
:class="{ active: filterStatus === 'generated' }"
|
||||
@click="filterStatus = filterStatus === 'generated' ? '' : 'generated'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><MagicStick /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ generatedCount }}</span>
|
||||
<span class="stat-label">AI 生成</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-processing"
|
||||
:class="{ active: filterStatus === 'manual' }"
|
||||
@click="filterStatus = filterStatus === 'manual' ? '' : 'manual'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><EditPen /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ manualCount }}</span>
|
||||
<span class="stat-label">手动添加</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="stat-card stat-failed"
|
||||
:class="{ active: filterStatus === 'failed' }"
|
||||
@click="filterStatus = filterStatus === 'failed' ? '' : 'failed'"
|
||||
>
|
||||
<div class="stat-glow"></div>
|
||||
<div class="stat-inner">
|
||||
<div class="stat-icon-wrap">
|
||||
<el-icon size="24"><CircleCloseFilled /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<span class="stat-value">{{ failedCount }}</span>
|
||||
<span class="stat-label">失败</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Question Container -->
|
||||
<div class="question-container" v-loading="loading && isInitialLoad">
|
||||
<!-- Empty State -->
|
||||
<div v-if="!loading && !isInitialLoad && filteredQuestions.length === 0" class="empty-state">
|
||||
<div class="empty-illustration">
|
||||
<div class="orbit orbit-1"></div>
|
||||
<div class="orbit orbit-2"></div>
|
||||
<div class="orbit orbit-3"></div>
|
||||
<div class="empty-core">
|
||||
<el-icon size="40"><ChatDotSquare /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="empty-title">暂无问答数据</h3>
|
||||
<p class="empty-desc">生成您的第一个问答数据集</p>
|
||||
<el-button type="primary" @click="showGenerateDialog = true" class="empty-btn">生成问题</el-button>
|
||||
</div>
|
||||
|
||||
<!-- Question Table -->
|
||||
<div v-else class="question-table-wrapper">
|
||||
<!-- Table Header -->
|
||||
<div class="table-header">
|
||||
<div class="table-select">
|
||||
<el-checkbox
|
||||
:model-value="isAllSelected"
|
||||
@change="toggleSelectAll"
|
||||
class="select-all"
|
||||
>
|
||||
<span v-if="selectedCount > 0" class="selected-text">已选择 {{ selectedCount }} 项</span>
|
||||
<span v-else>全选</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
<div class="table-actions" v-if="selectedCount > 0">
|
||||
<el-button type="danger" size="small" plain @click="clearSelection" class="batch-clear-btn">
|
||||
<el-icon><Close /></el-icon>
|
||||
<span>清除选择</span>
|
||||
</el-button>
|
||||
<el-button type="danger" size="small" plain @click="batchDelete" class="batch-delete-btn">
|
||||
<el-icon><Delete /></el-icon>
|
||||
<span>批量删除</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table Body -->
|
||||
<div class="question-table">
|
||||
<div
|
||||
v-for="(question, index) in filteredQuestions"
|
||||
:key="question.id"
|
||||
class="question-row"
|
||||
:class="{
|
||||
'is-selected': isSelected(question.id),
|
||||
'row-animated': isInitialLoad
|
||||
}"
|
||||
:style="{ '--delay': index * 0.04 + 's' }"
|
||||
@click="toggleSelect(question.id)"
|
||||
>
|
||||
<!-- Select Checkbox -->
|
||||
<div class="col-select" @click.stop>
|
||||
<el-checkbox
|
||||
:model-value="isSelected(question.id)"
|
||||
@change="toggleSelect(question.id)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Question Content -->
|
||||
<div class="col-content">
|
||||
<div class="question-text">{{ question.content }}</div>
|
||||
<div class="answer-text" v-if="question.answer">答: {{ question.answer }}</div>
|
||||
</div>
|
||||
|
||||
<!-- Type -->
|
||||
<div class="col-type">
|
||||
<el-tag size="small" :style="{ '--tag-color': getTypeColor(question.question_type) }" effect="dark">
|
||||
{{ getTypeName(question.question_type) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
|
||||
<!-- Source -->
|
||||
<div class="col-source">
|
||||
<span class="source-badge" :class="'source-' + question.source">{{ getSourceName(question.source) }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="col-actions" @click.stop>
|
||||
<el-popconfirm title="确定删除此问题?" @confirm="handleDelete(question)">
|
||||
<template #reference>
|
||||
<el-button text size="small" class="action-btn delete">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Generate Dialog -->
|
||||
<el-dialog v-model="showGenerateDialog" title="生成问题" width="560px" class="generate-dialog">
|
||||
<el-form :model="generateConfig" label-position="top">
|
||||
<el-form-item label="选择文本块">
|
||||
<el-select
|
||||
v-model="generateConfig.chunk_ids"
|
||||
multiple
|
||||
placeholder="选择文本块"
|
||||
style="width: 100%"
|
||||
size="large"
|
||||
>
|
||||
<el-option
|
||||
v-for="chunk in chunks"
|
||||
:key="chunk.id"
|
||||
:label="chunk.name || chunk.content.slice(0, 50) + '...'"
|
||||
:value="chunk.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div class="form-row">
|
||||
<el-form-item label="每个块生成数量">
|
||||
<el-input-number v-model="generateConfig.count" :min="1" :max="50" size="large" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="问题类型">
|
||||
<el-checkbox-group v-model="generateConfig.question_types">
|
||||
<el-checkbox label="fact">事实性</el-checkbox>
|
||||
<el-checkbox label="summary">总结性</el-checkbox>
|
||||
<el-checkbox label="reasoning">推理性</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="showGenerateDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleGenerate" :loading="generating">开始生成</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { chunkApi, questionApi } from '@/api'
|
||||
|
||||
const route = useRoute()
|
||||
const projectId = computed(() => route.params.id)
|
||||
|
||||
const loading = ref(false)
|
||||
const isInitialLoad = ref(true)
|
||||
const generating = ref(false)
|
||||
const questions = ref([])
|
||||
const chunks = ref([])
|
||||
const showGenerateDialog = ref(false)
|
||||
const filterStatus = ref('')
|
||||
|
||||
const generateConfig = reactive({
|
||||
chunk_ids: [],
|
||||
count: 5,
|
||||
question_types: ['fact', 'summary']
|
||||
})
|
||||
|
||||
// Multi-select
|
||||
const selectedQuestions = ref([])
|
||||
|
||||
const filteredQuestions = computed(() => {
|
||||
if (!filterStatus.value) return questions.value
|
||||
return questions.value.filter(q => q.source === filterStatus.value)
|
||||
})
|
||||
|
||||
const generatedCount = computed(() => questions.value.filter(q => q.source === 'generated').length)
|
||||
const manualCount = computed(() => questions.value.filter(q => q.source === 'manual').length)
|
||||
const failedCount = computed(() => questions.value.filter(q => q.status === 'failed').length)
|
||||
|
||||
const isAllSelected = computed(() => filteredQuestions.value.length > 0 && selectedQuestions.value.length === filteredQuestions.value.length)
|
||||
const selectedCount = computed(() => selectedQuestions.value.length)
|
||||
|
||||
const toggleSelectAll = () => {
|
||||
if (isAllSelected.value) {
|
||||
selectedQuestions.value = []
|
||||
} else {
|
||||
selectedQuestions.value = filteredQuestions.value.map(q => q.id)
|
||||
}
|
||||
}
|
||||
|
||||
const toggleSelect = (id) => {
|
||||
const index = selectedQuestions.value.indexOf(id)
|
||||
if (index === -1) {
|
||||
selectedQuestions.value.push(id)
|
||||
} else {
|
||||
selectedQuestions.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
const isSelected = (id) => selectedQuestions.value.includes(id)
|
||||
|
||||
const clearSelection = () => {
|
||||
selectedQuestions.value = []
|
||||
}
|
||||
|
||||
const batchDelete = async () => {
|
||||
if (selectedQuestions.value.length === 0) return
|
||||
try {
|
||||
for (const id of selectedQuestions.value) {
|
||||
await questionApi.delete(projectId.value, id)
|
||||
}
|
||||
ElMessage.success(`已删除 ${selectedQuestions.value.length} 个问题`)
|
||||
selectedQuestions.value = []
|
||||
fetchQuestions()
|
||||
} catch (error) {
|
||||
ElMessage.error('删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
const fetchQuestions = async () => {
|
||||
const wasInitial = isInitialLoad.value
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await chunkApi.list(projectId.value, {})
|
||||
chunks.value = res.data?.chunks || res.chunks || []
|
||||
questions.value = chunks.value.flatMap(c => (c.questions || []).map(q => ({ ...q, source: c.name })))
|
||||
} catch (error) {
|
||||
questions.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (wasInitial) {
|
||||
isInitialLoad.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleGenerate = async () => {
|
||||
if (generateConfig.chunk_ids.length === 0) {
|
||||
ElMessage.warning('请选择文本块')
|
||||
return
|
||||
}
|
||||
generating.value = true
|
||||
try {
|
||||
await questionApi.generate(projectId.value, generateConfig)
|
||||
ElMessage.success('问题生成任务已启动')
|
||||
showGenerateDialog.value = false
|
||||
setTimeout(fetchQuestions, 2000)
|
||||
} catch (error) {
|
||||
ElMessage.error('生成失败')
|
||||
} finally {
|
||||
generating.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = async (question) => {
|
||||
try {
|
||||
await questionApi.delete(projectId.value, question.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchQuestions()
|
||||
} catch (error) {
|
||||
ElMessage.error('删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
const getTypeColor = (type) => {
|
||||
const map = { 'fact': '#22c55e', 'summary': '#818cf8', 'reasoning': '#f59e0b' }
|
||||
return map[type] || '#818cf8'
|
||||
}
|
||||
|
||||
const getTypeName = (type) => {
|
||||
const map = { 'fact': '事实性', 'summary': '总结性', 'reasoning': '推理性' }
|
||||
return map[type] || type
|
||||
}
|
||||
|
||||
const getSourceName = (source) => {
|
||||
const map = { 'generated': 'AI生成', 'manual': '手动', 'failed': '失败' }
|
||||
return map[source] || source
|
||||
}
|
||||
|
||||
onMounted(() => fetchQuestions())
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* ========================
|
||||
CSS Variables
|
||||
======================== */
|
||||
.question-manage {
|
||||
--accent-cyan: #00d4ff;
|
||||
--accent-cyan-dim: rgba(0, 212, 255, 0.15);
|
||||
--accent-cyan-glow: rgba(0, 212, 255, 0.4);
|
||||
--bg-elevated: #0f1117;
|
||||
--bg-card: #161920;
|
||||
--bg-hover: #1c2029;
|
||||
--border-subtle: rgba(255, 255, 255, 0.08);
|
||||
--border-active: rgba(0, 212, 255, 0.3);
|
||||
--text-secondary: #9ca3af;
|
||||
--text-muted: #6b7280;
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--radius-lg: 12px;
|
||||
--radius-md: 8px;
|
||||
--radius-sm: 6px;
|
||||
padding: 28px 32px;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Header
|
||||
======================== */
|
||||
.page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
margin: 0;
|
||||
background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.page-subtitle {
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
margin: 6px 0 0;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.generate-btn {
|
||||
background: var(--accent-cyan) !important;
|
||||
border: none !important;
|
||||
color: #030407 !important;
|
||||
font-weight: 600;
|
||||
padding: 10px 22px;
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: 0 0 20px var(--accent-cyan-dim);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.generate-btn:hover {
|
||||
box-shadow: 0 0 35px var(--accent-cyan-glow);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Stats Grid
|
||||
======================== */
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
position: relative;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
transition: all 0.25s ease;
|
||||
}
|
||||
|
||||
.stat-card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.25s ease;
|
||||
}
|
||||
|
||||
.stat-card:hover {
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--border-active);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stat-card:hover::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.stat-card.active {
|
||||
border-color: var(--accent-cyan);
|
||||
box-shadow: 0 0 20px var(--accent-cyan-dim);
|
||||
}
|
||||
|
||||
.stat-card.active::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.stat-card.active .stat-glow {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.stat-glow {
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
left: -50%;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.stat-card:hover .stat-glow {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Stat variations */
|
||||
.stat-total {
|
||||
--stat-color: #818cf8;
|
||||
}
|
||||
|
||||
.stat-total::before {
|
||||
background: linear-gradient(90deg, #6366f1, #818cf8);
|
||||
}
|
||||
|
||||
.stat-total .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-completed {
|
||||
--stat-color: var(--success);
|
||||
}
|
||||
|
||||
.stat-completed::before {
|
||||
background: linear-gradient(90deg, #16a34a, var(--success));
|
||||
}
|
||||
|
||||
.stat-completed .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(34, 197, 94, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-processing {
|
||||
--stat-color: var(--warning);
|
||||
}
|
||||
|
||||
.stat-processing::before {
|
||||
background: linear-gradient(90deg, #d97706, var(--warning));
|
||||
}
|
||||
|
||||
.stat-processing .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(245, 158, 11, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-failed {
|
||||
--stat-color: var(--danger);
|
||||
}
|
||||
|
||||
.stat-failed::before {
|
||||
background: linear-gradient(90deg, #dc2626, var(--danger));
|
||||
}
|
||||
|
||||
.stat-failed .stat-glow {
|
||||
background: radial-gradient(circle at 30% 30%, rgba(239, 68, 68, 0.3), transparent 50%);
|
||||
}
|
||||
|
||||
.stat-inner {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 20px 22px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.stat-icon-wrap {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--stat-color);
|
||||
}
|
||||
|
||||
.stat-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
font-family: 'SF Mono', 'JetBrains Mono', monospace;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Question Container
|
||||
======================== */
|
||||
.question-container {
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Empty State
|
||||
======================== */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 80px 40px;
|
||||
min-height: 450px;
|
||||
}
|
||||
|
||||
.empty-illustration {
|
||||
position: relative;
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.orbit {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
border: 1px dashed rgba(0, 212, 255, 0.2);
|
||||
}
|
||||
|
||||
.orbit-1 {
|
||||
inset: 10px;
|
||||
animation: orbit-rotate 20s linear infinite;
|
||||
}
|
||||
|
||||
.orbit-2 {
|
||||
inset: 30px;
|
||||
border-color: rgba(0, 212, 255, 0.15);
|
||||
animation: orbit-rotate 15s linear infinite reverse;
|
||||
}
|
||||
|
||||
.orbit-3 {
|
||||
inset: 50px;
|
||||
border-color: rgba(0, 212, 255, 0.1);
|
||||
animation: orbit-rotate 10s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes orbit-rotate {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.empty-core {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-card) 100%);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 50%;
|
||||
color: var(--accent-cyan);
|
||||
box-shadow: 0 0 40px var(--accent-cyan-dim);
|
||||
}
|
||||
|
||||
.empty-title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.empty-desc {
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
margin: 0 0 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-btn {
|
||||
background: var(--accent-cyan) !important;
|
||||
border: none !important;
|
||||
color: #030407 !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Question Table
|
||||
======================== */
|
||||
.question-table-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 800px;
|
||||
}
|
||||
|
||||
.table-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 14px 20px;
|
||||
background: var(--bg-elevated);
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.table-select .select-all {
|
||||
--el-checkbox-text-color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.selected-text {
|
||||
color: var(--accent-cyan);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.batch-delete-btn {
|
||||
background: transparent !important;
|
||||
border-color: var(--danger) !important;
|
||||
color: var(--danger) !important;
|
||||
}
|
||||
|
||||
.batch-delete-btn:hover {
|
||||
background: var(--danger) !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.batch-clear-btn {
|
||||
background: transparent !important;
|
||||
border-color: var(--text-muted) !important;
|
||||
color: var(--text-secondary) !important;
|
||||
}
|
||||
|
||||
.batch-clear-btn:hover {
|
||||
background: var(--bg-hover) !important;
|
||||
border-color: var(--text-secondary) !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.question-table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.question-row {
|
||||
display: grid;
|
||||
grid-template-columns: 40px 1fr 90px 80px 60px;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 14px 20px;
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
transition: background 0.15s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.question-row.row-animated {
|
||||
animation: row-in 0.3s ease backwards;
|
||||
animation-delay: var(--delay);
|
||||
}
|
||||
|
||||
@keyframes row-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(-10px);
|
||||
}
|
||||
}
|
||||
|
||||
.question-row:hover {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.question-row.is-selected {
|
||||
background: rgba(0, 212, 255, 0.05);
|
||||
}
|
||||
|
||||
/* Column styles */
|
||||
.col-select {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.col-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.question-text {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.answer-text {
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.col-type {
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.col-type .el-tag {
|
||||
background: color-mix(in srgb, var(--tag-color) 15%, transparent) !important;
|
||||
border-color: transparent !important;
|
||||
color: var(--tag-color) !important;
|
||||
}
|
||||
|
||||
.col-source {
|
||||
min-width: 70px;
|
||||
}
|
||||
|
||||
.source-badge {
|
||||
font-size: 12px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 12px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.source-badge.source-generated {
|
||||
background: rgba(34, 197, 94, 0.1);
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.source-badge.source-manual {
|
||||
background: rgba(0, 212, 255, 0.1);
|
||||
color: var(--accent-cyan);
|
||||
}
|
||||
|
||||
.source-badge.source-failed {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
.col-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 4px;
|
||||
min-width: 60px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
color: var(--text-muted) !important;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.action-btn.delete:hover {
|
||||
color: var(--danger) !important;
|
||||
background: rgba(239, 68, 68, 0.1) !important;
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Dialog
|
||||
======================== */
|
||||
.generate-dialog {
|
||||
--el-dialog-bg-color: var(--bg-elevated);
|
||||
--el-dialog-border-radius: var(--radius-xl);
|
||||
border: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.generate-dialog :deep(.el-form-item__label) {
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ========================
|
||||
Responsive
|
||||
======================== */
|
||||
@media (max-width: 900px) {
|
||||
.question-manage {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.page-header {
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header-actions .el-button {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.question-row {
|
||||
grid-template-columns: 40px 1fr 60px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.col-type,
|
||||
.col-source {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.col-actions {
|
||||
min-width: 50px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user