Compare commits

..
8 Commits
Author SHA1 Message Date
lxy fb83339ffb 文档: aichat上下文管理完善设计与看板登记
- 专项设计:M1-M4四批修复蓝图(6缺口归因+验收口径)
- 样式大重构u-agent对齐设计
- 看板:M1销账(验收证据)+收尾令登记
2026-10-18 23:16:06 +08:00
lxy 25ec9cf69a 优化: 前端u-agent令牌对齐与组件拆分续批
- 全局样式类(df-sec-h/df-toast族)替换散装实现,主题token去硬编码兜底
- 拆分子组件:ai-chat/queue-panel(队列时钟与编辑随迁)、
  conversation-sidebar/ConversationList、settings/provider-panel
- 父组件死副本清理(队列编辑/时钟/键位表,TS6133清零)并补
  fill-draft父侧转发(重构半成品断链修复)
- 验收:vue-tsc EXIT 0
2026-10-18 23:15:57 +08:00
lxy 302c4bcf52 修复: 飞书审批决议终态闭环与决议词容错
- F5-1:决议词归一(trim/剥尾标点/同义:批准|同意|拒绝|不同意)
- F5-2:审批终态卡原地更新(桌面决议/超时拒后不再恒挂可点);
  迟到决议30min窗内提示已处理,不再注入运行中任务
- APPROVAL_CARDS/RESOLVED_CHATS内存句柄,重启后走幂等回执无损失
2026-10-18 23:15:51 +08:00
lxy 05d0f89c16 修复: aichat上下文管理与信息组织P1批
逐件(证据:深查-aichat质量/信息UX-2026-10-17):
- 恢复链套娃:RECOVERY_ARTIFACT_PREFIX双侧过滤+单点拦截(E1)
- message_repo全量重写保留原created_at(E11,治1750条时间线污染)
- search_files/grep 0命中附阴性存疑提示(E6,共享negative_hit_hint)
- 项目清单三源活跃度排序+system prompt指纹对齐(E4跑题)
- 会话列表活跃/归档offset分页+侧栏加载更多(F4-1,治50硬上限)
- inject消息source标记(轮次分桶不误计发起,V52同源)
- 提示词回复风格条款中英双语(反口水话,含测试断言)
- i18n补键:复制/折叠量/发送title/历史定位提示(F1-1/F2-1/F6-1)

验收:cargo test --workspace 2281 passed 0 failed;vue-tsc EXIT 0
2026-10-18 23:15:45 +08:00
lxy a273a86a7d 优化: 参考 u-agent 管理台范式升级 UI 设计令牌与公共组件 2026-10-18 15:35:15 +08:00
lxy 45f0560f85 修复: 飞书长连接假活自愈——探活持续断流后主动断开重建
看门狗连续 3 个巡检周期(断流约13分钟)判定假活后 Notify 唤醒
run_loop 主动退出,复用外层 backoff 重连循环重建全新 WS 握手
只告警不自愈的盲区已补齐,比 SDK 内部重连更彻底(全新握手)
2026-10-17 22:19:57 +08:00
lxy f74d51b905 优化: 会话侧栏字体层级收敛+v0.1.3发布收尾脚本入库,归档飞书WS假活排查文档 2026-10-17 21:54:25 +08:00
lxy e08b0f4311 优化: 升版 0.1.2 -> 0.1.3,启动 B2/B3 端到端升级验证 2026-10-17 21:18:03 +08:00
84 changed files with 4748 additions and 2146 deletions
Generated
+1 -1
View File
@@ -1039,7 +1039,7 @@ dependencies = [
[[package]] [[package]]
name = "devflow" name = "devflow"
version = "0.1.2" version = "0.1.3"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
+86 -2
View File
@@ -265,6 +265,12 @@ impl AiMessageRepo {
/// 全量重写语义——以入参 records 为该对话的**唯一真相**,先删该 conv 全部旧行再批量插。 /// 全量重写语义——以入参 records 为该对话的**唯一真相**,先删该 conv 全部旧行再批量插。
/// 单事务保证「删 + 插」原子,无中间空窗(reload 不会读到半删半插的中间态)。 /// 单事务保证「删 + 插」原子,无中间空窗(reload 不会读到半删半插的中间态)。
/// ///
/// created_at 保出生时间(2026-10-17 修复批量污染):created_at 语义 = 消息首次入库时间,
/// 全量重写只该变内容不变出生时间。调用方(save_conversation)对整批 records 统一盖
/// 对话级 created_at(老对话 None 时 now 兜底),直插会把全对话消息 created_at 抹成同一秒。
/// 故 DELETE 前先取存量 `id → created_at` 映射,重插时同 id 行回填原值;新 id(真新消息)
/// 保留入参值。ai_messages 表无 updated_at 列,内容变更无单独时间戳(不在此列语义内)。
///
/// 设计权衡(非 dirty 增量,留 P2.1 优化): /// 设计权衡(非 dirty 增量,留 P2.1 优化):
/// - 内存 ContextManager 是运行时真相源,save 是同步点,每轮 save 全量回写简单可靠; /// - 内存 ContextManager 是运行时真相源,save 是同步点,每轮 save 全量回写简单可靠;
/// - INSERT OR IGNORE 幂等:records 内 id 重复或与残留行(理论不应有,事务已 DELETE)冲突跳过; /// - INSERT OR IGNORE 幂等:records 内 id 重复或与残留行(理论不应有,事务已 DELETE)冲突跳过;
@@ -274,7 +280,7 @@ impl AiMessageRepo {
pub async fn replace_conversation( pub async fn replace_conversation(
&self, &self,
conv_id: &str, conv_id: &str,
records: Vec<AiMessageRecord>, mut records: Vec<AiMessageRecord>,
) -> Result<()> { ) -> Result<()> {
let conn = self.conn.clone(); let conn = self.conn.clone();
let conv_id = conv_id.to_owned(); let conv_id = conv_id.to_owned();
@@ -282,7 +288,29 @@ impl AiMessageRepo {
let mut guard = conn.blocking_lock(); let mut guard = conn.blocking_lock();
let tx = guard.transaction().map_err(storage_err)?; let tx = guard.transaction().map_err(storage_err)?;
{ {
// 先删该 conv 全部旧行(全量重写语义) // 先取存量 id → created_at 映射(DELETE 前留证,重插回填保出生时间)
{
let mut stmt = tx
.prepare("SELECT id, created_at FROM ai_messages WHERE conversation_id = ?1")
.map_err(storage_err)?;
let rows = stmt
.query_map(params![conv_id], |r| {
Ok((r.get::<_, String>("id")?, r.get::<_, String>("created_at")?))
})
.map_err(storage_err)?;
let mut original: std::collections::HashMap<String, String> =
std::collections::HashMap::new();
for r in rows {
let (id, created_at) = r.map_err(storage_err)?;
original.insert(id, created_at);
}
for rec in &mut records {
if let Some(orig) = original.get(&rec.id) {
rec.created_at = orig.clone();
}
}
}
// 再删该 conv 全部旧行(全量重写语义)
tx.execute( tx.execute(
"DELETE FROM ai_messages WHERE conversation_id = ?1", "DELETE FROM ai_messages WHERE conversation_id = ?1",
params![conv_id], params![conv_id],
@@ -693,6 +721,62 @@ mod tests {
assert_eq!(got.len(), 1, "重复 replace 不应叠加"); assert_eq!(got.len(), 1, "重复 replace 不应叠加");
} }
/// replace_conversation 保 created_at 出生时间(2026-10-17 批量污染回归):
/// 调用方对整批统一盖一个 created_at(如对话级时间或 now),重写后既有 id 行
/// 的 created_at 必须逐行保留原入库值,不得被统一时间抹平;新 id 行保留入参值。
#[tokio::test]
async fn replace_conversation_preserves_created_at() {
let db = Database::open_in_memory().await.expect("open_in_memory");
let repo = AiMessageRepo::new(&db);
// 预置两行,created_at 各异(模拟真实逐条入库的出生时间)
let mut m0 = mk_msg("m0", "c", 0, "user", "v1");
m0.created_at = "2026-10-01T10:00:00.000".into();
let mut m1 = mk_msg("m1", "c", 1, "assistant", "v1");
m1.created_at = "2026-10-02T11:30:00.000".into();
repo.insert_batch(vec![m0, m1]).await.expect("insert");
// 重写:既有 id 内容变了、created_at 被调用方统一盖成同一时间;
// 另带一条新 id 消息(真新消息,该保留入参时间)。
let uniform_ts = "2026-10-17T21:25:01.000";
let rewrite = |id: &str, seq: i64, role: &str, content: &str| {
let mut m = mk_msg(id, "c", seq, role, content);
m.created_at = uniform_ts.into();
m
};
repo.replace_conversation(
"c",
vec![
rewrite("m0", 0, "user", "v2-改写内容"),
rewrite("m1", 1, "assistant", "v2-改写内容"),
rewrite("m2_new", 2, "user", "新消息"),
],
)
.await
.expect("replace");
let got = repo.list_by_conversation("c").await.expect("list");
assert_eq!(got.len(), 3);
// 逐行断言:既有 id 的 created_at 保持原值,内容确实变了
assert_eq!(got[0].id, "m0");
assert_eq!(got[0].created_at, "2026-10-01T10:00:00.000", "既有行 created_at 不得被重写抹平");
assert_eq!(got[0].content, "v2-改写内容");
assert_eq!(got[1].id, "m1");
assert_eq!(got[1].created_at, "2026-10-02T11:30:00.000", "既有行 created_at 不得被重写抹平");
assert_eq!(got[1].content, "v2-改写内容");
// 新 id(首次入库)保留入参 created_at
assert_eq!(got[2].id, "m2_new");
assert_eq!(got[2].created_at, uniform_ts, "新消息保留入参 created_at");
// 二次重写再验:出生时间已固化,连续重写不漂移
repo.replace_conversation("c", vec![rewrite("m0", 0, "user", "v3")])
.await
.expect("replace again");
let got = repo.list_by_conversation("c").await.expect("list");
assert_eq!(got.len(), 1);
assert_eq!(got[0].created_at, "2026-10-01T10:00:00.000", "连续重写 created_at 不漂移");
}
/// limit=0 契约:返空集(直传 SQLite LIMIT 0),不再旧版 max(1) 钳成 1 条。 /// limit=0 契约:返空集(直传 SQLite LIMIT 0),不再旧版 max(1) 钳成 1 条。
/// 锁死语义防回归:请求 0 条却回 1 条会让调用方误判页内有数据。 /// 锁死语义防回归:请求 0 条却回 1 条会让调用方误判页内有数据。
#[tokio::test] #[tokio::test]
+80 -16
View File
@@ -87,9 +87,9 @@ fn build_order_clause(order_by: Option<&str>) -> Result<String> {
/// 带「最近活跃时间」的项目记录(list_active_with_activity 专用返回结构)。 /// 带「最近活跃时间」的项目记录(list_active_with_activity 专用返回结构)。
/// ///
/// `last_active_at` = COALESCE(project_events 最新事件 created_at, projects.updated_at): /// `last_active_at` = MAX(tasks.updated_at 最新值, project_events 最新 created_at,
/// 反映业务活跃(任务/灵感/状态推进等事件),无事件项目回退 updated_at。供前端「最近活跃排序」 /// projects.updated_at):任务活跃为主信号(任务面是真实工作发生地),事件表已停写仅保留维度,
/// 展示,语义比 projects.updated_at(随元信息修改如改 description 也会刷新)更准确。 /// updated_at 兜底。供前端「最近活跃排序」展示与 system prompt 项目清单排序。
/// ///
/// Serialize 供 IPC 层直接序列化回前端(serde 字段名 snake_case,对齐 ProjectRecord)。 /// Serialize 供 IPC 层直接序列化回前端(serde 字段名 snake_case,对齐 ProjectRecord)。
#[derive(Debug, Clone, serde::Serialize)] #[derive(Debug, Clone, serde::Serialize)]
@@ -243,29 +243,35 @@ impl ProjectRepo {
.map_err(storage_err)? .map_err(storage_err)?
} }
/// 列出未删除项目,**按「最近活跃」排序**(LEFT JOIN project_events 取最新事件时间, /// 列出未删除项目,**按「最近活跃」排序**(三源取大:任务活跃为主信号)。
/// COALESCE 回退 updated_at)。
/// ///
/// 业务语义:项目「最近活跃」应反映业务事件(任务/灵感/状态推进),而非 projects.updated_at /// 业务语义:last_active_at = MAX(tasks.updated_at 最新值, project_events 最新 created_at,
/// (后者随元信息修改如改 description/path 也会刷新,不反映真实业务活跃)。本方法通过子查询 /// projects.updated_at)。**任务活跃为主信号**——ai-chat 会话/任务面是真实工作发生地,
/// 取每个项目 project_events 最新 created_at,无事件项目回退 updated_at,排序列统一可比。 /// 任务停更即项目停更;project_events 已停写(现网空表,保留维度向后兼容);
/// projects.updated_at 仅元信息修改(改 description/path 也会刷新,不反映真实业务活跃),
/// 仅作兜底。无任务无事件的项目回退 updated_at,排序列统一可比。
/// ///
/// 子查询而非 JOIN:project_events 每项目可能 0..N 条,JOIN 会展开需 DISTINCT,子查询 /// 子查询而非 JOIN:tasks/project_events 每项目可能 0..N 条,JOIN 会展开需 DISTINCT,
/// `(SELECT MAX(created_at) FROM project_events WHERE project_id = projects.id)` 每行一次 /// 标量子查询每行一次聚合,语义清晰无笛卡尔积风险(SQLite 多参 MAX 为标量取大,
/// 聚合,语义清晰无笛卡尔积风险。单用户桌面应用项目数小,无性能压力。 /// IFNULL 兜空子查询 NULL)。单用户桌面应用项目数小,无性能压力。
/// ///
/// 返回 `ProjectActivityRecord`(ProjectRecord + last_active_at 字段),供前端排序展示。 /// 返回 `ProjectActivityRecord`(ProjectRecord + last_active_at 字段),供前端排序展示
/// 与 system prompt「当前项目」清单(build_context_lists)按活跃度排序。
pub async fn list_active_with_activity(&self) -> Result<Vec<ProjectActivityRecord>> { pub async fn list_active_with_activity(&self) -> Result<Vec<ProjectActivityRecord>> {
let conn = self.conn.clone(); let conn = self.conn.clone();
tokio::task::spawn_blocking(move || { tokio::task::spawn_blocking(move || {
let guard = conn.blocking_lock(); let guard = conn.blocking_lock();
// COALESCE(子查询最新事件, projects.updated_at):无事件项目回退 updated_at, // 三源取大(SQLite 多参 MAX=标量取大,IFNULL 兜空子查询):任务活跃为主信号,
// 保证所有项目有可比活跃时间。ORDER BY 该列 DESC,同时间 created_at DESC 兜底稳定。 // 事件表已停写仅保留维度,updated_at 兜底。ORDER BY 该列 DESC,同时间 created_at DESC
// 兜底稳定。
let mut stmt = guard let mut stmt = guard
.prepare( .prepare(
"SELECT id, name, description, status, idea_id, path, stack, archived, created_at, updated_at, \ "SELECT id, name, description, status, idea_id, path, stack, archived, created_at, updated_at, \
COALESCE((SELECT MAX(created_at) FROM project_events WHERE project_id = projects.id), \ MAX(\
updated_at) AS last_active_at \ IFNULL((SELECT MAX(updated_at) FROM tasks WHERE project_id = projects.id AND deleted_at IS NULL), 0), \
IFNULL((SELECT MAX(created_at) FROM project_events WHERE project_id = projects.id), 0), \
updated_at\
) AS last_active_at \
FROM projects WHERE deleted_at IS NULL AND archived = 0 \ FROM projects WHERE deleted_at IS NULL AND archived = 0 \
ORDER BY last_active_at DESC, created_at DESC", ORDER BY last_active_at DESC, created_at DESC",
) )
@@ -840,4 +846,62 @@ mod tests {
assert_eq!(after.name, "原项目", "回收站项目内容不应被改写"); assert_eq!(after.name, "原项目", "回收站项目内容不应被改写");
assert_eq!(after.updated_at, current.updated_at, "updated_at 不应抖动"); assert_eq!(after.updated_at, current.updated_at, "updated_at 不应抖动");
} }
#[tokio::test]
async fn list_active_with_activity_orders_by_task_activity_over_created_at() {
// 回归(事故形状):项目 A created_at 较晚(创建序排前)但无任务/停更;项目 B
// created_at 较早但有一条 tasks.updated_at 最新 → 活跃序 B 排 A 前
// (任务活跃为主信号,治创建序误导 AI 把停摆项目当最高优先锚点)。
use crate::crud::task_repo::TaskRepo;
use crate::models::TaskRecord;
use df_types::types::TaskStatus;
let db = Database::open_in_memory().await.expect("open_in_memory");
let projects = ProjectRepo::new(&db);
let tasks = TaskRepo::new(&db);
// B 先建(早),A 后建(晚)——创建序会排 A 前
let mut early = prec("pb", "早建但活跃");
early.created_at = "1700000000000".to_string();
early.updated_at = "1700000000000".to_string();
let mut late = prec("pa", "晚建但停更");
late.created_at = "1700000010000".to_string();
late.updated_at = "1700000010000".to_string();
projects.insert(early).await.unwrap();
projects.insert(late).await.unwrap();
// B 挂一条最新任务;A 无任务 → B 活跃时间取任务 updated_at,A 回退自身 updated_at
let task = TaskRecord {
id: "tb".to_string(),
project_id: "pb".to_string(),
title: "B 的任务".to_string(),
description: String::new(),
status: TaskStatus::InProgress,
priority: 0,
branch_name: None,
assignee: None,
workflow_def_id: None,
base_branch: None,
review_rounds: 0,
output_json: None,
idea_id: None,
queue: "todo".to_string(),
parent_id: None,
content_json: None,
module_id: None,
archived: false,
created_at: "1700000000000".to_string(),
updated_at: "1790000000000".to_string(),
};
tasks.insert(task).await.unwrap();
let listed = projects.list_active_with_activity().await.unwrap();
assert_eq!(listed.len(), 2);
assert_eq!(listed[0].record.id, "pb", "任务活跃最新的早建项目应排前");
assert_eq!(listed[1].record.id, "pa", "无任务的晚建项目应排后");
assert_eq!(
listed[0].last_active_at, "1790000000000",
"活跃时间应取该项目任务 updated_at 最新值"
);
}
} }
@@ -0,0 +1,48 @@
# ai-chat 上下文管理与信息组织·完善设计(2026-10-18)
> 用户令:ai-chat agent 上下文管理/信息组织开发完善;回复别太口水话(2026-10-18)。
> 证据输入(问题全量论证在彼,此处只引编号不重复):`temp/深查-aichat对话质量复测-2026-10-17.md`(E1-E13)、`temp/深查-aichat信息UX-2026-10-17.md`(F1-F6)。
> 现状判定:10-04 三大病(上下文失控/反复压缩/终局缺失)基本治愈;残量集中在**恢复链污染、终局态半闭环、存量脏数据、信息可达性、输出纪律**五个结构性面。
## 一、信息流模型与缺口定位
链路:`发起(直发/inject) → 目标提取(pinned_goals) → 上下文组装(system+摘要+近期) → 执行循环 → 压缩(view/cache) → 恢复(recovery) → 投影(轮桶/轨迹卡) → 呈现(桌面/飞书)`
| 缺口 | 根因(结构性,非散点) | 归并的散点 |
|---|---|---|
| **G-A 恢复链身份未建模** | 恢复消息无类型标记,兼具「系统信号」与「用户输入」双重身份,被目标提取源再次吸收 | E1 套娃、E3 二次恢复、看板 649 行恢复目标完整性守卫 |
| **G-B 终局态半闭环** | boundary_json/loop_state 字段已建、写入闭环未建(填充率 0) | P2-5、E3 竞态窗口 |
| **G-C 写入不保数据语义** | 写入方各自为政,全量重写/双写不保留原义 | E11 created_at 重写污染 1750 条、E5 存量目标不迁移、E12 双写 |
| **G-D 信息可达性瓶颈** | 呈现层硬上限+折叠体内不可见 | F4-1 会话 50 上限(实测 115 条已击穿)、F1-3+F3-2 注入降级藏审批、F6-1 |
| **G-E 输出纪律缺失** | 聚焦准则管「答什么」,不管「怎么答」——主提示词无回复风格条款 | 用户口水话反馈(本次令);摘要提示词已有该纪律可对齐 |
| **G-F 阴性结论无守卫** | 工具 0 命中被当事实断言,无复核引导 | E6 假阴性 3 轮错判链 |
## 二、修复批次(领单视角,M1 先行)
### M1 · P1 上下文正确性
1. **E1+E3 恢复链治本(G-A)**:恢复消息加 source 标记(与看板 961② inject 标记同基建,复用 V52 source 字段);build_recovery_message 过滤 `[系统恢复]` 前缀目标;目标写入侧拒收同前缀。防二次恢复:快照全部目标=completed 时短路,或恢复后 N 分钟窗口禁重复。
2. **E11 created_at 保义(G-C)**:message_repo.rs:285 全量重写保留原 created_at(records 读取带出原值回写)。
3. **E6 阴性存疑(G-F)**:search_files/grep 0 命中时结果强制附「阴性存疑,建议复核路径/glob」标记(seq 1549 hint 雏形转正)。
4. **E4 跑题换装验证**:三源活跃度排序已在树(第五十三段),换装后重放 6a5a3e04 seq1802 场景验证。
### M2 · P2 上下文域
5. **E5 存量目标一次性迁移(G-C)**:active 目标命中「执行/搜索/查看+工具参数」形态或 `[系统恢复]`/`[补充指令]` 前缀 → 降级为非目标或重取首条任务消息。
6. **E2 压缩降级透出**:压缩失败兜底时前端状态条「上下文已降级」,禁静默。
7. **E13 超时连败收敛**:同命令超时连败 N 次转「换方案/问用户」分支(与看板 B5d 退避策略同族,合并实施)。
8. **P2-5 终局闭环(G-B)**:停靠/终局时填充 boundary_json/loop_state,不只落 status。
### M3 · P2/P3 信息组织域
9. **F4-1 会话可达性(G-D)**:列表 offset 游标分页+侧栏「加载更多」;搜索走后端 LIKE(title+消息内容)。
10. **F5-1+F5-2 飞书审批闭环(同根一改双收)**:决议词表归一(trim/剥标点/同义词,复用 normalize_halfwidth)+ 订阅 AiToolCallCompleted 推终态卡;pending 为空时决议回「已失效」提示而非静默放行。
11. **F1-3+F3-2 折叠体可达(G-D,同根)**:executing 判定改「桶内存在 running/pending 工具」;scrollToFirstPending 前按 data-trace-key 预展开含 pending 的轨迹卡。
### M4 · 输出纪律+UX 小批
12. **G-E 提示词输出纪律**:system_prompt_parts 行为准则追加「回复风格」段——结论先行直接给动作/结果;省略复述用户问题、客套开场、总结性收尾;要点优先于段落;用户没问的不展开。中英双语同步+测试断言(对齐 prompt.rs 既有测试范式)。注意别过度约束:需要解释时照常解释,反的是空话不是内容。
13. **UX 确定性小批**:F1-1 i18n 补键 / F1-2+F3-1 主题 token 化 / F2-1 aria-label / F4-2 loaded 标志 / F6-2+F6-3 Esc 关闭 / 看板尾部队列带图项标记(10-18 残留)。
## 三、验收口径
- **复测脚本复跑**(复用 `temp/复测-aichat质量-1017/` 脚本,timestamp 列口径):恢复消息套娃=0、created_at 污染增量=0、boundary_json 填充率>0(新停靠会话 100%)。
- **可达性**:115 条活跃会话全量可从侧栏到达;审批卡在任何折叠形态下 scrollToFirstPending 均可见。
- **输出纪律**:3 个真实会话抽查,开场复述/空收尾/无信息客套=0;结论仍在首屏。
- 每批销账附验收命令输出(G4 惯例)。
@@ -0,0 +1,132 @@
# DevFlow 布局样式大重构设计(2026-10-18)
> 依据:用户令「布局样式大重构,参考 D:\Downloads\u-agent」+「每页样式 DRY 提取统一定义」
> 输入:u-agent设计系统勘察-2026-10-18.md · 样式走查-1018/报告-布局全局审计.md · 报告-配色全局审计.md
> 原则:DRY 单一真值 · token 化 · 高密度(u-agent 13px 范式)· 双主题保留 · 紫 accent 品牌保留 · 视觉回归可控(dev 模式实时预览)
## 0. 现状诊断(三份勘察合并)
| 维度 | 现状 | u-agent 基准 | 差距 |
|---|---|---|---|
| 基准字号 | html 14px,aichat 已降 9-13,views 仍 11-14 | 13px 全局 | 功能页粗一档,密度断层 |
| 页头 | 三套并存(aichat 46px / Dashboard 18px 标题 / 功能页 24px h1 无固定高) | 46px 定高单行 | 全站统一为紧凑单行 |
| 侧栏 | 192px | 250-280px | 偏窄,功能页导航拥挤 |
| 按钮 | .btn 双基类分叉(global 34px vs settings 30px)+ 图标钮三档 | .cbtn 单基类 | 合一 30px |
| 徽章/tag | 圆角 3/4/6/8/10 五档并存;.df-tag 3px 字面量 | 小标签小圆角一档 | 收敛一档入 token |
| 圆角 token | 覆盖 75.5%,9 处 var 回退值写错(静默降档) | — | 修回退+字面量 97 处归 token |
| 间距 | 76.7% 收敛,7px×8/82px 手算对齐等离群 | 4px 刻度 | 离群归位+魔法数 token 化 |
| 字号 | 半像素 24 处(10.5/11.5/12.5)+17px 孤值 | 纯整数谱 | 归整 |
| 输入框 | 三档并存(21-22 / 26-27 / 30) | 30px 单档为主 | 行内搜索统一 26px 档 |
| 小节头 | 各页自造 | 9-10px uppercase mono 字距 统一范式 | 抽 .df-sec-h |
| 公共技法 | 无 | hairline 网格 kv 卡 / 发丝线行 / 染色两档 | 引入公共类 |
## 1. Token 层扩展(global.css :root,单一真值)
### 1.1 新增 token
```css
/* 字号谱(纯整数,对齐 u-agent) */
--df-fs-micro: 9px; /* 小节头/tag/计数 */
--df-fs-meta: 10px; /* 徽章/元数据 */
--df-fs-aux: 11px; /* 辅助文字/列表次级 */
--df-fs-ctrl: 12px; /* 控件文字/小按钮 */
--df-fs-body: 13px; /* 正文基准 */
--df-fs-title: 16px; /* 页头标题 */
/* 控件高度档 */
--df-h-btn: 30px; /* 主按钮(.btn 合一目标) */
--df-h-input: 26px; /* 行内输入/搜索 */
--df-h-modal-input: 30px;
--df-h-icon-btn: 26px; /* 图标钮统一档(22/26/28 收敛) */
/* 微内距暗刻度(chip/badge 族) */
--df-pad-chip: 1px 6px;
--df-pad-badge: 3px 8px;
/* 图标槽 */
--df-icon-gutter: 42px; /* ToolCard 图标槽(38/42 魔法数归一) */
/* 染色两档(语义色背景/边框透明度统一,双主题各配) */
/* 由 --df-*-bg(12% 底)+ 新增 --df-*-bd(30% 边)承担,消除散落 rgba 字面量 */
--df-success-bd / --df-warning-bd / --df-danger-bd / --df-info-bd / --df-accent-bd
```
### 1.2 修正既有错误
- 9 处 var 回退值写错(lg 8→10 / md 6→8 / xs 3→2):**删回退值**(token 必注入,回退是静默降档源)
- .df-tag 圆角 3px 字面量 → var(--df-radius-xs)
- body 基准 14px → 13px(line-height 1.5 保持);aichat 已对齐,功能页随页头波次跟进
## 2. 公共组件层(global.css/components.css 单一来源)
| 公共类 | 来源 | 定义去向 |
|---|---|---|
| `.btn` 族 | global+settings 双基类合一 30px/8px 16px/13px | global.css 唯一定义,settings.css 删副本 |
| `.df-sec-h` | u-agent 小节头范式(10px uppercase letter-spacing .5px mono tx3) | global.css 新增 |
| `.df-kv` / `.df-kv-i/k/v` | hairline 网格档案卡(gap:1px+bd 背景) | components.css 新增 |
| `.df-row` | 发丝线行(border-bottom+last-child none) | components.css 新增 |
| `.df-note` | 通知条(info/warning/danger 染色) | components.css 新增 |
| `.df-pill` | 状态胶囊(全圆+染色底) | components.css 新增 |
| `.df-tab` / `.df-tab--active` | 下划线 tab(2px accent 底线+计数 chip) | components.css 新增 |
| 既有 `.df-dot/.df-badge/.df-tag/.df-mono/.df-hstat` | 第五十四段已注入 | 保留,随 1.2 修圆角 |
## 3. 页面适配波(DRY 提取:各页 scoped 重复样式→公共类)
- **页头统一**:功能页 8 页 + Dashboard 全部改 `.page-header` 紧凑单行(h1 16px/500 + 定高 46px 等价 padding + header-actions gap 8px),删各页自造页头样式
- **侧栏 192→220px**(AppSidebar 一处)
- **输入框**:GitChanges/Provider 行内 21-22px → var(--df-h-input)
- **列表/详情页**:status-tag/status-* 徽章族(components.css 已有 13 个状态色)染边补齐 + 圆角统一;Details 页 kv 区改 .df-kv;tab 行改 .df-tab
- **settings 族**:settings.css .btn 副本删除并轨;面板内重复 card/row 样式提取
- **ai 族**(已对齐 workbench):仅扫尾——圆角字面量 9px 气泡入注释锚定、7px 代码块归 token、tag 圆角收敛
- **离群修复**:7px 间距→6/8、ProviderPanel 82px 手算对齐改结构、26px 图标位 calc、FilePreview outline-name 补 nowrap(确定 bug)、定宽输入/浮层补 max-width
## 4. 实施波次(文件零交集,逐波门禁 vue-tsc + 目检)
| 波 | 内容 | 文件面 |
|---|---|---|
| R0 底座 | token 扩展+回退修正+公共类新增+.btn 合一+body 13px | styles/global.css + components.css + settings/settings.css |
| R1 功能页族 | Projects/Tasks/Ideas/Knowledge/AuditLog 页头+密度+tag 收敛 | views/*.vue(5 页可再拆并行) |
| R2 详情页族 | ProjectDetail/TaskDetail/IdeaDetail(kv/tab/徽章/页头) | 3 个 Detail.vue 可并行 |
| R3 设置族 | settings.css 并轨+面板 DRY 提取 | components/settings/* |
| R4 ai 扫尾+杂项 | 圆角/token 扫尾+离群修复+FilePreview bug | components/ai/* + 杂项 |
| R5 配色收口 | 按配色审计报告优先级表 10 项实施(报告 temp/样式走查-1018/报告-配色全局审计.md):①幽灵 token 清零(含 --df-bg-secondary 等 6 处声明失效真 bug)②.status-* 徽章系 token 三件套③白叠层 64 处入 token(--df-hover/--df-zebra 浅色覆写黑叠层)④回退值 111 处全删⑤global.css 边框 rgba 改 color-mix⑥--df-neutral-bg⑦views 族 rgba 清零⑧--df-shadow-sm/md⑨alpha 收敛⑩豁免注释 | 按报告分布;R5 先补 token(叠层/中性/阴影)再批量替换 |
每波:前台同步代理实施 → 主代理 diff 核查 + vue-tsc → dev 窗口目检(用户可实时看)。R0 先行(其他波依赖新 token/类),R1-R4 在 R0 后并行。
## 5. 拍板点(按推荐值先行,用户可回改)
1. **基准字号 13px**(功能页降一档,信息密度对齐 u-agent;若觉偏小回 14 仅改一处 token 层 body 声明)
2. **侧栏 220px**(192→220 折中,非 250)
3. **页头 16px 标题+紧凑单行**(废 24px 大标题)
4. **按钮 30px 主档**(对齐 settings 既有 30px 而非 global 34px)
5. tag/badge 圆角统一 xs(2px)/sm(4px) 档
## 6. 单文件拆分轨([补4],与样式波错峰)
行数实测(2026-10-18):MessageList 3297 / ProjectDetail 1750 / TopBar 1700 / Tasks 1540 / ChatInput 1503 / IdeaDetail 1228 / ConversationSidebar 1226 / TaskDetail 1160 / AiChat 1145 / FilePreview 1144 / ProviderPanel 964 / FileExplorer 932 / ToolResultBody 895。
**拆分纪律**:
- 纯拆分不改行为——样式/逻辑原样搬迁,验收=vue-tsc 0 + 构建过 + dev 窗口目检无视觉回归
- 拆分边界按「区块自治」(模板区块+配套样式+相关逻辑成组),优先抽展示型子组件;共享状态经 props/emits 或既有 composable,不新造 store
- **与样式波互斥调度**:同一文件的样式适配与拆分不并行(样式先行,拆分在后——拆完再改样式要重新定位锚点)
- 拆分批次(样式波收口后启动,每批文件零交集):
- C1 ai 族:MessageList(3297→消息项/工具卡区/折叠条带等子件) → ChatInput(1503) → TopBar(1700)
- C2 项目族:ProjectDetail(1750) → FilePreview(1144) → FileExplorer(932)
- C3 任务/想法族:Tasks(1540) → TaskDetail(1160) → IdeaDetail(1228)
- C4 侧栏+设置族:ConversationSidebar(1226) → AiChat(1145) → ProviderPanel(964) → ToolResultBody(895)
- 每文件拆分目标:主文件 ≤600 行,子件单一职责
## 7. 整洁性轨(用户令 2026-10-18:代码整洁性全量处理+样式代码统一抽取,[补1] 共享的样式才抽取)
探针实测(dead-style-scan.json / dup-style-scan.json,脚本在 temp/样式走查-1018/):
- 死样式候选 368 处 / 56 文件(MessageList 34/ToolCard 25/TopBar 20/ActiveProjectsPanel 19 领衔);**假阳性规则**:Vue transition 生成类(xxx-enter/leave/from/to/active 由 `<transition name="xxx">` 隐式消费,非死)、动态拼接类(`'status-' + s`)、子组件透传类——删前须逐处验证
- 跨文件共享重复规则 49 条;典型双轨:`.ai-toast-*`(AiChat/ApprovalPopup)与 `.toast-*`(Knowledge/Settings)同义共存;`.confirm-actions`×3;`@keyframes spin/shimmer` 10/3 文件各写一份
**底座已落**(主代理亲码 global.css):`.df-toast` 四色族+过渡 / `@keyframes df-spin`/`df-shimmer` / `.df-confirm-actions`+过渡 / `.df-diff-pre` 族。
**D 批分路**(R5 收口后启动,文件族零交集,每路两件事:本族死样式验证删除 + 本族共享类消费替换):
- D-A ai 族+根组件(MessageList/ToolCard/TopBar/ConversationSidebar/ChatInput/ToolResultBody/AiChat/ToolCardList):死样式 100+ 处 + ai-toast 族消费 + spin/shimmer keyframes 消费 + .ai-tool-diff-pre 族并轨 .df-diff-pre
- D-B views+project 族(Knowledge/ApprovalPopup/Settings/Projects/ProjectDetail/Tasks/AuditLog/FilePreview/FileExplorer/GitChanges/ProjectCard):死样式 100+ 处 + .toast-* 族消费 + confirm-actions 消费
- D-C settings+layout+dashboard+knowledge 族(AdvancedSection/AllowedDirsPanel/UpdateBadge/ActiveProjectsPanel/KnowledgeDetail 等):死样式残余 + 确认弹层消费
- D4 TS/模板整洁(随各路顺带):未用 import/变量(vue-tsc noUnusedLocals 级)、console.log 残留、死模板分支——纯删不改语义
**验收纪律**:每路 vue-tsc 0 + grep 证据(死样式删除数/共享类消费数);transition 类假阳性必须 grep `<transition name=` 确认后再删。
@@ -0,0 +1,30 @@
# 飞书通道 WS 假活:探活只告警不自愈
> 登记: AI-Ops 2026-10-11 22:15 · 来源: 用户 @ bot 零回应事故排查 · 实施归 devflow agent
## 现象
用户 20:07 后在飞书 @ bot 发消息,零回应。feishu-channel.log 尾部停在 20:07 「打包换装」watcher 终版,其后 2h+ 零「收到消息」事件——消息根本未达应用,非模型/会话层问题。
## 证据
- 日志: `~/AppData/Roaming/top.1216.devflow/feishu-channel.log`
- 累计 90 条探活告警「660s 无任何事件且无在途会话(疑似假活,持续出现请重启应用重建连接)」,跨 10-05~10-11 多日分布,连接时好时坏
- 时间线: 14:00 前持续告警 → 20:04-20:07 恢复(收到 4 条消息正常受理+终版) → 20:07 起再断,至 22:12 仍零入站,进程未重启(devflow.exe PID 14172 同前)
- 应用本身健康: trace.log 持续输出, B5 引擎「🟢 健康,空闲」
- 对照: u-claw 曾有同款(热重建不关旧连接致僵尸 WS,closeGraceful 须显式 Close),见 u-claw 记忆 uclaw-zombie-ws-connection
## 根因方向
WS 长连接假活: 探活任务已检测到「无事件+无在途」但仅打日志,无自动重建连接动作,恢复依赖新消息触发或人工重启。为何 20:04 能自愈一次、20:07 后不能,需读 SDK 连接层确认(是否依赖入站流量触发重连)。
## 修复建议
1. 探活告警连续 N 次(如 2 次,约 20 分钟)→ 主动断开并重建 WS 连接(显式 Close 旧连接防僵尸),重建结果写日志
2. 重建失败退避重试,持续失败升级通知(桌面通知/卡片)
3. 复核 90 条告警的历史分布,确认是否存在更早未被用户察觉的静默窗口
## 排除项
- 97「收到消息」vs 47「受理返回」差值: 新旧版本日志口径混杂(受理返回为后加日志),受理守卫拒绝仅 2 条且走旧「AI 正在生成中」路径,无消息丢失
- watcher 终版无「回复」行: 新版投递走卡片原地更新(edit_card),非回复消息,属正常
+19
View File
@@ -756,3 +756,22 @@
961. [~] **桌面轮次交互定位重定义(2026-10-11 用户拍板,补7 三条)**:①轨迹卡片收敛:除主回复气泡外交互收敛到一张「有动态+可折叠」的轨迹卡(现有轮次折叠类型),**修缺陷:正生成时卡片展开不了**;②轮次语义纠正:现「压缩后即新轮次」定位错——正确定义=**一次信息发起=一个任务轮次,中途补充信息(inject)仍属同一轮,全部完成后新发起才是新轮**;③轮次编号稳定化:现编号不稳定(刚是 5 一会下面又出现 1)——应固定为「该对话的第 1 轮/第 2 轮」持久编号(与消息 seq/轮边界锚点绑定,不随视图压缩/折叠漂移)。 961. [~] **桌面轮次交互定位重定义(2026-10-11 用户拍板,补7 三条)**:①轨迹卡片收敛:除主回复气泡外交互收敛到一张「有动态+可折叠」的轨迹卡(现有轮次折叠类型),**修缺陷:正生成时卡片展开不了**;②轮次语义纠正:现「压缩后即新轮次」定位错——正确定义=**一次信息发起=一个任务轮次,中途补充信息(inject)仍属同一轮,全部完成后新发起才是新轮**;③轮次编号稳定化:现编号不稳定(刚是 5 一会下面又出现 1)——应固定为「该对话的第 1 轮/第 2 轮」持久编号(与消息 seq/轮边界锚点绑定,不随视图压缩/折叠漂移)。
- ✅ **①已修(2026-10-11)**:执行中 step 卡支持点击展开(复用 expandedTraceIds,key 与完成态 trace 同构,执行中展开→完成转 trace 态不丢;展开区实时渲染该轮过程工具卡)。 - ✅ **①已修(2026-10-11)**:执行中 step 卡支持点击展开(复用 expandedTraceIds,key 与完成态 trace 同构,执行中展开→完成转 trace 态不丢;展开区实时渲染该轮过程工具卡)。
- **②③设计要点(实施前拍板)**:轮边界判定锚点从「压缩摘要」改为「用户发起消息」——发起=桌面直发/飞书入站的 user 消息,补充=inject_runtime_message 写入的消息(需来源标记,建议复用 V52 source:{channel:"inject"} 与发起区分,归属判定 O(1));轮号=conv 内第 N 条「发起消息」序(数据派生,天然稳定,不随压缩/视图漂移),轨迹卡头/导航条/进度徽标统一取该口径(单一真值来源)。涉及:轮桶分桶逻辑(MessageList genBucketItems 上游)+轮号计算函数收敛+inject 消息 source 标记。 - **②③设计要点(实施前拍板)**:轮边界判定锚点从「压缩摘要」改为「用户发起消息」——发起=桌面直发/飞书入站的 user 消息,补充=inject_runtime_message 写入的消息(需来源标记,建议复用 V52 source:{channel:"inject"} 与发起区分,归属判定 O(1));轮号=conv 内第 N 条「发起消息」序(数据派生,天然稳定,不随压缩/视图漂移),轨迹卡头/导航条/进度徽标统一取该口径(单一真值来源)。涉及:轮桶分桶逻辑(MessageList genBucketItems 上游)+轮号计算函数收敛+inject 消息 source 标记。
# 产品方向定位:执行 agent 运行到远程容器(2026-10-18 用户口述,设计先行未实施)
- **定位**:DevFlow 未来形态=执行 agent 跑在远程容器(本机只做控制面/交互面),对齐 u-claw 分身实例形态——桌面端发起任务→远程容器内 agent 全权执行→结果回传。收益:长任务不占本机/环境隔离/多实例并行/24h 无人值守天然成立。
- **衔接存量**:df-tunnel/u-relay 线(v3 wire 协议+ws 隧道,已在树)正是传输底座;TaskBoundary 无人值守体系(边界内自主)是权限面底座;两者拼合即远程执行骨架。
- **待设计问题**(立项时展开):远程执行体的工具面裁剪(本机路径语义如何映射)/媒体与文件存储归属(远程落盘 vs 回传)/审批与边界在远程侧的执行点/凭据注入方式/断线重连与会话恢复/多容器池调度。
- **本条为方向登记,实施等用户令。**
- [ ] 队列带图项零标记(2026-10-18 走查残留):队列行渲染在 AiChat.vue:81-115,带图队列项无图标记;与 F3-2(ToolCardList scrollToFirstPending 预展开)同批处理。
### 💡 2026-10-18 ai-chat 上下文管理与信息组织完善(设计已定,按批领单)
> 用户令「上下文管理/信息组织开发完善+回复别太口水话」。蓝图:[02-架构设计/专项设计/ai-chat上下文管理与信息组织完善设计-2026-10-18.md](../02-架构设计/专项设计/ai-chat上下文管理与信息组织完善设计-2026-10-18.md);证据:temp/深查-aichat对话质量复测-2026-10-17.md(E系)+temp/深查-aichat信息UX-2026-10-17.md(F系)。M1 为 P1 先行,条目锚点/修法/验收全在设计文档,此处只列索引。
- [x] M1-P1① 恢复链治本:恢复消息 source 标记+[系统恢复]目标双侧过滤+防二次恢复(E1/E3;与 961② 同基建,可并 649 行旧条销账)——✅ 验收:cargo test -p devflow --lib recovery **6 passed**(zero_nesting_with_polluted_goals/all_polluted_falls_back/drops_recovery_artifacts_idempotent 等);conversation.rs:415 双侧过滤+单点拦截在位
- [x] M1-P1② message_repo 全量重写保留原 created_at(E11;污染存量 1750 条不回刷,止增量即可)——✅ 验收:cargo test -p df-storage **14 passed** 含 replace_conversation_preserves_created_at ok
- [x] M1-P1③ search_files/grep 0 命中「阴性存疑」标记转正(E6)——✅ 22:11 AI-Ops 子代理补齐:file.rs negative_hit_hint 共享函数+grep/search_files 两处接入;验收:negative_hit_hint_states_doubt_and_scope ok
- [~] M1-P1④ 跑题修复换装验证(E4;修复在树,换装后重放 6a5a3e04 seq1802 验证)——**已在工作区实施待验收**(prompt.rs list_active_with_activity 三源活跃度排序+指纹缓存对齐;验证方式:跑 dev 后重放场景)
- [ ] M2 存量目标一次性迁移/压缩降级前端透出/超时连败收敛(并 B5d)/boundary_json+loop_state 写入闭环(E5/E2/E13/P2-5)
- [ ] M3 会话 offset 分页+后端搜索/飞书审批决议词归一+终态卡/executing 桶内活性判定+审批预展开(F4-1/F5-1+2/F1-3+F3-2)
- [x] M4-a 提示词回复风格纪律(反口水话,中英双语+测试断言)——✅ 22:11 AI-Ops 子代理补齐:prompt.rs 中英两版行为准则各加「回复风格/Response style」条款(结论先行/省客套复述收尾/要点优先/没问不展开/「省的是空话不是内容」);验收:system_prompt_zh/en_has_response_style_clause 2 passed(共 5 passed)
- [ ] M4-b UX 小批(i18n 补键/token 化/aria/loaded/Esc/队列带图标记)——未动,留板
- [ ] **收尾令(用户 2026-10-18 21:41 飞书下达到 AI-Ops,转登记)**:M1 销账后——①按 G3 提交本批改动并 push origin main(推送令已拍板,限本批范围);②启动 dev 模式运行验证(重点验 M4 反口水话与 M1 恢复链);③完成信息经飞书推送用户。若 AI-Ops 监测到 M1 已销账而本条未执行,AI-Ops 代执行。
+10
View File
@@ -0,0 +1,10 @@
# 探测本机正在运行的 DevFlow 进程及其版本(只读)
$p = Get-Process devflow -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Path
if ($p) {
$v = (Get-Item $p).VersionInfo
Write-Host "PATH=$p"
Write-Host "FileVersion=$($v.FileVersion)"
Write-Host "ProductVersion=$($v.ProductVersion)"
} else {
Write-Host "NO_DEVFLOW_PROCESS"
}
+33
View File
@@ -0,0 +1,33 @@
# 校验 updater 验签密钥配对(终版): 比对 keyid(KEYNUM 8字节) —— minisign 格式对齐
# conf.pubkey blob(42B): SIGALG"Ed"[0..2] + KEYNUM[2..10] + PUBKEY[10..42]
# 私钥文件 blob(116B): SIGALG"Rs"[0..2] + KDFALG[2..4] + CKSUM[4..12] + SALT[12..28] + OPS[28..36] + MEM[36..44] + KEYNUM[44..52] + SIG[52..116]
$confPath = "E:\wk-lab\devflow\src-tauri\tauri.conf.json"
$keyPath = Join-Path $env:USERPROFILE ".tauri\devflow.key"
# 1. conf 侧: 提取 pubkey → 解码 → 取 KEYNUM
$raw = Get-Content $confPath -Raw
if ($raw -match '"pubkey"\s*:\s*"([A-Za-z0-9+/=]{40,400})"') { $confPubB64 = $Matches[1] } else { Write-Host "CONF_PUBKEY_NOT_FOUND"; exit 1 }
# conf.pubkey 是 base64(minisign .pub 文件文本),需二次解码取末行
$confText = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($confPubB64))
$pubLines = @($confText -split "`n" | Where-Object { $_.Trim() -and $_ -notmatch 'comment' } | ForEach-Object { $_.Trim() })
if ($pubLines.Count -lt 1) { Write-Host "CONF_PUB_FORMAT_UNEXPECTED"; exit 1 }
$confBlob = [Convert]::FromBase64String($pubLines[0])
$confKeynum = ($confBlob[2..9] | ForEach-Object { $_.ToString("x2") }) -join ""
Write-Host "conf keyid : $confKeynum (blob $($confBlob.Length)B)"
# 2. key 侧: 私钥文件 = 注释行 + 1 条 b64 blob(KEYNUM 未加密,明文可读)
if (-not (Test-Path $keyPath)) { Write-Host "KEY_NOT_FOUND: $keyPath"; exit 1 }
$b64Lines = @(Get-Content $keyPath | Where-Object { $_ -and $_ -notmatch 'comment' } | ForEach-Object { $_.Trim() })
if ($b64Lines.Count -lt 1) { Write-Host "KEY_FORMAT_UNEXPECTED"; exit 1 }
$secBlob = [Convert]::FromBase64String($b64Lines[0])
$secKeynum = ($secBlob[44..51] | ForEach-Object { $_.ToString("x2") }) -join ""
Write-Host "key keyid : $secKeynum (blob $($secBlob.Length)B)"
# 3. 配对判定
if ($confKeynum -eq $secKeynum) {
Write-Host "MATCH - updater 验签密钥配对正确(keyid $confKeynum), B3 安装验签可通过"
exit 0
} else {
Write-Host "MISMATCH - tauri.conf.json 的 pubkey 与签名私钥不配对, B3 安装验签将失败!"
exit 1
}
+58
View File
@@ -0,0 +1,58 @@
# 发布收尾:杀挂起脚本 -> 手动签名 0.1.3 -> latest.json -> 上传 -> 远端验证
$ErrorActionPreference = "Stop"
$repo = "E:\wk-lab\devflow"
$nsis = "$repo\target\release\bundle\nsis"
$exe = "$nsis\devflow_0.1.3_x64-setup.exe"
$key = "$env:USERPROFILE\.tauri\devflow.key"
$site = "suke-dev"
$remoteDir = "/var/www/app-site/download/devflow"
$baseUrl = "https://app.1216.top/download/devflow"
$notes = "版本更新与自动升级全链路上线:设置页新增「关于」,支持应用内检查/下载/安装更新"
# 1. 杀挂起的发布脚本与构建残留
Get-Process -Id 14328,2008,26208,28276,19412 -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Write-Host "[1/5] 挂起进程已清理"
# 2. 手动签名(key 文件内容经 env 传入——-k/ev 传路径会被当 base64 解码,报 Invalid symbol 58)
Set-Location $repo
$env:TAURI_SIGNING_PRIVATE_KEY = (Get-Content $key -Raw).Trim()
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = ""
cmd /c "cargo tauri signer sign -p `"`" --app-version 0.1.3 `"$exe`" < NUL 2>&1"
if ($LASTEXITCODE -ne 0) { Write-Host "[失败] 签名"; exit 1 }
$sigPath = "$exe.sig"
if (-not (Test-Path $sigPath)) { Write-Host "[失败] .sig 未生成"; exit 1 }
Write-Host "[2/5] 签名完成: $sigPath"
# 3. 生成 latest.json(UTF-8 无 BOM,防 PS5.1 BOM 坑)
$sig = (Get-Content $sigPath -Raw).Trim()
$pubDate = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
$latestJson = [ordered]@{
version = "0.1.3"
notes = $notes
pub_date = $pubDate
platforms = [ordered]@{
"windows-x86_64" = [ordered]@{
signature = $sig
url = "$baseUrl/devflow_0.1.3_x64-setup.exe"
}
}
} | ConvertTo-Json -Depth 5
$latestPath = "$nsis\latest.json"
[System.IO.File]::WriteAllText($latestPath, $latestJson, (New-Object System.Text.UTF8Encoding($false)))
Write-Host "[3/5] latest.json 已生成 (version=0.1.3)"
# 4. 上传三件套
$env:MSYS_NO_PATHCONV = "1"
ssh-proxy exec -n $site -c "mkdir -p $remoteDir"
foreach ($f in @($exe, $sigPath, $latestPath)) {
$name = Split-Path $f -Leaf
Write-Host "[4/5] 上传 $name ..."
ssh-proxy upload --name $site --src $f --dst "$remoteDir/$name"
if ($LASTEXITCODE -ne 0) { Write-Host "[失败] 上传 $name"; exit 1 }
}
# 5. 远端验证
Write-Host "[5/5] 远端清单验证:"
ssh-proxy exec -n $site -c "ls -la $remoteDir | grep 0.1.3; head -c 200 $remoteDir/latest.json"
Write-Host ""
Write-Host "[发布完成] v0.1.3 清单地址: $baseUrl/latest.json"
+25
View File
@@ -0,0 +1,25 @@
# 后台启动 publish-release.ps1(tauri build 10 分钟级,run_command 600s 上限装不下)
# 用法: run_command 执行本文件 -> 立即返回 pid -> 之后轮询 release-out.log
$repo = 'E:\wk-lab\devflow'
$log = "$repo\target\release-out.log"
$errl = "$repo\target\release-err.log"
# 清掉上次 600s 超时可能残留的构建进程,防 cargo 构建锁互等
$killed = Get-Process cargo,cargo-tauri,rustc -ErrorAction SilentlyContinue
if ($killed) {
$killed | Stop-Process -Force
Write-Host ("清理残留构建进程: " + (($killed | Select-Object -ExpandProperty Id) -join ','))
} else {
Write-Host "无残留构建进程"
}
Remove-Item $log,$errl -ErrorAction SilentlyContinue
$p = Start-Process -FilePath 'powershell.exe' `
-ArgumentList @('-NoProfile','-ExecutionPolicy','Bypass','-File',"$repo\scripts\publish-release.ps1") `
-WorkingDirectory $repo `
-NoNewWindow `
-RedirectStandardOutput $log `
-RedirectStandardError $errl `
-PassThru
Set-Content -Path "$repo\target\release-pid.txt" -Value $p.Id -Encoding ascii
Write-Host "release started, pid=$($p.Id), log=$log"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "devflow" name = "devflow"
version = "0.1.2" version = "0.1.3"
description = "DevFlow Desktop App" description = "DevFlow Desktop App"
authors = [""] authors = [""]
edition = "2021" edition = "2021"
@@ -232,14 +232,24 @@ pub async fn ai_conversation_create(
/// ///
/// 截断按组独立:活跃/归档各自取 limit,归档项不挤占活跃名额(侧栏归档分组数据源依赖 /// 截断按组独立:活跃/归档各自取 limit,归档项不挤占活跃名额(侧栏归档分组数据源依赖
/// include_archived=true,见 useAiConversations.loadConversations)。 /// include_archived=true,见 useAiConversations.loadConversations)。
///
/// F4-1(2026-10-17)分页:active_offset/archived_offset 按组跳过前 N 条(默认 0=第一页,
/// 旧调用方零改动)。治「会话列表+搜索硬上限 50」——实测 115 条活跃主会话 57% 在桌面
/// 端零入口;侧栏首屏仍一页(50/组)保启动性能,「加载更多」按 offset 续拉,搜索前前端
/// 逐页拉满(搜索跑在已加载列表上,截断列表=搜索失灵)。offset 超组长度返回该组空页
/// (自然收敛,无需显式 has_more 字段:页内某组满额 limit 即可能还有下一页)。
#[tauri::command] #[tauri::command]
pub async fn ai_conversation_list( pub async fn ai_conversation_list(
state: State<'_, AppState>, state: State<'_, AppState>,
limit: Option<usize>, limit: Option<usize>,
include_archived: Option<bool>, include_archived: Option<bool>,
active_offset: Option<usize>,
archived_offset: Option<usize>,
) -> Result<Vec<serde_json::Value>, String> { ) -> Result<Vec<serde_json::Value>, String> {
let limit = limit.unwrap_or(50); let limit = limit.unwrap_or(50);
let include_archived = include_archived.unwrap_or(false); let include_archived = include_archived.unwrap_or(false);
let active_offset = active_offset.unwrap_or(0);
let archived_offset = archived_offset.unwrap_or(0);
let records = state.ai_conversations.list_all().await.map_err(err_str)?; let records = state.ai_conversations.list_all().await.map_err(err_str)?;
// list_all 已按 created_at DESC(最新在前);默认排除归档 + 截断 limit。 // list_all 已按 created_at DESC(最新在前);默认排除归档 + 截断 limit。
// origin 非空(子代理轨迹,V44)不进侧栏列表——轨迹在库可追溯,展示面只留主会话。 // origin 非空(子代理轨迹,V44)不进侧栏列表——轨迹在库可追溯,展示面只留主会话。
@@ -273,20 +283,25 @@ pub async fn ai_conversation_list(
"loop_state": r.loop_state, "loop_state": r.loop_state,
}) })
}).collect(); }).collect();
// 分组截断:活跃/归档各自独立取 limit,防归档项挤占活跃名额(前端侧栏活跃列表被截空)。 Ok(paginate_by_group(summaries, limit, active_offset, archived_offset))
// 原单 take(limit) 在 include_archived=true 时归档项混排会占满 50 名额。 }
let mut active = Vec::with_capacity(limit);
let mut archived = Vec::with_capacity(limit); /// F4-1:摘要按组独立分页——活跃/归档各自 skip(offset)+take(limit),活跃在前归档在后,
for s in summaries { /// 组内保持传入原序(created_at DESC)。offset=0 与旧「分组截断」口径逐字节等价
if s.get("archived").and_then(|v| v.as_bool()) == Some(true) { /// (回归保护见 paginate_first_page_matches_legacy_grouped_truncation)。
if archived.len() < limit { archived.push(s); } /// 抽纯函数供单测:分组正确性/offset 续拉/越界空页/归档不挤占活跃名额。
} else if active.len() < limit { fn paginate_by_group(
active.push(s); summaries: Vec<serde_json::Value>,
} limit: usize,
} active_offset: usize,
// 活跃在前(侧栏主区),归档在后(归档分组);各自保持 created_at DESC 原序。 archived_offset: usize,
active.extend(archived); ) -> Vec<serde_json::Value> {
Ok(active) let (active, archived): (Vec<_>, Vec<_>) = summaries
.into_iter()
.partition(|s| s.get("archived").and_then(|v| v.as_bool()) != Some(true));
let mut page: Vec<serde_json::Value> = active.into_iter().skip(active_offset).take(limit).collect();
page.extend(archived.into_iter().skip(archived_offset).take(limit));
page
} }
/// B3(无人值守可靠性专项):列出可恢复会话(loop_state='parked')。 /// B3(无人值守可靠性专项):列出可恢复会话(loop_state='parked')。
@@ -391,11 +406,25 @@ pub(crate) async fn recover_parked_inner(
.await .await
} }
/// 恢复产物前缀:恢复链自身生成的引导消息以它开头(恢复产物非用户意图,任何情况下
/// 都不该作为有效目标回放——2026-10-15 目标语义重构约定)。递归套娃根因:恢复消息
/// 经 begin_turn(chat.rs:950/2461)被记为 WorkingContext Active 目标落库,下次恢复
/// 回放时被当有效目标嵌套进新恢复消息,逐层加深(实证 conv 76730ce8 seq 250:
/// 目标文本=上一条恢复消息原文截 200 字符)。防线收敛在恢复链单点:
/// parse_pinned_goals 反解剔除 + build_recovery_message 回放剔除,同判据。
pub(crate) const RECOVERY_ARTIFACT_PREFIX: &str = "[系统恢复]";
/// 恢复产物判定:目标文本以恢复前缀开头即恢复链自产物,不作为有效目标。
fn is_recovery_artifact(text: &str) -> bool {
text.starts_with(RECOVERY_ARTIFACT_PREFIX)
}
/// 目标快照:按最终有效意图生成 parked 恢复引导消息。 /// 目标快照:按最终有效意图生成 parked 恢复引导消息。
/// ///
/// 「按快照续不重放历史目标流」:取 WorkingContext.goals 与 pinned_goals 中仍 Active 的 /// 「按快照续不重放历史目标流」:取 WorkingContext.goals 与 pinned_goals 中仍 Active 的
/// 目标 + unresolved 未解项;中途被调整作废(Cancelled)或已完成(Completed)的目标不复活。 /// 目标 + unresolved 未解项;中途被调整作废(Cancelled)或已完成(Completed)的目标不复活;
/// 快照全空(旧会话无快照)回退 [`PARKED_RECOVERY_MESSAGE`],行为同今日。 /// 恢复产物([系统恢复] 前缀)剔除——回放它即递归套娃,历史污染目标在此单点拦截。
/// 快照全空(旧会话无快照/全被过滤)回退 [`PARKED_RECOVERY_MESSAGE`],行为同今日。
/// 不另立存储:快照即 working_context_json + pinned_goals 两列的语义化读取(单一真值来源)。 /// 不另立存储:快照即 working_context_json + pinned_goals 两列的语义化读取(单一真值来源)。
pub(crate) fn build_recovery_message( pub(crate) fn build_recovery_message(
working_context: &df_ai::context_helpers::WorkingContext, working_context: &df_ai::context_helpers::WorkingContext,
@@ -405,12 +434,18 @@ pub(crate) fn build_recovery_message(
let mut seen = std::collections::HashSet::new(); let mut seen = std::collections::HashSet::new();
let mut active: Vec<&str> = Vec::new(); let mut active: Vec<&str> = Vec::new();
for g in &working_context.goals { for g in &working_context.goals {
if matches!(g.status, GoalStatus::Active) && seen.insert(g.text.clone()) { if matches!(g.status, GoalStatus::Active)
&& !is_recovery_artifact(&g.text)
&& seen.insert(g.text.clone())
{
active.push(&g.text); active.push(&g.text);
} }
} }
for g in pinned_goals { for g in pinned_goals {
if matches!(g.status, crate::commands::ai::GoalStatus::Active) && seen.insert(g.text.clone()) { if matches!(g.status, crate::commands::ai::GoalStatus::Active)
&& !is_recovery_artifact(&g.text)
&& seen.insert(g.text.clone())
{
active.push(&g.text); active.push(&g.text);
} }
} }
@@ -442,7 +477,8 @@ pub(crate) fn build_recovery_message(
/// pinned_goals 落库反解(新旧格式兼容):新格式 [{text,status}] 保 status, /// pinned_goals 落库反解(新旧格式兼容):新格式 [{text,status}] 保 status,
/// 旧格式 ["text"] 转 Active;非数组/坏 JSON 一律空(降级不炸)。switch 恢复与 /// 旧格式 ["text"] 转 Active;非数组/坏 JSON 一律空(降级不炸)。switch 恢复与
/// parked 恢复共用(DRY,单一事实源)。 /// parked 恢复共用(DRY,单一事实源)。恢复产物([系统恢复] 前缀)剔除——存量
/// 污染目标不进内存,switch 载入后下轮 save 重写 pinned_goals 即自愈落库。
pub(crate) fn parse_pinned_goals(raw: Option<&str>) -> Vec<crate::commands::ai::GoalEntry> { pub(crate) fn parse_pinned_goals(raw: Option<&str>) -> Vec<crate::commands::ai::GoalEntry> {
let parsed: Option<serde_json::Value> = raw.and_then(|s| serde_json::from_str(s).ok()); let parsed: Option<serde_json::Value> = raw.and_then(|s| serde_json::from_str(s).ok());
match parsed { match parsed {
@@ -468,6 +504,7 @@ pub(crate) fn parse_pinned_goals(raw: Option<&str>) -> Vec<crate::commands::ai::
Some(crate::commands::ai::GoalEntry::new(text)) Some(crate::commands::ai::GoalEntry::new(text))
} }
}) })
.filter(|e| !is_recovery_artifact(&e.text))
.collect(), .collect(),
_ => vec![], _ => vec![],
} }
@@ -1477,6 +1514,73 @@ mod tests {
assert_eq!(back.timestamp, Some(123)); assert_eq!(back.timestamp, Some(123));
} }
// ============================================================
// F4-1 会话列表分页(paginate_by_group:活跃/归档各自 offset+limit)
// ============================================================
fn conv_val(id: &str, archived: bool) -> serde_json::Value {
serde_json::json!({ "id": id, "archived": archived })
}
/// 首页(offset=0)与旧「分组截断」口径等价:各组前 limit 条,活跃在前归档在后。
#[test]
fn paginate_first_page_matches_legacy_grouped_truncation() {
// 60 活跃 + 60 归档,limit 50:旧口径各取 50(归档不挤占活跃名额)
let summaries: Vec<_> = (0..60).map(|i| conv_val(&format!("a{i}"), false))
.chain((0..60).map(|i| conv_val(&format!("r{i}"), true)))
.collect();
let page = paginate_by_group(summaries, 50, 0, 0);
assert_eq!(page.len(), 100, "各组独立取满 50");
assert!(page.iter().take(50).all(|s| s["archived"] == false), "前 50 全活跃");
assert!(page.iter().skip(50).all(|s| s["archived"] == true), "后 50 全归档");
assert_eq!(page[0]["id"], "a0");
assert_eq!(page[49]["id"], "a49");
assert_eq!(page[50]["id"], "r0");
assert_eq!(page[99]["id"], "r49");
}
/// offset 续拉:第二页从各组 offset 处继续,两组独立推进互不影响
/// (115 活跃场景:第一页 a0..a49,第二页 active_offset=50 拉 a50..a99)。
#[test]
fn paginate_offset_advances_each_group_independently() {
let summaries: Vec<_> = (0..115).map(|i| conv_val(&format!("a{i}"), false))
.chain((0..3).map(|i| conv_val(&format!("r{i}"), true)))
.collect();
// 第二页:活跃 offset 50(满页 50 条),归档 offset 0(仅 3 条全回)
let page2 = paginate_by_group(summaries.clone(), 50, 50, 0);
assert_eq!(page2.len(), 53);
assert_eq!(page2[0]["id"], "a50");
assert_eq!(page2[49]["id"], "a99");
assert_eq!(page2[50]["id"], "r0", "归档组从 0 起独立分页,不被活跃 offset 影响");
// 第三页:活跃 offset 100(尾页 15 条),归档 offset 3(越界空)
let page3 = paginate_by_group(summaries, 50, 100, 3);
assert_eq!(page3.len(), 15);
assert_eq!(page3[0]["id"], "a100");
assert_eq!(page3[14]["id"], "a114");
assert!(page3.iter().all(|s| s["archived"] == false), "归档越界返回该组空页");
}
/// offset 超组长度的组返回空页(自然收敛);两组同时越界返回空 Vec。
#[test]
fn paginate_offset_beyond_length_yields_empty() {
let summaries = vec![conv_val("a0", false), conv_val("r0", true)];
assert!(paginate_by_group(summaries.clone(), 50, 5, 0).iter().all(|s| s["archived"] == true));
assert!(paginate_by_group(summaries.clone(), 50, 0, 5).iter().all(|s| s["archived"] == false));
assert!(paginate_by_group(summaries, 50, 5, 5).is_empty());
}
/// 输入混排(归档穿插在活跃间,list_all 全量 DESC 实际形态)时 partition 仍按组归位,
/// 组内保持传入原序。
#[test]
fn paginate_partition_from_interleaved_input() {
let summaries = vec![
conv_val("a0", false), conv_val("r0", true), conv_val("a1", false), conv_val("r1", true),
];
let page = paginate_by_group(summaries, 50, 0, 0);
let ids: Vec<&str> = page.iter().map(|s| s["id"].as_str().unwrap()).collect();
assert_eq!(ids, vec!["a0", "a1", "r0", "r1"], "活跃全量在前(原序),归档全量在后(原序)");
}
// ============================================================ // ============================================================
// F-260619-03 批次 B 端到端 round-trip(写路径全链:映射 → replace → list → 还原) // F-260619-03 批次 B 端到端 round-trip(写路径全链:映射 → replace → list → 还原)
// ============================================================ // ============================================================
@@ -1789,4 +1893,72 @@ mod tests {
assert!(parse_pinned_goals(Some("not-json")).is_empty()); assert!(parse_pinned_goals(Some("not-json")).is_empty());
assert!(parse_pinned_goals(None).is_empty()); assert!(parse_pinned_goals(None).is_empty());
} }
// ── 恢复产物过滤(递归套娃防线,conv 76730ce8 seq 250 实证) ──
/// 构造一条上一代恢复消息全文(截 200 字符,复刻 begin_turn 误记目标的现场形态)。
fn prev_recovery_text() -> String {
let full = format!(
"{} 应用重启导致上次任务中断,已完成进度已保留。请按以下目标快照继续完成未竟任务:\n\n有效目标:\n- 检查 各个 u-claw 实例状态\n\n若快照不足以判断进度,先向用户确认已完成步骤再继续。",
RECOVERY_ARTIFACT_PREFIX
);
full.chars().take(200).collect()
}
#[test]
fn recovery_message_zero_nesting_with_polluted_goals() {
use df_ai::context_helpers::GoalStatus;
// 嵌套恢复现场:WorkingContext.goals 与 pinned_goals 都躺着上一条恢复消息全文,
// 两侧 Active——未过滤时它会被当有效目标嵌进新恢复消息(套娃逐层加深)。
let wc = wc_with_goals(&[
(&prev_recovery_text(), GoalStatus::Active),
("交付 v2 登录接口", GoalStatus::Active),
]);
let pinned = vec![
crate::commands::ai::GoalEntry::new(prev_recovery_text()),
crate::commands::ai::GoalEntry::new("补齐单测覆盖".to_string()),
];
let msg = build_recovery_message(&wc, &pinned);
// 输出只允许保留消息头一处恢复前缀(零套娃),正常用户目标不受影响
assert_eq!(
msg.matches(RECOVERY_ARTIFACT_PREFIX).count(),
1,
"恢复产物目标必须被剔除,输出仅消息头一处前缀: {msg}"
);
assert!(msg.contains("交付 v2 登录接口"), "正常用户目标须保留: {msg}");
assert!(msg.contains("补齐单测覆盖"), "正常钉扎目标须保留: {msg}");
assert!(
!msg.contains("有效目标:\n- [系统恢复]"),
"上一代恢复消息不得作为目标行回放: {msg}"
);
}
#[test]
fn recovery_message_all_polluted_falls_back_to_constant() {
use df_ai::context_helpers::GoalStatus;
// 快照只剩恢复产物(历史最深套娃态):全部过滤后回退常量,套娃链在此截断
let wc = wc_with_goals(&[(&prev_recovery_text(), GoalStatus::Active)]);
let pinned = vec![crate::commands::ai::GoalEntry::new(prev_recovery_text())];
assert_eq!(
build_recovery_message(&wc, &pinned),
PARKED_RECOVERY_MESSAGE,
"全污染快照过滤后按空快照回退常量"
);
}
#[test]
fn parse_pinned_goals_drops_recovery_artifacts_idempotent() {
// 存量污染反解剔除:恢复前缀条目不进内存(幂等——清洗后再解析结果不变)
let polluted = serde_json::to_string(&vec![
crate::commands::ai::GoalEntry::new(prev_recovery_text()),
crate::commands::ai::GoalEntry::new("正常目标保留".to_string()),
])
.unwrap();
let parsed = parse_pinned_goals(Some(&polluted));
assert_eq!(parsed.len(), 1, "恢复产物条目须剔除: {parsed:?}");
assert_eq!(parsed[0].text, "正常目标保留");
// 幂等:清洗结果重解析不变
let cleaned = serde_json::to_string(&parsed).unwrap();
assert_eq!(parse_pinned_goals(Some(&cleaned)).len(), 1);
}
} }
+46 -10
View File
@@ -127,6 +127,7 @@ fn system_prompt_parts(lang: &str) -> (String, &'static str, &'static str) {
- {}\n\ - {}\n\
- {}\n\ - {}\n\
- {}\n\ - {}\n\
- Response style: lead with the conclusion and the action/result; omit restating the user's question, pleasantries, and summary closers; prefer bullet points over paragraphs; do not expand on what was not asked. Explain whenever explanation is needed — cut filler, not substance.\n\
## Focus\n\ ## Focus\n\
- Always center your response on the core goal of the user's current request; the previous round's topic is only background, not the current task.\n\ - Always center your response on the core goal of the user's current request; the previous round's topic is only background, not the current task.\n\
- When the user switches topics (a clear new intent), follow the latest request; do not drag the old topic into the new answer.\n\ - When the user switches topics (a clear new intent), follow the latest request; do not drag the old topic into the new answer.\n\
@@ -160,6 +161,7 @@ fn system_prompt_parts(lang: &str) -> (String, &'static str, &'static str) {
- {}\n\ - {}\n\
- {}\n\ - {}\n\
- {}\n\ - {}\n\
- 回复风格:结论先行,直接给动作/结果;不复述用户问题,不做客套开场和总结性收尾;要点优先于段落;用户没问的不展开。需要解释时照常解释——省的是空话,不是内容。\n\
## 聚焦准则\n\ ## 聚焦准则\n\
- 始终围绕用户当前请求的核心目标回答;上一轮的主题只是背景,不是当前任务。\n\ - 始终围绕用户当前请求的核心目标回答;上一轮的主题只是背景,不是当前任务。\n\
- 用户切换话题(明显的新意图)时,以最新请求为准,不要把旧话题带进新回答。\n\ - 用户切换话题(明显的新意图)时,以最新请求为准,不要把旧话题带进新回答。\n\
@@ -445,7 +447,10 @@ async fn entity_fingerprint(db: &Arc<Database>, sql: &'static str) -> Option<Str
/// - 日期:env_profile_line 注入当日日期,跨天必须失效(否则缓存串日期过期)。 /// - 日期:env_profile_line 注入当日日期,跨天必须失效(否则缓存串日期过期)。
/// - lang:system_prompt_parts / 各策略段 / 注明语随 lang 分支。 /// - lang:system_prompt_parts / 各策略段 / 注明语随 lang 分支。
/// - custom_prompt:与 build 内读的同一设置,变更即失效。 /// - custom_prompt:与 build 内读的同一设置,变更即失效。
/// - 活跃 project/task 的 id+updated_at:新增/软删/改 updated_at 均反映到指纹(比 MAX 更稳)。 /// - 活跃 project/task 指纹:task 取 id+updated_at;project 取 id+活跃时间(三源取大:
/// tasks.updated_at 最新/project_events 最新 created_at/projects.updated_at,仅未归档未删除,
/// 与「当前项目」清单的 list_active_with_activity 排序输入对齐)——任务更新/归档变化均
/// 反映到指纹,清单排序变了缓存串必失效。
/// - 去重排除集:被@实体走 augmentation 精准投影,排除集变化会改变清单内容,须纳入指纹。 /// - 去重排除集:被@实体走 augmentation 精准投影,排除集变化会改变清单内容,须纳入指纹。
async fn system_prompt_fingerprint( async fn system_prompt_fingerprint(
state: &AppState, state: &AppState,
@@ -463,7 +468,11 @@ async fn system_prompt_fingerprint(
.unwrap_or_default(); .unwrap_or_default();
let proj_fp = entity_fingerprint( let proj_fp = entity_fingerprint(
&state.db, &state.db,
"SELECT id, updated_at FROM projects WHERE deleted_at IS NULL", "SELECT p.id, MAX(\
IFNULL((SELECT MAX(t.updated_at) FROM tasks t WHERE t.project_id = p.id AND t.deleted_at IS NULL), 0), \
IFNULL((SELECT MAX(e.created_at) FROM project_events e WHERE e.project_id = p.id), 0), \
IFNULL(p.updated_at, 0)\
) FROM projects p WHERE p.deleted_at IS NULL AND p.archived = 0",
) )
.await?; .await?;
let task_fp = entity_fingerprint( let task_fp = entity_fingerprint(
@@ -586,24 +595,25 @@ async fn build_context_lists(
) -> String { ) -> String {
let (_, proj_label, task_label) = system_prompt_parts(lang); let (_, proj_label, task_label) = system_prompt_parts(lang);
let mut out = String::new(); let mut out = String::new();
// 附加当前数据上下文 // 附加当前数据上下文。项目段按最近活跃排序(任务活跃为主信号),治创建序误导项目绑定
if let Ok(projects) = state.projects.list_active().await { // (创建序会把早停摆项目排在清单首位,AI 误当最高优先项目锚点)。
if let Ok(projects) = state.projects.list_active_with_activity().await {
if !projects.is_empty() { if !projects.is_empty() {
out.push_str(proj_label); out.push_str(proj_label);
// system prompt 前缀克制:仅最近 20 个项目,防 context 膨胀 // system prompt 前缀克制:仅最近 20 个项目,防 context 膨胀
// 去重:被 @ 的项目跳过(已有 augmentation 精准投影,清单再现致同一实体两次入 prompt) // 去重:被 @ 的项目跳过(已有 augmentation 精准投影,清单再现致同一实体两次入 prompt)
for p in projects.iter().take(20) { for p in projects.iter().take(20) {
if excluded_project_ids.iter().any(|id| id == &p.id) { if excluded_project_ids.iter().any(|id| id == &p.record.id) {
continue; continue;
} }
out.push_str(&format!( out.push_str(&format!(
"- {} (id: {}) ({}): {}\n", "- {} (id: {}) ({}): {}\n",
p.name, p.record.name,
p.id, p.record.id,
p.status.as_str(), p.record.status.as_str(),
truncate_desc(&p.description, CONTEXT_DESC_MAX_CHARS) truncate_desc(&p.record.description, CONTEXT_DESC_MAX_CHARS)
)); ));
if let Some(ref dir) = p.path { if let Some(ref dir) = p.record.path {
out.push_str(&format!(" 目录: {}\n", dir)); out.push_str(&format!(" 目录: {}\n", dir));
} }
} }
@@ -921,6 +931,32 @@ mod tests {
assert!(prefix.contains("聚焦准则")); assert!(prefix.contains("聚焦准则"));
} }
// M4 回复风格纪律:中文版行为准则含「回复风格」条款(反口水话,不反内容)
#[test]
fn system_prompt_zh_has_response_style_clause() {
let (prefix, _, _) = system_prompt_parts("zh-CN");
assert!(
prefix.contains("回复风格"),
"中文 system prompt 应含回复风格条款,实际: {}",
prefix
);
// 核心条款抽样:结论先行 + 「省的是空话,不是内容」的度(需要解释时照常解释)
assert!(prefix.contains("结论先行"));
assert!(prefix.contains("省的是空话,不是内容"));
}
// M4 回复风格纪律:英文版 Guidelines 含 Response style 条款
#[test]
fn system_prompt_en_has_response_style_clause() {
let (prefix, _, _) = system_prompt_parts("en");
assert!(
prefix.contains("Response style"),
"英文 system prompt 应含 Response style 条款,实际: {}",
prefix
);
assert!(prefix.contains("cut filler, not substance"));
}
// 文档探索策略段(中/英)存在且含关键引导 // 文档探索策略段(中/英)存在且含关键引导
#[test] #[test]
fn doc_exploration_strategy_section_present_zh_en() { fn doc_exploration_strategy_section_present_zh_en() {
+38 -3
View File
@@ -1098,7 +1098,7 @@ pub fn register(
} }
// output_mode 分派返回结构 // output_mode 分派返回结构
let result = match output_mode { let mut result = match output_mode {
"files_with_matches" => { "files_with_matches" => {
// 仅返命中文件路径列表(去重,顺序保留首次命中) // 仅返命中文件路径列表(去重,顺序保留首次命中)
let files: Vec<String> = matches_out.iter() let files: Vec<String> = matches_out.iter()
@@ -1183,6 +1183,11 @@ pub fn register(
}) })
} }
}; };
// 0 命中「阴性存疑」提示:路径/glob 写法/大小写任一不对都静默 0 命中,
// LLM 拿空结果易直接当「不存在」下结论(实测假阴性被当事实断言 3 轮),强制附一行复核提示。
if total == 0 {
result["hint"] = serde_json::json!(negative_hit_hint("路径/glob 写法/大小写 -i"));
}
Ok(result) Ok(result)
} }
); );
@@ -1228,10 +1233,13 @@ pub fn register(
let mut out = serde_json::json!({ let mut out = serde_json::json!({
"path": path, "pattern": pattern, "results": page_results, "total": total, "has_more": has_more "path": path, "pattern": pattern, "results": page_results, "total": total, "has_more": has_more
}); });
// total=0 时空结果引导(治 LLM 搜不到就放弃/盲目重试)。 // total=0 时空结果引导(治 LLM 搜不到就放弃/盲目重试)+ 阴性存疑提示(0 命中≠不存在)。
// 注:search_files 已大小写不敏感(内部 pattern.to_lowercase + 包含匹配),文案勿写"换大小写"。 // 注:search_files 已大小写不敏感(内部 pattern.to_lowercase + 包含匹配),文案勿写"换大小写"。
if total == 0 { if total == 0 {
out["hint"] = serde_json::json!("未找到匹配文件。可尝试: ① 放宽关键词(更短/字符更少); ② 用 grep 工具做跨文件内容正则搜索(pattern 支持正则, -i 大小写不敏感)。注: search_files 为文件名大小写不敏感包含匹配"); out["hint"] = serde_json::json!(format!(
"{}\n未找到匹配文件。可尝试: ① 补 recursive=true 搜子目录(不传只搜当前层); ② 放宽关键词(更短/字符更少); ③ 用 grep 工具做跨文件内容正则搜索(pattern 支持正则, -i 大小写不敏感)。注: search_files 为文件名大小写不敏感包含匹配",
negative_hit_hint("路径/recursive")
));
} }
Ok(out) Ok(out)
} }
@@ -1675,6 +1683,16 @@ fn file_not_found_error(path: &str) -> anyhow::Error {
anyhow::anyhow!(msg) anyhow::anyhow!(msg)
} }
/// 搜索工具(search_files/grep)0 命中「阴性存疑」提示。
///
/// 治勘察假阴性被当事实断言:search_files 未传 recursive 只搜根目录,
/// 0 命中被 LLM 直接当「功能未实施」连续断言 3 轮。路径/glob/recursive 等范围
/// 参数写错时同样静默 0 命中,故空结果强制附本提示让 LLM 复核后再下结论。
/// 措辞克制一行;`scope` 按工具传入各自的复核点。
fn negative_hit_hint(scope: &str) -> String {
format!("⚠ 0 命中不一定代表不存在——请复核搜索范围({scope})后再下结论")
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
@@ -2003,6 +2021,23 @@ mod tests {
assert!(msg.contains("相近文件候选"), "应含相近文件候选,实际: {msg}"); assert!(msg.contains("相近文件候选"), "应含相近文件候选,实际: {msg}");
assert!(msg.contains("target.rs"), "候选应含 target.rs,实际: {msg}"); assert!(msg.contains("target.rs"), "候选应含 target.rs,实际: {msg}");
} }
// ============================================================
// negative_hit_hint — 搜索工具 0 命中阴性存疑提示(治假阴性被当事实断言)
// ============================================================
/// 两搜索工具 0 命中提示共用句式:声明「0 命中≠不存在」+ 按工具各自的复核点。
#[test]
fn negative_hit_hint_states_doubt_and_scope() {
// grep 侧复核点:路径/glob 写法/大小写
let grep_hint = negative_hit_hint("路径/glob 写法/大小写 -i");
assert!(grep_hint.contains("0 命中不一定代表不存在"), "应声明阴性存疑,实际: {grep_hint}");
assert!(grep_hint.contains("复核搜索范围"), "应引导复核,实际: {grep_hint}");
assert!(grep_hint.contains("glob"), "grep 侧应含 glob 复核点,实际: {grep_hint}");
// search_files 侧复核点:recursive(实测根因是未传 recursive 只搜根目录)
let search_hint = negative_hit_hint("路径/recursive");
assert!(search_hint.contains("recursive"), "search_files 侧应含 recursive 复核点,实际: {search_hint}");
}
} }
+259 -44
View File
@@ -63,6 +63,34 @@ fn cancel_watchers(
CANCEL_WATCHERS.get_or_init(|| tokio::sync::Mutex::new(HashMap::new())) CANCEL_WATCHERS.get_or_init(|| tokio::sync::Mutex::new(HashMap::new()))
} }
/// F5-2 终态窗口:审批前端默认 15min 超时自动拒绝,30min 窗覆盖「终态后用户补发决议词」
/// 的迟到判定;窗口外的决议词视为普通聊天文本(无审批语境,现状语义)
const RESOLVED_WINDOW_SECS: i64 = 1800;
/// F5-2 审批终态闭环:已推飞书侧的审批按钮卡句柄(tc_id → (卡片 message_id, 发卡时刻))。
/// 桌面决议/超时自动拒绝后原卡原地更新为终态,不再恒挂可点。内存态,重启即失——重启后
/// 陈旧卡点击走 ai_approve 幂等「已处理」回执,无功能损失。写入时顺带清过期条目防无界增长
static APPROVAL_CARDS: std::sync::OnceLock<std::sync::Mutex<HashMap<String, (String, i64)>>> =
std::sync::OnceLock::new();
/// F5-2 迟到决议判定:chat → 最近一次审批终态(时刻, 是否批准)。审批已终态但用户仍在
/// 飞书回决议词时,据此前 30min 记录提示「已处理」而非把决议文本注入运行中任务
static RESOLVED_CHATS: std::sync::OnceLock<std::sync::Mutex<HashMap<String, (i64, bool)>>> =
std::sync::OnceLock::new();
fn approval_cards() -> &'static std::sync::Mutex<HashMap<String, (String, i64)>> {
APPROVAL_CARDS.get_or_init(|| std::sync::Mutex::new(HashMap::new()))
}
fn resolved_chats() -> &'static std::sync::Mutex<HashMap<String, (i64, bool)>> {
RESOLVED_CHATS.get_or_init(|| std::sync::Mutex::new(HashMap::new()))
}
/// 终态新鲜度判定(纯函数,迟到决议提示的窗口判据)
fn within_resolved_window(at_secs: i64, now: i64) -> bool {
now - at_secs < RESOLVED_WINDOW_SECS
}
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize)]
struct FeishuConfig { struct FeishuConfig {
#[serde(default)] #[serde(default)]
@@ -125,6 +153,9 @@ struct Ctx {
/// D3 在途会话数:消息受理(handle_message 白名单通过)到任务投递完成期间 >0, /// D3 在途会话数:消息受理(handle_message 白名单通过)到任务投递完成期间 >0,
/// 看门狗要求为 0 才告警,防有回复待投递时误报 /// 看门狗要求为 0 才告警,防有回复待投递时误报
inflight: Arc<AtomicUsize>, inflight: Arc<AtomicUsize>,
/// D5 假活自愈唤醒句柄:看门狗连续告警超阈值后 notify,run_loop 的 channel.start()
/// select 到即主动退出,交给外层重连循环重建连接(Notify 生命周期同 Ctx,跨重连复用)
selfheal: Arc<tokio::sync::Notify>,
} }
/// 启动入口:lib.rs setup 调用。未启用/配置缺失/构造失败一律记日志返回,不阻塞应用启动。 /// 启动入口:lib.rs setup 调用。未启用/配置缺失/构造失败一律记日志返回,不阻塞应用启动。
@@ -182,6 +213,7 @@ pub fn start_if_enabled(app: tauri::AppHandle) {
debounce: Arc::new(tokio::sync::Mutex::new(HashMap::new())), debounce: Arc::new(tokio::sync::Mutex::new(HashMap::new())),
last_alive: Arc::new(AtomicI64::new(now_secs())), last_alive: Arc::new(AtomicI64::new(now_secs())),
inflight: Arc::new(AtomicUsize::new(0)), inflight: Arc::new(AtomicUsize::new(0)),
selfheal: Arc::new(tokio::sync::Notify::new()),
}); });
// D1 僵尸资源修复:client 的 'static 化只做一次(原在 run_loop 内,每次重连都 // D1 僵尸资源修复:client 的 'static 化只做一次(原在 run_loop 内,每次重连都
// Box::leak 一份 LarkClient,频繁断线场景内存阶梯上涨);Channel::builder 仅借用 // Box::leak 一份 LarkClient,频繁断线场景内存阶梯上涨);Channel::builder 仅借用
@@ -285,10 +317,16 @@ let ctx_msg = ctx.clone();
}) })
.build(); .build();
tracing::info!("[feishu] 长连接启动(桌面端直连,免公网回调)"); tracing::info!("[feishu] 长连接启动(桌面端直连,免公网回调)");
let result = channel // D5 假活自愈:看门狗持续断流判定后 notify,主动终结本次 channel.start(),
.start() // 交给外层重连循环 backoff 重建连接(比 SDK 内部重连更彻底:全新 WS 握手)
.await let heal = ctx.selfheal.clone();
.map_err(|e: LarkError| anyhow::anyhow!("飞书长连接退出: {e}")); let result = tokio::select! {
r = channel.start() => r
.map_err(|e: LarkError| anyhow::anyhow!("飞书长连接退出: {e}")),
_ = heal.notified() => {
Err(anyhow::anyhow!("假活自愈: 看门狗判定持续断流,主动断开重建"))
}
};
watchdog.abort(); watchdog.abort();
result?; result?;
Ok(()) Ok(())
@@ -310,25 +348,45 @@ const LIVENESS_TICK: std::time::Duration = std::time::Duration::from_secs(60);
/// 排查起点(此前 bot 静默死无任何日志可查)。 /// 排查起点(此前 bot 静默死无任何日志可查)。
async fn run_liveness_watchdog(ctx: Arc<Ctx>) { async fn run_liveness_watchdog(ctx: Arc<Ctx>) {
let mut warned = false; let mut warned = false;
// D5 假活自愈:连续告警计数。每 60s 巡检一次,断流持续 LIVENESS_HEAL_TICKS 次
// (即断流 ≥ 600s + 3×60s 确认期)仍无任何事件恢复,判定为协议假活(SDK 读空闲
// 自愈覆盖不了),主动 notify 唤醒 run_loop 退出重建连接,复用外层 backoff 重连
let mut stale_ticks: u32 = 0;
loop { loop {
tokio::time::sleep(LIVENESS_TICK).await; tokio::time::sleep(LIVENESS_TICK).await;
let elapsed = now_secs() - ctx.last_alive.load(Ordering::SeqCst); let elapsed = now_secs() - ctx.last_alive.load(Ordering::SeqCst);
if elapsed <= LIVENESS_STALE_SECS { if elapsed <= LIVENESS_STALE_SECS {
warned = false; warned = false;
stale_ticks = 0;
continue; continue;
} }
// 有会话在途不告警(回复投递依赖当前连接);同一段断流只告警一次防刷屏 // 有会话在途不告警(回复投递依赖当前连接)
if ctx.inflight.load(Ordering::SeqCst) > 0 || warned { if ctx.inflight.load(Ordering::SeqCst) > 0 {
continue; continue;
} }
if !warned {
warned = true; warned = true;
tracing::warn!("[feishu] 探活告警: {elapsed}s 无任何事件且无在途会话,疑似连接假活"); tracing::warn!("[feishu] 探活告警: {elapsed}s 无任何事件且无在途会话,疑似连接假活");
feishu_log(&format!( feishu_log(&format!(
"探活告警: {elapsed}s 无任何事件且无在途会话(疑似假活,持续出现请重启应用重建连接)" "探活告警: {elapsed}s 无任何事件且无在途会话(疑似假活)"
)); ));
} }
stale_ticks += 1;
if stale_ticks >= LIVENESS_HEAL_TICKS {
tracing::error!(
"[feishu] 假活自愈触发: 断流持续 {} 个巡检周期,主动断开重建长连接",
stale_ticks
);
feishu_log("假活自愈触发: 持续断流,主动断开重建长连接");
ctx.selfheal.notify_waiters();
return;
}
}
} }
/// D5 自愈确认期:首个告警后再等 N 个巡检周期仍断流才重建(防把正常空闲+慢恢复误杀)
const LIVENESS_HEAL_TICKS: u32 = 3;
/// D3 在途会话计数 RAII:handle_message 从注册等待桥到投递完成的任意退出路径 /// D3 在途会话计数 RAII:handle_message 从注册等待桥到投递完成的任意退出路径
/// (spawn 失败早退/投递完成)都保证计数回落 /// (spawn 失败早退/投递完成)都保证计数回落
struct InflightGuard(Arc<AtomicUsize>); struct InflightGuard(Arc<AtomicUsize>);
@@ -376,6 +434,27 @@ fn parse_command(text: &str) -> Option<(String, String)> {
Some((cmd, tail)) Some((cmd, tail))
} }
/// 审批决议词识别(F5-1):集合对齐按钮卡文案与常见同义词——批准 {同意|批准|通过|approve},
/// 拒绝 {拒绝|驳回|不同意|reject}。容错链:半全角归一 → 前后空白 → 剥尾部标点(「批准。」
/// 「同意!」)→ 小写(英文词)。整词精确匹配非包含(「不同意」含「同意」,靠整词比对防反判),
/// 普通文本(「我同意这个方案」)不命中返回 None,由调用方落常规消息路径
fn parse_approval_verdict(text: &str) -> Option<bool> {
const APPROVE_WORDS: [&str; 4] = ["同意", "批准", "通过", "approve"];
const REJECT_WORDS: [&str; 4] = ["拒绝", "驳回", "不同意", "reject"];
let t = normalize_halfwidth(text);
let t = t
.trim()
.trim_end_matches(['。', '.', ',', ',', '、', '!', '!', '?', '?', '~', '~', ';', ';', ' ', '\t'])
.to_lowercase();
if APPROVE_WORDS.contains(&t.as_str()) {
Some(true)
} else if REJECT_WORDS.contains(&t.as_str()) {
Some(false)
} else {
None
}
}
/// 图片消息喂模型的任务语境(#958):飞书 image 为独立消息类型无法带文字, /// 图片消息喂模型的任务语境(#958):飞书 image 为独立消息类型无法带文字,
/// 用引导词让 vision 模型知道「这是用户发来的图,按图作答」 /// 用引导词让 vision 模型知道「这是用户发来的图,按图作答」
const IMAGE_INBOUND_PROMPT: &str = "(用户通过飞书发来一张图片,请查看图片并按图片内容处理)"; const IMAGE_INBOUND_PROMPT: &str = "(用户通过飞书发来一张图片,请查看图片并按图片内容处理)";
@@ -891,10 +970,13 @@ async fn handle_message(
} }
} }
// 24 审批决议通路:该会话有挂起审批时,「批准/拒绝」直调审批原语不入对话链路 // 24 审批决议通路(F5-1 决议词容错):该会话有挂起审批时,决议词(同意/批准/通过 =
// (决议文本若落常规路径会被注入运行中任务,审批永远无人拍板)。决议取该会话最新 // 批准;拒绝/驳回/不同意 = 拒绝,含空白/尾标点/大小写容错,集合对齐按钮卡文案)直调
// 一条挂起;无挂起不拦截,文本照常落常规路径,零行为变更 // 审批原语不入对话链路(决议文本若落常规路径会被注入运行中任务,审批永远无人拍板)。
if text == "批准" || text == "拒绝" { // 决议取该会话最新一条挂起;无挂起不拦截,文本照常落常规路径,零行为变更——唯一
// 例外(F5-2 迟到决议):该 chat 近期刚有审批终态(桌面已决议/超时自动取消),决议词
// 命中却无可拍板对象,回「已处理」提示而非当补充指令注入任务流
if let Some(approved) = parse_approval_verdict(&text) {
let state = ctx.app.state::<crate::state::AppState>(); let state = ctx.app.state::<crate::state::AppState>();
let conv_id = ctx.chat_map.lock().await.get(&chat_id).cloned(); let conv_id = ctx.chat_map.lock().await.get(&chat_id).cloned();
let pending = match conv_id { let pending = match conv_id {
@@ -902,7 +984,6 @@ async fn handle_message(
None => None, None => None,
}; };
if let Some(tc_id) = pending { if let Some(tc_id) = pending {
let approved = text == "批准";
feishu_log(&format!("审批决议 chat={chat_id} tc={tc_id} approved={approved}")); feishu_log(&format!("审批决议 chat={chat_id} tc={tc_id} approved={approved}"));
// 2026-10-08 决议后追加执行结果:先订阅(工具执行前,防 publish_event 无订阅者跳过), // 2026-10-08 决议后追加执行结果:先订阅(工具执行前,防 publish_event 无订阅者跳过),
// 再调 ai_approve,后 spawn watcher 消费 AiToolCallCompleted 拿结果摘要 // 再调 ai_approve,后 spawn watcher 消费 AiToolCallCompleted 拿结果摘要
@@ -928,7 +1009,7 @@ async fn handle_message(
None => 0, None => 0,
}; };
let reply = if remaining > 0 { let reply = if remaining > 0 {
format!("{reply}\n\n⚠️ 本会话还有 {remaining} 条待审批,请继续回复「批准」或「拒绝」。") format!("{reply}\n\n⚠️ 本会话还有 {remaining} 条待审批,请继续回复「同意 / 批准」或「拒绝」。")
} else { } else {
reply reply
}; };
@@ -939,6 +1020,29 @@ async fn handle_message(
} }
return; return;
} }
// F5-2 迟到决议:无挂起但该 chat 近期有审批终态——如实提示,不落注入旁路
let recently_resolved = {
let now = now_secs();
resolved_chats()
.lock()
.map(|m| {
m.get(&chat_id)
.is_some_and(|(at, _)| within_resolved_window(*at, now))
})
.unwrap_or(false)
};
if recently_resolved {
feishu_log(&format!("迟到决议提示 chat={chat_id} text={}", truncate(&text, 40)));
reply_message(
&ctx.client,
&message_id,
&chat_id,
"ℹ️ 该审批已处理(已批准/已拒绝或超时自动取消),无需再回复;可发 /status 查看任务状态。",
)
.await;
return;
}
// 近期无审批终态:决议词属普通聊天文本,落常规路径(现状语义保留)
} }
// ── 纠偏注入旁路(todo.md 16,2026-10-06):会话运行中 → 直接注入运行中 conv,不排队 ── // ── 纠偏注入旁路(todo.md 16,2026-10-06):会话运行中 → 直接注入运行中 conv,不排队 ──
@@ -1428,21 +1532,48 @@ async fn run_approval_notifier(ctx: Arc<Ctx>) {
let mut rx = state.ai_event_bus.subscribe(); let mut rx = state.ai_event_bus.subscribe();
loop { loop {
match rx.recv().await { match rx.recv().await {
Ok(v) => { Ok(v) => match v.get("type").and_then(|t| t.as_str()) {
if v.get("type").and_then(|t| t.as_str()) != Some("AiApprovalRequired") { // F5-2 审批终态闭环:批/拒/超时(前端超时亦调 ai_approve(false))全路径 emit
continue; // AiApprovalResult——订阅同 bus 复用 spawn_approval_result_watcher 先例,零后端
} // 改动。飞书侧原按钮卡原地更新为终态(不再恒挂可点),并记 chat 维度终态
// (迟到决议提示判据)。事件无决议来源字段,拒绝文案注明含超时自动取消;
// 飞书侧自身决议同经此收口(与决议回执双保险,防旧卡再点)
Some("AiApprovalResult") => {
let Some(cid) = v.get("conversation_id").and_then(|c| c.as_str()) else { let Some(cid) = v.get("conversation_id").and_then(|c| c.as_str()) else {
continue; continue;
}; };
let chat_id = ctx let tc_id = v.get("id").and_then(|i| i.as_str()).unwrap_or("");
.chat_map let approved = v
.get("approved")
.and_then(|b| b.as_bool())
.unwrap_or(false);
let Some(chat_id) = chat_of_conv(&ctx, cid).await else {
continue;
};
note_approval_resolved(&chat_id, approved);
let mid = approval_cards()
.lock() .lock()
.await .ok()
.iter() .and_then(|mut cards| cards.remove(tc_id).map(|(mid, _)| mid))
.find(|(_, c)| c.as_str() == cid) .filter(|m| !m.is_empty());
.map(|(k, _)| k.clone()); // 无卡句柄(降级文本卡/他路无原卡):只记终态,迟到提示仍生效
let Some(chat_id) = chat_id else { if let Some(mid) = mid {
let text = if approved {
"✅ 该审批已批准,任务继续执行(按钮已失效)。"
} else {
"🚫 该审批已结束:已拒绝或超时自动取消(按钮已失效)。"
};
let updated = update_card(&ctx.client, &mid, text).await;
feishu_log(&format!(
"审批终态收口 chat={chat_id} tc={tc_id} approved={approved} 更新={updated}"
));
}
}
Some("AiApprovalRequired") => {
let Some(cid) = v.get("conversation_id").and_then(|c| c.as_str()) else {
continue;
};
let Some(chat_id) = chat_of_conv(&ctx, cid).await else {
continue; continue;
}; };
let name = v.get("name").and_then(|n| n.as_str()).unwrap_or("工具"); let name = v.get("name").and_then(|n| n.as_str()).unwrap_or("工具");
@@ -1455,14 +1586,14 @@ async fn run_approval_notifier(ctx: Arc<Ctx>) {
// 审批卡按钮化(2026-10-08):改用带「同意/拒绝」按钮的交互卡片, // 审批卡按钮化(2026-10-08):改用带「同意/拒绝」按钮的交互卡片,
// 按钮 value 携带 {approval_id, approved},回调经 on_card_action → // 按钮 value 携带 {approval_id, approved},回调经 on_card_action →
// handle_card_action → ai_approve 原语(与文本决议通路同原语,双通道并存)。 // handle_card_action → ai_approve 原语(与文本决议通路同原语,双通道并存)。
// 文本「批准/拒绝」通路保留作降级(旧卡片/按钮回调异常时仍可用)。 // 文本决议词通路保留作降级(旧卡片/按钮回调异常时仍可用)。
let tc_id = v.get("id").and_then(|i| i.as_str()).unwrap_or(""); let tc_id = v.get("id").and_then(|i| i.as_str()).unwrap_or("");
if tc_id.is_empty() { if tc_id.is_empty() {
// 无 tool_call_id 无法构造按钮载荷,降级文本卡(回复「批准/拒绝」) // 无 tool_call_id 无法构造按钮载荷,降级文本卡(回复决议词)
let card = if brief.is_empty() { let card = if brief.is_empty() {
format!("⏸ 需审批: `{name}`。回复「批准」或「拒绝」继续") format!("⏸ 需审批: `{name}`。回复「同意 / 批准」或「拒绝」继续")
} else { } else {
format!("⏸ 需审批: `{name}` {brief}。回复「批准」或「拒绝」继续") format!("⏸ 需审批: `{name}` {brief}。回复「同意 / 批准」或「拒绝」继续")
}; };
send_markdown_card(&ctx.client, "", &chat_id, &card).await; send_markdown_card(&ctx.client, "", &chat_id, &card).await;
} else { } else {
@@ -1470,6 +1601,8 @@ async fn run_approval_notifier(ctx: Arc<Ctx>) {
} }
feishu_log(&format!("审批挂起推送 chat={chat_id} conv={cid} tool={name}")); feishu_log(&format!("审批挂起推送 chat={chat_id} conv={cid} tool={name}"));
} }
_ => {}
},
Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => continue, Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => continue,
Err(tokio::sync::broadcast::error::RecvError::Closed) => return, Err(tokio::sync::broadcast::error::RecvError::Closed) => return,
} }
@@ -1505,15 +1638,8 @@ async fn handle_card_action(
if chat_id.is_empty() { if chat_id.is_empty() {
let state = ctx.app.state::<crate::state::AppState>(); let state = ctx.app.state::<crate::state::AppState>();
if let Some(cid) = approval_conversation_id(&state, &approval_id).await { if let Some(cid) = approval_conversation_id(&state, &approval_id).await {
chat_id = ctx if let Some(found) = chat_of_conv(&ctx, &cid).await {
.chat_map chat_id = found;
.lock()
.await
.iter()
.find(|(_, c)| c.as_str() == cid)
.map(|(k, _)| k.clone())
.unwrap_or_default();
if !chat_id.is_empty() {
feishu_log(&format!("卡片回调 chat_id 缺失,反查补齐 chat={chat_id}")); feishu_log(&format!("卡片回调 chat_id 缺失,反查补齐 chat={chat_id}"));
} }
} }
@@ -1575,9 +1701,14 @@ async fn handle_card_action(
} }
} }
/// F5-3 结果 watcher 超时话术:60s 未见完成事件时回告去向,不静默弃守让用户空等
const APPROVAL_RESULT_TIMEOUT_MSG: &str =
"⏳ 工具执行耗时较长(超 60s 仍无结果),已停止自动回推;完成后可在桌面端查看该工具的执行结果。";
/// 审批决议后执行结果 watcher(2026-10-08):订阅 ai_event_bus 的 AiToolCallCompleted /// 审批决议后执行结果 watcher(2026-10-08):订阅 ai_event_bus 的 AiToolCallCompleted
/// (匹配 tool_call_id),拿 result 摘要回推 chat。原决议后只回「已批准」,用户不知工具 /// (匹配 tool_call_id),拿 result 摘要回推 chat。原决议后只回「已批准」,用户不知工具
/// 执行结果(成功/失败/输出)。设 60s 超时兜底(工具执行通常秒级,长工具超时静默放弃)。 /// 执行结果(成功/失败/输出)。设 60s 超时兜底(工具执行通常秒级,长工具超时回告去向
/// 后放弃,F5-3 修静默弃守)。
/// ///
/// 订阅须在 ai_approve 调用前完成——publish_event 在无订阅者时跳过序列化,晚订阅必丢事件。 /// 订阅须在 ai_approve 调用前完成——publish_event 在无订阅者时跳过序列化,晚订阅必丢事件。
fn spawn_approval_result_watcher( fn spawn_approval_result_watcher(
@@ -1592,6 +1723,7 @@ fn spawn_approval_result_watcher(
loop { loop {
let remaining = deadline.saturating_duration_since(tokio::time::Instant::now()); let remaining = deadline.saturating_duration_since(tokio::time::Instant::now());
if remaining.is_zero() { if remaining.is_zero() {
let _ = send_markdown_card(&ctx.client, "", &chat_id, APPROVAL_RESULT_TIMEOUT_MSG).await;
feishu_log(&format!("[approval-result] 等待工具结果超时 tc={tool_call_id}")); feishu_log(&format!("[approval-result] 等待工具结果超时 tc={tool_call_id}"));
return; return;
} }
@@ -1617,6 +1749,7 @@ fn spawn_approval_result_watcher(
Ok(Err(tokio::sync::broadcast::error::RecvError::Lagged(_))) => continue, Ok(Err(tokio::sync::broadcast::error::RecvError::Lagged(_))) => continue,
Ok(Err(tokio::sync::broadcast::error::RecvError::Closed)) => return, Ok(Err(tokio::sync::broadcast::error::RecvError::Closed)) => return,
Err(_) => { Err(_) => {
let _ = send_markdown_card(&ctx.client, "", &chat_id, APPROVAL_RESULT_TIMEOUT_MSG).await;
feishu_log(&format!("[approval-result] 等待工具结果超时 tc={tool_call_id}")); feishu_log(&format!("[approval-result] 等待工具结果超时 tc={tool_call_id}"));
return; return;
} }
@@ -1635,10 +1768,12 @@ async fn send_approval_button_card(
tool_name: &str, tool_name: &str,
brief: &str, brief: &str,
) { ) {
// F5-1 文案统一:副注提示文字决议词(按钮不可用时降级通道),词表与 parse_approval_verdict 同源
let hint = "点击按钮,或回复「同意 / 批准 / 通过 / 拒绝」";
let detail = if brief.is_empty() { let detail = if brief.is_empty() {
format!("⏸ 需审批: `{tool_name}`") format!("⏸ 需审批: `{tool_name}`\n\n{hint}")
} else { } else {
format!("⏸ 需审批: `{tool_name}`\n\n{brief}") format!("⏸ 需审批: `{tool_name}`\n\n{brief}\n\n{hint}")
}; };
// 按钮 value 需为 SDK 的 JsonValue(其实现了 From<serde_json::Value>,直接 into 转换) // 按钮 value 需为 SDK 的 JsonValue(其实现了 From<serde_json::Value>,直接 into 转换)
let to_json_value = |v: serde_json::Value| -> larksuite_oapi_sdk_rs::JsonValue { v.into() }; let to_json_value = |v: serde_json::Value| -> larksuite_oapi_sdk_rs::JsonValue { v.into() };
@@ -1669,7 +1804,7 @@ async fn send_approval_button_card(
Ok(d) => d, Ok(d) => d,
Err(e) => { Err(e) => {
tracing::warn!("[feishu] 审批按钮卡校验失败,降级文本卡: {e}"); tracing::warn!("[feishu] 审批按钮卡校验失败,降级文本卡: {e}");
let fallback = format!("⏸ 需审批: `{tool_name}` {brief}。回复「批准」或「拒绝」继续"); let fallback = format!("⏸ 需审批: `{tool_name}` {brief}。回复「同意 / 批准 / 通过 / 拒绝」继续");
send_markdown_card(client, "", chat_id, &fallback).await; send_markdown_card(client, "", chat_id, &fallback).await;
return; return;
} }
@@ -1686,6 +1821,8 @@ async fn send_approval_button_card(
.await .await
{ {
Ok(sent) if !sent.message_id.is_empty() => { Ok(sent) if !sent.message_id.is_empty() => {
// F5-2 登记卡句柄:桌面决议/超时终态事件到达时按 tc_id 原地更新该卡为终态
note_approval_card(approval_id, &sent.message_id);
feishu_log(&format!("审批按钮卡已发 chat={chat_id} card={}", sent.message_id)); feishu_log(&format!("审批按钮卡已发 chat={chat_id} card={}", sent.message_id));
} }
Ok(_) => { Ok(_) => {
@@ -1693,12 +1830,38 @@ async fn send_approval_button_card(
} }
Err(e) => { Err(e) => {
tracing::error!("[feishu] 审批按钮卡发送失败,降级文本卡: {e}"); tracing::error!("[feishu] 审批按钮卡发送失败,降级文本卡: {e}");
let fallback = format!("⏸ 需审批: `{tool_name}` {brief}。回复「批准」或「拒绝」继续"); let fallback = format!("⏸ 需审批: `{tool_name}` {brief}。回复「同意 / 批准 / 通过 / 拒绝」继续");
send_markdown_card(client, "", chat_id, &fallback).await; send_markdown_card(client, "", chat_id, &fallback).await;
} }
} }
} }
/// 登记审批按钮卡句柄(终态原地更新用),顺带清窗口外陈旧条目
fn note_approval_card(tc_id: &str, message_id: &str) {
let now = now_secs();
let Ok(mut cards) = approval_cards().lock() else { return };
cards.retain(|_, (_, at)| within_resolved_window(*at, now));
cards.insert(tc_id.to_string(), (message_id.to_string(), now));
}
/// conv → 绑定飞书 chat 反查(notifier 推卡/终态收口共用;无绑定(纯桌面会话)None)
async fn chat_of_conv(ctx: &Ctx, conv_id: &str) -> Option<String> {
ctx.chat_map
.lock()
.await
.iter()
.find(|(_, c)| c.as_str() == conv_id)
.map(|(k, _)| k.clone())
}
/// 记录 chat 维度审批终态(迟到决议提示判据),顺带清窗口外陈旧条目
fn note_approval_resolved(chat_id: &str, approved: bool) {
let now = now_secs();
let Ok(mut chats) = resolved_chats().lock() else { return };
chats.retain(|_, (at, _)| within_resolved_window(*at, now));
chats.insert(chat_id.to_string(), (now, approved));
}
/// 该 conv 最新一条挂起审批的 tool_call_id(决议原语的消费目标);无挂起返回 None。 /// 该 conv 最新一条挂起审批的 tool_call_id(决议原语的消费目标);无挂起返回 None。
/// created_at 缺失视为最旧(宁取有时序的),同刻并列取遍历后者(HashMap 无序,可接受) /// created_at 缺失视为最旧(宁取有时序的),同刻并列取遍历后者(HashMap 无序,可接受)
async fn latest_pending_approval( async fn latest_pending_approval(
@@ -2519,8 +2682,8 @@ mod tests {
ContentPart, DebounceEntry, delivery_blocked, extract_delivery_paths, feishu_file_type, ContentPart, DebounceEntry, delivery_blocked, extract_delivery_paths, feishu_file_type,
file_display_name, file_inbound_prompt, file_size_over_limit_error, heartbeat_due, file_display_name, file_inbound_prompt, file_size_over_limit_error, heartbeat_due,
is_terminal_push, md_to_lark_friendly, merge_debounce_parts, merge_debounce_text, is_terminal_push, md_to_lark_friendly, merge_debounce_parts, merge_debounce_text,
msg_after_acceptance, parse_command, sniff_image_mime, strip_mention_placeholders, msg_after_acceptance, parse_approval_verdict, parse_command, sniff_image_mime,
stream_preview, strip_mention_placeholders, stream_preview, within_resolved_window,
}; };
#[test] #[test]
@@ -2858,4 +3021,56 @@ mod tests {
Some(vec![ContentPart::image_url("https://x/2.png")]) Some(vec![ContentPart::image_url("https://x/2.png")])
); );
} }
// ── F5-1 决议词识别(表驱动) ──
#[test]
fn verdict_table_approve_and_reject_with_tolerance() {
// 批准集含按钮卡文案「同意」;拒绝集含「不同意」;空白/尾标点/大小写/半全角容错
let table = [
// (输入, 期望)
("同意", Some(true)),
("批准", Some(true)),
("通过", Some(true)),
("approve", Some(true)),
(" 同意 ", Some(true)),
("批准。", Some(true)),
("同意!", Some(true)),
("通过~", Some(true)),
(" 拒绝 ", Some(false)), // 全角空格
("REJECT", Some(false)),
("Approve", Some(true)), // 全角 ASCII 变体
("拒绝", Some(false)),
("驳回", Some(false)),
("不同意", Some(false)),
("驳回。", Some(false)),
("不同意?", Some(false)),
];
for (input, expected) in table {
assert_eq!(parse_approval_verdict(input), expected, "case {input:?}");
}
}
#[test]
fn verdict_plain_text_not_misjudged() {
// 普通文本/带语气词/长句/子串形态不误判(整词精确匹配,「不同意」含「同意」靠整词防反判)
let plain = [
"你好", "我同意这个方案", "不同意这个做法", "批准吧", "通不过", "同意一下再看看",
"/status", "拒绝的理由如下", "通过率不高", "", "ok 同意吗",
];
for input in plain {
assert_eq!(parse_approval_verdict(input), None, "case {input:?}");
}
}
// ── F5-2 迟到决议窗口判定 ──
#[test]
fn resolved_window_boundary() {
// 30min 窗口内算「刚终态」(迟到决议提示),窗外视为无审批语境(普通消息语义)
assert!(within_resolved_window(1000, 1000 + 1799));
assert!(within_resolved_window(1000, 1000 + 1800 - 1));
assert!(!within_resolved_window(1000, 1000 + 1800));
assert!(!within_resolved_window(1000, 1000 + 7200));
}
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"productName": "devflow", "productName": "devflow",
"version": "0.1.2", "version": "0.1.3",
"identifier": "top.1216.devflow", "identifier": "top.1216.devflow",
"build": { "build": {
"beforeDevCommand": "bun dev", "beforeDevCommand": "bun dev",
+12 -11
View File
@@ -31,16 +31,16 @@
<!-- 走查 P3-16:全局 toast 统一收进同一纵向堆叠容器。原错误 toast 与托盘提示气泡 <!-- 走查 P3-16:全局 toast 统一收进同一纵向堆叠容器。原错误 toast 与托盘提示气泡
各自 fixed 同位(bottom:24px 居中),两者同现时互相压盖、后弹者盖住先弹者。 --> 各自 fixed 同位(bottom:24px 居中),两者同现时互相压盖、后弹者盖住先弹者。 -->
<div class="df-toast-stack"> <div class="app-toast-stack">
<!-- 全局错误 toast(根级,主窗口与分离窗口共用)--> <!-- 全局错误 toast(根级,主窗口与分离窗口共用)-->
<transition name="toast"> <transition name="toast">
<div v-if="errorMsg" class="df-toast">⚠ {{ errorMsg }}</div> <div v-if="errorMsg" class="app-toast">⚠ {{ errorMsg }}</div>
</transition> </transition>
<!-- 关窗后台运行气泡(主窗关闭被拦截且仍有会话运行时,后端 emit tray-hide-notice): <!-- 关窗后台运行气泡(主窗关闭被拦截且仍有会话运行时,后端 emit tray-hide-notice):
告知会话转入后台继续生成、托盘图标可随时唤起,复用 df-toast 形态 --> 告知会话转入后台继续生成、托盘图标可随时唤起,复用 app-toast 形态 -->
<transition name="toast"> <transition name="toast">
<div v-if="trayNoticeMsg" class="df-toast df-toast--info">{{ trayNoticeMsg }}</div> <div v-if="trayNoticeMsg" class="app-toast app-toast--info">{{ trayNoticeMsg }}</div>
</transition> </transition>
</div> </div>
@@ -114,7 +114,7 @@ watch(() => projectStore.error, (err) => {
}) })
// ── 关窗后台运行气泡(主窗关闭被拦截且仍有会话运行时,后端 emit tray-hide-notice)── // ── 关窗后台运行气泡(主窗关闭被拦截且仍有会话运行时,后端 emit tray-hide-notice)──
// 与错误 toast 同款 df-toast 形态,信息语义走 --info 变体底色,不与错误红混用 // 与错误 toast 同款 app-toast 形态,信息语义走 --info 变体底色,不与错误红混用
const trayNoticeMsg = ref('') const trayNoticeMsg = ref('')
let trayNoticeTimer: ReturnType<typeof setTimeout> | null = null let trayNoticeTimer: ReturnType<typeof setTimeout> | null = null
let _unlistenTrayHideNotice: (() => void) | null = null let _unlistenTrayHideNotice: (() => void) | null = null
@@ -353,20 +353,21 @@ onUnmounted(() => {
/* ═══ 全局 toast 纵向堆叠容器(走查 P3-16)═══ /* ═══ 全局 toast 纵向堆叠容器(走查 P3-16)═══
容器独占 fixed 定位,内部 flex 纵排 + 底对齐,多条 toast 依次向上堆叠不再同位互盖。 容器独占 fixed 定位,内部 flex 纵排 + 底对齐,多条 toast 依次向上堆叠不再同位互盖。
子项保持 .df-toast 原形态(定宽自适应),定位字段从子项上移到容器。 */ 子项 .app-toast 独立命名(2026-10-18 与 global.css .df-toast 顶部居中族撞名根治,
.df-toast-stack { 不再依赖定位覆盖对冲),主题保持根级强信号形态(实底白字)。 */
.app-toast-stack {
position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
display: flex; flex-direction: column; align-items: center; gap: 8px; display: flex; flex-direction: column; align-items: center; gap: 8px;
z-index: 9999; max-width: 90vw; pointer-events: none; z-index: 9999; max-width: 90vw; pointer-events: none;
} }
.df-toast { .app-toast {
background: var(--df-danger); color: #fff; background: var(--df-danger); color: #fff;
padding: 10px 18px; border-radius: var(--df-radius-sm); padding: 10px 18px; border-radius: var(--df-radius-sm);
font-size: 13px; max-width: 90vw; font-size: 13px; max-width: 90vw;
box-shadow: 0 4px 16px rgba(0,0,0,0.3); box-shadow: var(--df-shadow-md);
} }
.toast-enter-active, .toast-leave-active { transition: opacity 0.25s var(--df-ease), transform 0.25s var(--df-ease); } .toast-enter-active, .toast-leave-active { transition: opacity 0.25s var(--df-ease), transform 0.25s var(--df-ease); }
.toast-enter-from, .toast-leave-to { opacity: 0; transform: translateY(10px); } .toast-enter-from, .toast-leave-to { opacity: 0; transform: translateY(10px); }
/* 后台运行提示:同 df-toast 形态,信息语义用 accent 底色与错误红区分 */ /* 后台运行提示:同 app-toast 形态,信息语义用 accent 底色与错误红区分(实底需白字) */
.df-toast--info { background: var(--df-accent); } .app-toast--info { background: var(--df-accent); color: #fff; }
</style> </style>
+1 -1
View File
@@ -571,7 +571,7 @@ export interface AiMessage {
* 消息来源(958 溯源/961 轮次归属):undefined=null=桌面本端发起;'inject'=运行中 * 消息来源(958 溯源/961 轮次归属):undefined=null=桌面本端发起;'inject'=运行中
* 补充注入(961② 轮次分桶判据,归属当前轮不开新轮);'feishu'=飞书入站发起。 * 补充注入(961② 轮次分桶判据,归属当前轮不开新轮);'feishu'=飞书入站发起。
*/ */
source?: { channel: string; message_id: string; chat_id?: string; sender?: string } | null source?: { channel: string; message_id?: string; chat_id?: string; sender?: string } | null
/** /**
* 推理过程文本(DeepSeek reasoning_content / Anthropic thinking 同通道,后端落库 * 推理过程文本(DeepSeek reasoning_content / Anthropic thinking 同通道,后端落库
* ai_messages.reasoning_content)。undefined=该轮无思考内容。历史消息 reload 时 * ai_messages.reasoning_content)。undefined=该轮无思考内容。历史消息 reload 时
+40 -254
View File
@@ -53,17 +53,9 @@
<div v-if="autoCompressedFlash" class="ai-autocompressed-hint">{{ t('aiChat.autoCompressed') }}</div> <div v-if="autoCompressedFlash" class="ai-autocompressed-hint">{{ t('aiChat.autoCompressed') }}</div>
<!-- 无人值守边界配置卡(默认收起=现状零变化):发起时一次授权,生成中锁编辑 --> <!-- 无人值守边界配置卡(默认收起=现状零变化):发起时一次授权,生成中锁编辑 -->
<TaskBoundaryCard @toast="(p) => showToast(p.msg, p.type)" /> <TaskBoundaryCard @toast="(p) => showToast(p.msg, p.type)" />
<!-- AE-2025-07: Agentic 循环进度条(C 状态语义化) <!-- AE-2025-07: Agentic 循环进度条(C 状态语义化)。
仅 agentic 多轮(streaming 且收到过 AiAgentRound round>0 事件)显示; C4b 拆分至 ai-chat/agentic-progress-bar.vue(纯展示,store 单例直读,零行为变更) -->
单轮问答 agentRound 恒 0,不显示(避免误显)。 <AgenticProgressBar />
文案:第 {round} 轮 · 累计 {total} 次调用 · 进行中/待审批;
total 由前端聚合当前轮次 toolCalls(useTurnTrace),完成后进度条隐藏,
完成聚合语义由 MessageList 的执行轨迹卡承接。
降级省略:max(总轮次)后端 AiAgentRound 未透传 max_rounds,不显。 -->
<div v-if="showAgenticProgress" class="ai-agentic-progress">
<span class="ai-agentic-progress-dot"></span>
<span class="ai-agentic-progress-text">{{ agenticProgressText }}</span>
</div>
<!-- L1 求助协议(aichat 体验与 agent 能力系统化重构 §2.3,2026-06-21): <!-- L1 求助协议(aichat 体验与 agent 能力系统化重构 §2.3,2026-06-21):
断路器熔断 emit AiHelpRequired → pendingHelp(模块级 ref)→ 本卡显 reason + options 按钮供用户选。 断路器熔断 emit AiHelpRequired → pendingHelp(模块级 ref)→ 本卡显 reason + options 按钮供用户选。
机制优先 prompt 说教:代码强制熔断 + 结构化求助卡(非教 AI 主动问用户)。 --> 机制优先 prompt 说教:代码强制熔断 + 结构化求助卡(非教 AI 主动问用户)。 -->
@@ -75,46 +67,10 @@
path 挂起归一进 ToolCard 内联审批(单真相源:状态层合);关(false,兜底回退)时挂载 path 挂起归一进 ToolCard 内联审批(单真相源:状态层合);关(false,兜底回退)时挂载
DirAuthDialog 独立弹窗老链路。两路共存,appSettings 随时回退无需改代码。 --> DirAuthDialog 独立弹窗老链路。两路共存,appSettings 随时回退无需改代码。 -->
<DirAuthDialog v-if="!unifiedApproval" @toast="(p) => showToast(p.msg, p.type)" /> <DirAuthDialog v-if="!unifiedApproval" @toast="(p) => showToast(p.msg, p.type)" />
<!-- 待发送队列(生成中排队的消息,完成后自动续发;仅显示当前活跃会话的条目) --> <!-- 待发送队列(生成中排队的消息,完成后自动续发;仅显示当前活跃会话的条目)。
<div v-if="activeQueue.length > 0" class="ai-queue" :class="{ 'ai-queue--timeout': queueTimedOut }"> C4b 拆分至 ai-chat/queue-panel.vue(L2 发送韧性 + V7 排队时钟 + 队列编辑/回填随迁,
<div class="ai-queue-head"> confirm 自持同 ChatInput 模式;hasUnsentInput/fillDraft 经 props/emits 接 ChatInput ref) -->
<span class="ai-queue-title">{{ $t('aiChat.queueTitle', { n: activeQueue.length }) }}</span> <QueuePanel :has-unsent-input="hasUnsentInput" @fill-draft="onQueueFillDraft" />
<div class="ai-queue-actions">
<button v-if="queueTimedOut" class="ai-queue-force" @click="handleForceSend">{{ $t('ai.forceSendBtn') }}</button>
<button class="ai-queue-clear" @click="handleClearQueue">{{ $t('aiChat.clearQueue') }}</button>
</div>
</div>
<div class="ai-queue-list">
<div v-for="(item, idx) in activeQueue" :key="idx" class="ai-queue-item">
<!-- 编辑态只编 text:inline input,回车/失焦写回,ESC 取消 -->
<template v-if="editingQueueIdx === idx">
<span v-if="item.skill" class="ai-queue-skill">/{{ item.skill }}</span>
<input
v-model="editingQueueText"
class="ai-queue-edit-input"
type="text"
@keydown="onQueueEditKeydown"
@blur="saveEditQueued"
/>
<button class="ai-queue-btn" @mousedown.prevent="saveEditQueued" :title="$t('aiChat.queueSave')" :aria-label="$t('aiChat.queueSave')">✓</button>
<button class="ai-queue-btn" @mousedown.prevent="cancelEditQueued" :title="$t('aiChat.queueCancel')" :aria-label="$t('aiChat.queueCancel')">✕</button>
</template>
<template v-else>
<span v-if="item.skill" class="ai-queue-skill">/{{ item.skill }}</span>
<span class="ai-queue-text" :title="item.text">{{ item.text }}</span>
<!-- V7 排队时钟:该项已等待时长 m:ss(nowTick 每秒推进,入发送随队列清空即停) -->
<span class="ai-queue-wait">{{ queueItemWait(item) }}</span>
<!-- I4 队列回填:取出该项填回输入框重新编辑(从队列移除) -->
<button class="ai-queue-btn" @click="backfillQueued(idx)" :title="$t('aiChat.queueBackfill')">{{ $t('aiChat.queueBackfill') }}</button>
<!-- 编辑按钮 -->
<button class="ai-queue-btn" @click="startEditQueued(idx)" :title="$t('aiChat.queueEdit')">{{ $t('aiChat.queueEdit') }}</button>
<!-- 立即发送(打断当前+发本条) -->
<button class="ai-queue-btn" @click="handleSendQueuedNow(idx)" :title="$t('aiChat.queueSendNow')">{{ $t('aiChat.queueSendNow') }}</button>
<button class="ai-queue-x" @click="store.cancelQueued(idx)" :title="$t('common.cancel')" :aria-label="$t('common.cancel')">×</button>
</template>
</div>
</div>
</div>
<!-- 第二批抽离: ChatInput 子组件(输入框+附件+技能/实体联想+发送/停止) --> <!-- 第二批抽离: ChatInput 子组件(输入框+附件+技能/实体联想+发送/停止) -->
<ChatInput <ChatInput
ref="chatInputRef" ref="chatInputRef"
@@ -132,28 +88,14 @@
:danger-label="confirmState.dangerLabel" :danger-label="confirmState.dangerLabel"
@result="answerConfirm" @result="answerConfirm"
/> />
<!-- 错误 toast(零依赖,复用 Settings.vue 同款 reactive toast;分离窗口无 App.vue 根 toast,故本组件自管) --> <!-- 错误 toast(零依赖 useToast;分离窗口无 App.vue 根 toast,故本组件自管;样式消费全局 .df-toast 族,error 映射 danger) -->
<Transition name="ai-toast"> <Transition name="df-toast">
<div v-if="toast.visible" class="ai-toast" :class="'ai-toast-' + toast.type">{{ toast.msg }}</div> <div v-if="toast.visible" class="df-toast" :class="toast.type === 'error' ? 'df-toast--danger' : 'df-toast--' + toast.type">{{ toast.msg }}</div>
</Transition> </Transition>
<!-- I12(2026-10-05):键盘快捷键速查。Teleport 到 body 防 .ai-panel overflow 裁剪; <!-- I12(2026-10-05):键盘快捷键速查。C4b 拆分至 ai-chat/shortcuts-overlay.vue
主窗/分离窗各自实例独立渲染,入口在 TopBar ... 菜单(emit show-shortcuts) --> (Teleport 到 body 防 .ai-panel overflow 裁剪;主窗/分离窗各自实例独立渲染,
<Teleport to="body"> 入口在 TopBar ... 菜单 emit show-shortcuts;visible 状态留父供 Esc 仲裁) -->
<div v-if="shortcutsVisible" class="ai-shortcuts-mask" @click.self="shortcutsVisible = false"> <ShortcutsOverlay :visible="shortcutsVisible" @close="shortcutsVisible = false" />
<div class="ai-shortcuts-panel" role="dialog" :aria-label="t('aiChat.shortcutsTitle')">
<div class="ai-shortcuts-head">
<span class="ai-shortcuts-title">{{ t('aiChat.shortcutsTitle') }}</span>
<button class="ai-shortcuts-close" :aria-label="t('aiChat.scCloseOverlay')" @click="shortcutsVisible = false">✕</button>
</div>
<ul class="ai-shortcuts-list">
<li v-for="s in shortcuts" :key="s.key" class="ai-shortcuts-row">
<span class="ai-shortcuts-key">{{ s.key }}</span>
<span class="ai-shortcuts-act">{{ s.label }}</span>
</li>
</ul>
</div>
</div>
</Teleport>
</div> </div>
</template> </template>
@@ -176,10 +118,13 @@ import DirAuthDialog from './ai/DirAuthDialog.vue'
import { useConfirm } from '../composables/useConfirm' import { useConfirm } from '../composables/useConfirm'
import { useToast } from '../composables/useToast' import { useToast } from '../composables/useToast'
import { useProjectStore } from '../stores/project' import { useProjectStore } from '../stores/project'
import { collectTurnStats, turnMessages } from '../composables/ai/useTurnTrace'
import { useAiContext } from '../composables/ai/useAiContext' import { useAiContext } from '../composables/ai/useAiContext'
import { emitReattachToMain, registerMainReattachListener, emitOpenSettings, registerMainOpenSettingsListener } from '@/composables/ai/useAiWindow' import { emitReattachToMain, registerMainReattachListener, emitOpenSettings, registerMainOpenSettingsListener } from '@/composables/ai/useAiWindow'
import type { AiMessage } from '../api/types' import type { AiMessage, SkillInfo } from '../api/types'
// C4b 拆分(第五批): Agentic 进度条/待发送队列/快捷键速查 三自有区块抽至 ai-chat/ 子目录
import AgenticProgressBar from './ai-chat/agentic-progress-bar.vue'
import QueuePanel from './ai-chat/queue-panel.vue'
import ShortcutsOverlay from './ai-chat/shortcuts-overlay.vue'
const props = defineProps<{ const props = defineProps<{
detached?: boolean detached?: boolean
@@ -262,22 +207,7 @@ const messageListRef = ref<InstanceType<typeof MessageList> | null>(null)
// 头部审批徽标 — 当前对话积压的待审批工具数(>0 时显示) // 头部审批徽标 — 当前对话积压的待审批工具数(>0 时显示)
const pendingApprovalCount = computed(() => store.state.pendingApprovals.length) const pendingApprovalCount = computed(() => store.state.pendingApprovals.length)
// Agentic 循环进度条 // C4b: Agentic 循环进度条(显示条件+文案 computed)已随 ai-chat/agentic-progress-bar.vue 迁出
// 仅 agentic 多轮(streaming 且 agentRound>0)显示;单轮问答不收 AiAgentRound 故恒隐藏。
const showAgenticProgress = computed(() =>
store.state.streaming && store.state.agentRound > 0,
)
// 进度文案(C 状态语义化):「第 N 轮 · 累计 M 次调用 · 进行中/待审批」。
// 累计调用数由前端聚合当前轮次消息流上的 toolCalls(后端事件无累计字段,不改协议);
// 替代旧「循环 N · X个工具完成」——旧 completedTools 每轮清零,轮初叙述期恒显 0 造成歧义。
// 「已完成」态不出现在状态栏:完成后进度条隐藏(既有设计),完成聚合由执行轨迹卡承接。
const agenticProgressText = computed(() => {
const pending = store.state.pendingApprovals.length
const total = collectTurnStats(turnMessages(store.state.messages)).total
return pending > 0
? t('ai.agenticProgress', { round: store.state.agentRound, total, pending })
: t('ai.agenticProgressNoPending', { round: store.state.agentRound, total })
})
/** 点击徽标:滚动到第一个 pending_approval 卡片(委托 MessageList.scrollToFirstPending) */ /** 点击徽标:滚动到第一个 pending_approval 卡片(委托 MessageList.scrollToFirstPending) */
function scrollToFirstPending(): void { function scrollToFirstPending(): void {
@@ -337,10 +267,7 @@ const projectsStore = useProjectStore()
// 滚动边沿/跟随意图重置随 MessageList 迁移,由子组件自管。 // 滚动边沿/跟随意图重置随 MessageList 迁移,由子组件自管。
watch(() => store.state.activeConversationId, () => { watch(() => store.state.activeConversationId, () => {
if (editingMsgId.value) cancelEdit() if (editingMsgId.value) cancelEdit()
// UX-P3: 队列编辑态(editingQueueIdx/editingQueueText)绑定旧会话队列在 activeQueue // UX-P3: 队列编辑态重置已随 QueuePanel 迁出(子组件内自 watch activeConversationId)。
// 视图内的下标,切会话后 activeQueue 已换成新会话的集合,残留 idx/text 会错挂到
// 新会话同下标队列项上,随消息编辑态一并重置。
if (editingQueueIdx.value !== null) cancelEditQueued()
}) })
@@ -485,135 +412,23 @@ function onBeforeUnloadGuard(e: BeforeUnloadEvent) {
// (ChatInput 经 emit('sent')/emit('cancel-edit')/emit('error') 与父交互) // (ChatInput 经 emit('sent')/emit('cancel-edit')/emit('error') 与父交互)
// ── L2 发送韧性:排队超时检测 + 强制发送 ── // ── L2 发送韧性:排队超时检测 + 强制发送 ──
// (activeQueue 过滤视图已随 queue-panel.vue 子组件迁移,父侧死副本删除)
/** 当前活跃会话的待发送队列(按 activeConversationId 过滤)。
* 队列是全局数组,多会话并发可各自排队;旧实现渲染全部会话的 queue,切/新建后会显示
* 旧会话排队消息。此处仅显当前活跃会话条目,相关操作(编辑/删除/立即发送/清空/超时)均按此收敛。 */
const activeQueue = computed(() =>
store.state.queue.filter(q => q.conversationId === store.state.activeConversationId),
)
// ── V7 排队时钟:响应式 tick 驱动排队项已等待时长 ── // ── V7 排队时钟:响应式 tick 驱动排队项已等待时长 ──
// 原 queueWaitSeconds 在 computed 内直接取 Date.now(),非响应式依赖:纯等待期(无 store 变更) // 原 queueWaitSeconds 在 computed 内直接取 Date.now(),非响应式依赖:纯等待期(无 store 变更)
// 永不重算,秒数冻结;且只覆盖队首。改为有排队时起 1s interval 推进 nowTick,展示函数读 // 队列超时横幅/强制发送/清空/等待时钟(V7 nowTick)已随 queue-panel.vue 子组件迁移
// nowTick 建立依赖实现每秒刷新;队列清空(含队首进入发送被移除)即关表,卸载时显式清理防泄漏。 // (2026-10-18 UI 重构批,子组件自带 interval 与清理),父侧死副本删除(vue-tsc TS6133;
const nowTick = ref(Date.now()) // 旧父组件时钟在无消费方后仍每秒空转,一并消除)。
let queueTickTimer: ReturnType<typeof setInterval> | null = null
/** 队首排队是否已超 30s(仅看当前活跃会话队列)。 /** QueuePanel emit fill-draft 的父侧转发:写入 ChatInput 草稿(拆分纪律:ChatInput ref 留父) */
* UX-P2-A1:isQueueTimedOut 内取 Date.now() 非响应式,纯等待期(无 store 变更)本 computed function onQueueFillDraft(text: string, skill: SkillInfo | null) {
* 永不重算,超时横幅/强制发送按钮延迟到下一次无关 store 变更才出现。显式读 nowTick chatInputRef.value?.fillDraft(text, skill)
* (V7 排队时钟,有排队时 1s interval 推进)建立每秒依赖,超时判定随 tick 每秒重算。 */
const queueTimedOut = computed(() => {
void nowTick.value
return store.isQueueTimedOut(store.state.activeConversationId)
})
watch(
() => activeQueue.value.length > 0,
(waiting) => {
if (waiting && queueTickTimer === null) {
nowTick.value = Date.now()
queueTickTimer = setInterval(() => { nowTick.value = Date.now() }, 1000)
} else if (!waiting && queueTickTimer !== null) {
clearInterval(queueTickTimer)
queueTickTimer = null
}
},
{ immediate: true },
)
/** 秒数转 m:ss(分钟不封顶,长等待继续累计) */
function formatWaitTime(totalSeconds: number): string {
return `${Math.floor(totalSeconds / 60)}:${String(totalSeconds % 60).padStart(2, '0')}`
}
/** 排队项已等待时长(m:ss);读 nowTick 建立响应式依赖,每秒随 tick 刷新 */
function queueItemWait(item: { enqueuedAt: number }): string {
return formatWaitTime(Math.max(0, Math.floor((nowTick.value - item.enqueuedAt) / 1000)))
}
/** 强制发送:委托 tryForceSend 唯一负责弹 confirm + 移除队列 + force_send(作用于当前活跃会话) */
async function handleForceSend() {
await store.tryForceSend(confirmDialog, store.state.activeConversationId)
}
/** UI-4(看板 943)清空队列:二次确认后全清当前活跃会话排队消息。
* 一键误触会静默丢掉全部排队消息且不可恢复,复用本组件 ConfirmDialog 先例
* (同 tryForceSend 的 confirmFn 注入形态),不引 window.confirm(仓风格)。 */
async function handleClearQueue() {
const convId = store.state.activeConversationId
if (!convId) return
const confirmed = await confirmDialog(t('aiChat.clearQueueConfirm'))
if (confirmed) store.clearQueue(convId)
} }
// ── 队列消息编辑(只编 text)+ 立即发送(插队)── // ── 队列消息编辑(只编 text)+ 立即发送(插队)──
/** 当前正在编辑的队列项 index;null=非编辑态 */ // 队列编辑态(编辑中 index/文本/进取消存取)已随 queue-panel.vue 子组件迁移(2026-10-18
const editingQueueIdx = ref<number | null>(null) // UI 重构批),父组件死副本删除(vue-tsc TS6133);IME 守卫等行为在子组件内同名实现。
/** 编辑态输入框文本(回车写回 / ESC 取消还原) */
const editingQueueText = ref('')
/** 进入编辑态:记录 index + 快照当前 text(activeQueue 视图内下标) */
function startEditQueued(idx: number) {
const item = activeQueue.value[idx]
if (!item) return
editingQueueIdx.value = idx
editingQueueText.value = item.text
}
/** 取消编辑:还原非编辑态,不写回 */
function cancelEditQueued() {
editingQueueIdx.value = null
editingQueueText.value = ''
}
/** P1-1 队列编辑框键盘处理:输入法组词中(isComposing/229)的 Enter/Esc 属 IME 选词/取消组词,
* 不当提交/取消处理,防半截拼音被写回队列项。原 @keydown.enter/.esc 内联修饰符挂不了守卫,
* 收敛到本函数统一判。 */
function onQueueEditKeydown(e: KeyboardEvent) {
if (e.isComposing || e.keyCode === 229) return
if (e.key === 'Enter') {
e.preventDefault()
saveEditQueued()
} else if (e.key === 'Escape') {
e.preventDefault()
cancelEditQueued()
}
}
/** 保存编辑:回车/失焦触发,委托 store.editQueued 写回 text */
function saveEditQueued() {
if (editingQueueIdx.value === null) return
store.editQueued(editingQueueIdx.value, editingQueueText.value)
editingQueueIdx.value = null
editingQueueText.value = ''
}
/** 立即发送:委托 store.sendQueuedNow(移除+stop+sendMessage) */
async function handleSendQueuedNow(idx: number) {
await store.sendQueuedNow(idx)
}
/** I4 队列回填:取出该条填回输入框重新编辑(从队列移除,可改完再发)。
* cancelQueued 内部经 activeQueueRealIndex 做过滤视图下标映射,越界 no-op;
* 项携带技能时按名找回 SkillInfo 回挂 chip,找不到(技能已卸载)只回填文本,
* 与队列原地编辑只保 text 同一取舍。 */
async function backfillQueued(idx: number) {
const item = activeQueue.value[idx]
if (!item) return
// UX-P3: 输入框已有未发送草稿(文本/图片/技能 chip 任一非空)时回填会静默覆盖,
// 先 confirm 确认;取消则直接返回,队列项原样保留(尚未 cancelQueued)。
if (chatInputRef.value?.hasUnsentInput()) {
if (!await confirmDialog(t('aiChat.backfillOverwriteConfirm'))) return
}
const skill = item.skill
? store.state.skills.find(s => s.name === item.skill) ?? null
: null
store.cancelQueued(idx)
chatInputRef.value?.fillDraft(item.text, skill)
}
// 第四批抽离: 滚动跟随/回底部/流式 Markdown 分块渲染/工具卡自动收起/选区保持 全部随 // 第四批抽离: 滚动跟随/回底部/流式 Markdown 分块渲染/工具卡自动收起/选区保持 全部随
// MessageList 子组件迁移(零行为变更,store/useMarkdown 单例共享)。 // MessageList 子组件迁移(零行为变更,store/useMarkdown 单例共享)。
@@ -627,8 +442,7 @@ onBeforeUnmount(() => {
// 归还 listener 租约(最后一份归还才真拆单例 listener;双重归还/下溢由 useAiEvents dev 断言暴露) // 归还 listener 租约(最后一份归还才真拆单例 listener;双重归还/下溢由 useAiEvents dev 断言暴露)
_listenerRelease?.() _listenerRelease?.()
_listenerRelease = null _listenerRelease = null
// V7 排队时钟 interval 随组件卸载清理(watch 随卸载停但 interval 本体不自停,须显式清) // V7 排队时钟已随 queue-panel.vue 迁移,其 interval 由子组件 onBeforeUnmount 自清。
if (queueTickTimer !== null) { clearInterval(queueTickTimer); queueTickTimer = null }
// 全局快捷键卸载时移除 window listener,防分离窗口/切组件后泄漏 // 全局快捷键卸载时移除 window listener,防分离窗口/切组件后泄漏
window.removeEventListener('keydown', onGlobalKeydown) window.removeEventListener('keydown', onGlobalKeydown)
// 摘除未发送输入保护(分离窗口关闭/页面刷新触发 beforeunload) // 摘除未发送输入保护(分离窗口关闭/页面刷新触发 beforeunload)
@@ -786,16 +600,7 @@ async function toggleAlwaysOnTop() {
// I12(2026-10-05):顶部 ... 菜单入口(TopBar emit show-shortcuts)→ 此处 Teleport 展示速查浮层。 // I12(2026-10-05):顶部 ... 菜单入口(TopBar emit show-shortcuts)→ 此处 Teleport 展示速查浮层。
// 键位表 shortcuts 与 onGlobalKeydown 同文件同居——键区调整时表随手同步,防速查与真实键位漂移。 // 键位表 shortcuts 与 onGlobalKeydown 同文件同居——键区调整时表随手同步,防速查与真实键位漂移。
const shortcutsVisible = ref(false) const shortcutsVisible = ref(false)
// computed:随 locale 即时翻译(仅面板打开时消费,开销可忽略);t 已在本组件上方 useI18n 解构 // 键位表已随 shortcuts-overlay.vue 子组件迁移(C4b),父侧死副本删除(vue-tsc TS6133)。
const shortcuts = computed(() => [
{ key: 'Ctrl+N', label: t('aiChat.scNewConv') },
{ key: 'Ctrl+I', label: t('aiChat.scFocusInput') },
{ key: 'Ctrl+R', label: t('aiChat.scRegenerate') },
{ key: 'Ctrl+L', label: t('aiChat.scClearChat') },
{ key: 'Ctrl+K', label: t('aiChat.scSearch') },
{ key: 'Ctrl+B', label: t('aiChat.scToggleSidebar') },
{ key: 'Esc', label: t('aiChat.scCloseOverlay') },
])
function showShortcuts() { function showShortcuts() {
shortcutsVisible.value = true shortcutsVisible.value = true
} }
@@ -902,7 +707,7 @@ async function initContextEventListeners(): Promise<void> {
复用按钮抽 components.css 全局。本块仅保留 AiChat 自身元素:面板布局/聊天区/input-area 复用按钮抽 components.css 全局。本块仅保留 AiChat 自身元素:面板布局/聊天区/input-area
容器/agentic 进度/待发队列/toast。子组件元素由各子组件 scoped 负责,父级 scoped 不渗透。) ═══ */ 容器/agentic 进度/待发队列/toast。子组件元素由各子组件 scoped 负责,父级 scoped 不渗透。) ═══ */
.ai-panel { .ai-panel {
position: relative; /* 容纳 .ai-toast(absolute,相对面板定位,嵌入/分离模式均生效) */ position: relative; /* toast 已改全局 .df-toast(fixed 定位);relative 保留兜底其他绝对定位子元素 */
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 100%; height: 100%;
@@ -924,7 +729,7 @@ async function initContextEventListeners(): Promise<void> {
TopBar.vue scoped 自持 + .ai-btn-icon* 抽 components.css 全局共享, TopBar.vue scoped 自持 + .ai-btn-icon* 抽 components.css 全局共享,
原 AiChat scoped 不渗透子组件根,删此重复块零视觉变更) */ 原 AiChat scoped 不渗透子组件根,删此重复块零视觉变更) */
/* ── 「信任所有目录」放行横幅(开关开启期间常驻,warning 色系对齐 .ai-toast-warning) ── */ /* ── 「信任所有目录」放行横幅(开关开启期间常驻,warning 色系对齐 .df-toast--warning) ── */
.ai-auth-bypass-banner { .ai-auth-bypass-banner {
padding: 5px 14px; padding: 5px 14px;
background: var(--df-warning-bg); background: var(--df-warning-bg);
@@ -1054,27 +859,8 @@ async function initContextEventListeners(): Promise<void> {
/* (.ai-btn-icon:disabled / .ai-btn-spinner / @keyframes ai-btn-spin 已抽 components.css 全局共享) */ /* (.ai-btn-icon:disabled / .ai-btn-spinner / @keyframes ai-btn-spin 已抽 components.css 全局共享) */
/* ═══ 错误 toast(复用 Settings.vue .toast 样式,前缀 ai- 防 scoped 冲突) ═══ */ /* ═══ 错误 toast:消费 global.css .df-toast 四色族 + .df-toast-enter/leave 过渡
.ai-toast { (2026-10-18 整洁波双轨合一,原 .ai-toast-* 本地族删除;error 态映射 --danger) ═══ */
position: absolute;
top: 16px;
left: 50%;
transform: translateX(-50%);
padding: 8px 14px;
border-radius: var(--df-radius);
font-size: 12px;
z-index: 100;
box-shadow: 0 4px 16px rgba(0,0,0,0.3);
max-width: 80%;
overflow-wrap: anywhere;
}
.ai-toast-error { background: var(--df-danger-bg); color: var(--df-danger); border: 0.5px solid var(--df-danger); }
.ai-toast-warning { background: var(--df-warning-bg); color: var(--df-warning); border: 0.5px solid var(--df-warning); }
.ai-toast-info { background: var(--df-accent-bg); color: var(--df-accent); border: 0.5px solid var(--df-accent); }
/* ToastType 新增 'success' 兜底样式 */
.ai-toast-success { background: var(--df-success-bg); color: var(--df-success); border: 0.5px solid var(--df-success); }
.ai-toast-enter-active, .ai-toast-leave-active { transition: opacity 0.2s, transform 0.2s; }
.ai-toast-enter-from, .ai-toast-leave-to { opacity: 0; transform: translate(-50%, -8px); }
/* ═══ I12 快捷键速查面板(Teleport 到 body,scoped 对 Teleport 内容仍生效—— /* ═══ I12 快捷键速查面板(Teleport 到 body,scoped 对 Teleport 内容仍生效——
Vue scoped 把 data 属性打在编译期节点上,与挂载位置无关) ═══ */ Vue scoped 把 data 属性打在编译期节点上,与挂载位置无关) ═══ */
@@ -1091,7 +877,7 @@ async function initContextEventListeners(): Promise<void> {
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-lg, 8px); border-radius: var(--df-radius-lg, 8px);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); box-shadow: var(--df-shadow-sm);
width: 320px; width: 320px;
max-width: calc(100vw - 48px); max-width: calc(100vw - 48px);
padding: 14px 16px; padding: 14px 16px;
@@ -1116,7 +902,7 @@ async function initContextEventListeners(): Promise<void> {
padding: 2px 4px; padding: 2px 4px;
border-radius: 4px; border-radius: 4px;
} }
.ai-shortcuts-close:hover { color: var(--df-text); background: var(--df-bg-secondary); } .ai-shortcuts-close:hover { color: var(--df-text); background: var(--df-bg-card); }
.ai-shortcuts-list { .ai-shortcuts-list {
list-style: none; list-style: none;
margin: 0; margin: 0;
@@ -1132,9 +918,9 @@ async function initContextEventListeners(): Promise<void> {
font-size: 12px; font-size: 12px;
} }
.ai-shortcuts-key { .ai-shortcuts-key {
font-family: var(--df-mono, monospace); font-family: var(--df-font-mono);
font-size: 11px; font-size: 11px;
background: var(--df-bg-secondary); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: 4px; border-radius: 4px;
padding: 2px 8px; padding: 2px 8px;
+72 -50
View File
@@ -21,9 +21,9 @@
<span v-html="toolIcon(tc.name)"></span> <span v-html="toolIcon(tc.name)"></span>
</span> </span>
<div class="ai-tool-header-text"> <div class="ai-tool-header-text">
<span class="ai-tool-name">{{ toolDisplayName(tc) }}</span> <span class="ai-tool-name df-mono">{{ toolDisplayName(tc) }}</span>
<span v-if="tc.status === 'running'" class="ai-tool-sub">{{ $t('aiTool.running') }}</span> <span v-if="tc.status === 'running'" class="ai-tool-sub df-badge df-badge--info ai-tool-chip-run">{{ $t('aiTool.running') }}</span>
<span v-else-if="isFailed" class="ai-tool-sub ai-tool-sub--failed" :title="summaryTitle">{{ $t('aiTool.executionFailed') }}</span> <span v-else-if="isFailed" class="ai-tool-sub ai-tool-sub--failed df-badge df-badge--danger" :title="summaryTitle">{{ $t('aiTool.executionFailed') }}</span>
<span v-else-if="resultSummary" class="ai-tool-sub" :title="summaryTitle">{{ resultSummary }}</span> <span v-else-if="resultSummary" class="ai-tool-sub" :title="summaryTitle">{{ resultSummary }}</span>
</div> </div>
<span class="ai-tool-status-dot" :class="'ai-tool-status-dot--' + (isFailed ? 'failed' : tc.status)" :title="statusTitle"></span> <span class="ai-tool-status-dot" :class="'ai-tool-status-dot--' + (isFailed ? 'failed' : tc.status)" :title="statusTitle"></span>
@@ -31,7 +31,7 @@
hover 显绝对起止时刻,相对时间不再占卡片行(B 聚合卡统一)。 --> hover 显绝对起止时刻,相对时间不再占卡片行(B 聚合卡统一)。 -->
<span <span
v-if="durationText" v-if="durationText"
class="ai-tool-duration" class="ai-tool-duration df-mono"
:title="durationTitle" :title="durationTitle"
>{{ durationText }}</span> >{{ durationText }}</span>
<span v-if="!shouldKeepOpen(tc)" class="ai-tool-collapse-hint" :class="{ 'is-open': isExpanded }">▸</span> <span v-if="!shouldKeepOpen(tc)" class="ai-tool-collapse-hint" :class="{ 'is-open': isExpanded }">▸</span>
@@ -56,8 +56,9 @@
<!-- 审批:参数内容 + 风险提示 + 按钮 --> <!-- 审批:参数内容 + 风险提示 + 按钮 -->
<div v-if="tc.status === 'pending_approval'" class="ai-tool-approval"> <div v-if="tc.status === 'pending_approval'" class="ai-tool-approval">
<!-- 风险徽章:High 橙红/Medium 黄,一眼识别操作等级(与左侧着色条同色系) --> <!-- 风险徽章:High 橙红/Medium 黄,一眼识别操作等级(与左侧着色条同色系)
<div v-if="riskLevel !== 'low'" class="ai-tool-risk-badge" :class="'is-' + riskLevel"> wave2:迁 .df-badge 透明彩底三件套(danger/warning 变体) -->
<div v-if="riskLevel !== 'low'" class="ai-tool-risk-badge df-badge" :class="riskLevel === 'high' ? 'df-badge--danger' : 'df-badge--warning'">
{{ riskLevel === 'high' ? $t('aiTool.riskHigh') : $t('aiTool.riskMedium') }} {{ riskLevel === 'high' ? $t('aiTool.riskHigh') : $t('aiTool.riskMedium') }}
</div> </div>
<div v-if="visibleArgs.length" class="ai-tool-approval-args"> <div v-if="visibleArgs.length" class="ai-tool-approval-args">
@@ -81,7 +82,7 @@
</div> </div>
<!-- AE-2025-03: write_file 审批 diff 预览(红删绿增,行级)。旧文件不存在→tc.diff 为空,回退显上方 args content --> <!-- AE-2025-03: write_file 审批 diff 预览(红删绿增,行级)。旧文件不存在→tc.diff 为空,回退显上方 args content -->
<div v-if="tc.diff" class="ai-tool-approval-diff"> <div v-if="tc.diff" class="ai-tool-approval-diff">
<pre class="ai-tool-diff-pre"><code><span v-for="(ln, idx) in diffLines" :key="idx" class="ai-tool-diff-line" :class="'ai-tool-diff-line--' + ln.kind">{{ ln.text }}{{ '\n' }}</span></code></pre> <pre class="df-diff-pre"><code><span v-for="(ln, idx) in diffLines" :key="idx" class="df-diff-line" :class="'df-diff-line--' + ln.kind">{{ ln.text }}{{ '\n' }}</span></code></pre>
</div> </div>
<!-- path_auth 审批链阶段3b:按 tc.kind 分两组按钮。 <!-- path_auth 审批链阶段3b:按 tc.kind 分两组按钮。
- kind='path'(路径授权挂起):once/session/always/deny 四选项,调 authorizeDir - kind='path'(路径授权挂起):once/session/always/deny 四选项,调 authorizeDir
@@ -415,7 +416,7 @@ const visibleArgs = computed(() => {
不做 body 高度动画(v-show display 切换 + flex gap 会留双倍间距致布局跳变,见 ToolCardList 注释)。 */ 不做 body 高度动画(v-show display 切换 + flex gap 会留双倍间距致布局跳变,见 ToolCardList 注释)。 */
transition: border-color 0.2s var(--df-ease), box-shadow 0.2s var(--df-ease), opacity 0.2s var(--df-ease); transition: border-color 0.2s var(--df-ease), box-shadow 0.2s var(--df-ease), opacity 0.2s var(--df-ease);
} }
.ai-tool-card--pending_approval { border-color: rgba(240,199,94,0.3); box-shadow: 0 0 0 1px rgba(240,199,94,0.06); } .ai-tool-card--pending_approval { border-color: var(--df-warning-bd); box-shadow: 0 0 0 1px rgba(240,199,94,0.06); }
.ai-tool-card--completed { border-color: rgba(61,219,160,0.2); } .ai-tool-card--completed { border-color: rgba(61,219,160,0.2); }
.ai-tool-card--rejected { border-color: rgba(240,101,101,0.2); opacity: 0.55; } .ai-tool-card--rejected { border-color: rgba(240,101,101,0.2); opacity: 0.55; }
/* 工具失败态——AR-6 下 status 仍为 completed,故单独覆盖边框与 completed 区分 */ /* 工具失败态——AR-6 下 status 仍为 completed,故单独覆盖边框与 completed 区分 */
@@ -424,13 +425,17 @@ const visibleArgs = computed(() => {
.ai-tool-sub--failed { color: var(--df-danger); } .ai-tool-sub--failed { color: var(--df-danger); }
.ai-tool-rejected { .ai-tool-rejected {
display: flex; align-items: center; gap: 6px; display: flex; align-items: center; gap: 6px;
padding: 4px 10px 8px 42px; font-size: 11px; color: var(--df-danger); padding: 4px 10px 8px var(--df-icon-gutter); font-size: 11px; color: var(--df-danger);
} }
.ai-tool-rejected-icon { font-weight: 500; } .ai-tool-rejected-icon { font-weight: 500; }
/* wave2:折叠轨迹卡的展开态左边 2px 强调边(对齐 workbench cv.on 范式);
只作用于可折叠卡(completed),pending 的 data-risk 左缘与 running 强制展开态不参与 */
.ai-tool-card--completed:not(.ai-tool-card--collapsed) { border-left: 2px solid var(--df-info); }
/* -- 卡片折叠态(running/pending 始终展开,completed/rejected 默认折叠为单行 header) -- */ /* -- 卡片折叠态(running/pending 始终展开,completed/rejected 默认折叠为单行 header) -- */
.ai-tool-card--collapsed .ai-tool-header { cursor: pointer; } .ai-tool-card--collapsed .ai-tool-header { cursor: pointer; }
.ai-tool-card--collapsed .ai-tool-header:hover { background: rgba(255,255,255,0.03); } .ai-tool-card--collapsed .ai-tool-header:hover { background: var(--df-bg-card-hover); }
.ai-tool-body { overflow: hidden; } .ai-tool-body { overflow: hidden; }
.ai-tool-collapse-hint { .ai-tool-collapse-hint {
font-size: 10px; color: var(--df-text-dim); margin-left: auto; flex-shrink: 0; font-size: 10px; color: var(--df-text-dim); margin-left: auto; flex-shrink: 0;
@@ -444,9 +449,9 @@ const visibleArgs = computed(() => {
width: 24px; height: 24px; border-radius: var(--df-radius-sm); width: 24px; height: 24px; border-radius: var(--df-radius-sm);
display: flex; align-items: center; justify-content: center; flex-shrink: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
} }
.ai-tool-icon-wrap--file-read { background: rgba(94,175,240,0.12); color: var(--df-info); } .ai-tool-icon-wrap--file-read { background: var(--df-info-bg); color: var(--df-info); }
.ai-tool-icon-wrap--file-write { background: var(--df-warning-bg); color: var(--df-warning); } .ai-tool-icon-wrap--file-write { background: var(--df-warning-bg); color: var(--df-warning); }
.ai-tool-icon-wrap--dir { background: rgba(240,199,94,0.12); color: var(--df-warning); } .ai-tool-icon-wrap--dir { background: var(--df-warning-bg); color: var(--df-warning); }
.ai-tool-icon-wrap--create { background: var(--df-success-bg); color: var(--df-success); } .ai-tool-icon-wrap--create { background: var(--df-success-bg); color: var(--df-success); }
.ai-tool-icon-wrap--delete { background: var(--df-danger-bg); color: var(--df-danger); } .ai-tool-icon-wrap--delete { background: var(--df-danger-bg); color: var(--df-danger); }
.ai-tool-icon-wrap--list { background: var(--df-accent-bg); color: var(--df-accent); } .ai-tool-icon-wrap--list { background: var(--df-accent-bg); color: var(--df-accent); }
@@ -455,14 +460,40 @@ const visibleArgs = computed(() => {
display: flex; flex-direction: row; flex-wrap: wrap; align-items: baseline; display: flex; flex-direction: row; flex-wrap: wrap; align-items: baseline;
column-gap: 8px; row-gap: 1px; flex: 1; min-width: 0; column-gap: 8px; row-gap: 1px; flex: 1; min-width: 0;
} }
/* wave2:工具名迁 mono 元数据(df-mono 接管字体,此处 10px dim 收敛视觉) */
.ai-tool-name { .ai-tool-name {
font-size: 12px; font-weight: 500; color: var(--df-text); font-size: 10px; font-weight: 500; color: var(--df-text-dim);
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0;
} }
.ai-tool-sub { .ai-tool-sub {
font-size: 10px; color: var(--df-text-dim); font-size: 10px; color: var(--df-text-dim);
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
} }
/* wave2:状态 chip 迁 .df-badge(running=info+脉冲点 / failed=danger);
scoped 双类压过 .ai-tool-sub 灰字,色板与 df-badge 变体对齐(token 化) */
.ai-tool-sub.df-badge {
font-size: 10px;
padding: 1px 6px;
line-height: 16px;
}
.ai-tool-sub.df-badge--info {
background: var(--df-info-bg);
color: var(--df-info);
border-color: color-mix(in srgb, var(--df-info) 30%, transparent);
}
.ai-tool-sub.df-badge--danger {
background: var(--df-danger-bg);
color: var(--df-danger);
border-color: color-mix(in srgb, var(--df-danger) 30%, transparent);
}
/* running chip 内嵌脉冲点(全局 df-pulse 节奏,对齐 df-dot--run 活性语义) */
.ai-tool-chip-run::before {
content: '';
width: 5px; height: 5px; border-radius: 50%;
background: var(--df-info);
flex-shrink: 0;
animation: df-pulse 1.5s infinite;
}
/* -- Status dot (脉冲动画) -- */ /* -- Status dot (脉冲动画) -- */
.ai-tool-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; } .ai-tool-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
@@ -487,16 +518,16 @@ const visibleArgs = computed(() => {
.ai-tool-status-dot--rejected { background: var(--df-danger); } .ai-tool-status-dot--rejected { background: var(--df-danger); }
/* -- Skeleton (running 状态) -- */ /* -- Skeleton (running 状态) -- */
.ai-tool-skeleton { padding: 4px 10px 10px 42px; display: flex; flex-direction: column; gap: 5px; } .ai-tool-skeleton { padding: 4px 10px 10px var(--df-icon-gutter); display: flex; flex-direction: column; gap: 5px; }
.ai-tool-skeleton-line { .ai-tool-skeleton-line {
height: 8px; border-radius: var(--df-radius-xs); height: 8px; border-radius: var(--df-radius-xs);
background: linear-gradient(90deg, var(--df-bg) 25%, var(--df-bg-card-hover) 50%, var(--df-bg) 75%); background: linear-gradient(90deg, var(--df-bg) 25%, var(--df-bg-card-hover) 50%, var(--df-bg) 75%);
background-size: 200% 100%; animation: shimmer 1.5s infinite; background-size: 200% 100%; animation: df-shimmer 1.5s infinite;
} }
/* -- 实时流式输出(running 态:run_command 行 / ask_uclaw 进度块) -- */ /* -- 实时流式输出(running 态:run_command 行 / ask_uclaw 进度块) -- */
.ai-tool-stream { .ai-tool-stream {
padding: 4px 10px 10px 42px; padding: 4px 10px 10px var(--df-icon-gutter);
display: flex; flex-direction: column; gap: 2px; display: flex; flex-direction: column; gap: 2px;
max-height: 160px; overflow-y: auto; max-height: 160px; overflow-y: auto;
} }
@@ -507,53 +538,47 @@ const visibleArgs = computed(() => {
white-space: pre-wrap; word-break: break-all; white-space: pre-wrap; word-break: break-all;
} }
.ai-tool-stream-more { .ai-tool-stream-more {
font-size: 10px; color: var(--df-text-tertiary); font-size: 10px; color: var(--df-text-dim);
padding-top: 2px; font-style: italic; padding-top: 2px; font-style: italic;
} }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
/* -- 审批参数展示 -- */ /* -- 审批参数展示 -- */
.ai-tool-approval-args { .ai-tool-approval-args {
padding: 4px 10px 6px; margin-bottom: 6px; padding: 4px 10px 6px; margin-bottom: 6px;
border-top: 0.5px solid var(--df-border); border-bottom: 0.5px solid var(--df-border); border-top: 0.5px solid var(--df-border); border-bottom: 0.5px solid var(--df-border);
background: var(--df-bg-elevated, rgba(0, 0, 0, 0.03)); background: var(--df-bg);
} }
.ai-tool-arg { display: flex; gap: 8px; padding: 2px 0; font-size: 11px; line-height: 1.5; } .ai-tool-arg { display: flex; gap: 8px; padding: 2px 0; font-size: 11px; line-height: 1.5; }
.ai-tool-arg-key { flex-shrink: 0; min-width: 64px; color: var(--df-text-secondary); font-family: var(--df-font-mono); } .ai-tool-arg-key { flex-shrink: 0; min-width: 64px; color: var(--df-text-secondary); font-family: var(--df-font-mono); }
.ai-tool-arg-val { flex: 1; word-break: break-all; white-space: pre-wrap; font-family: var(--df-font-mono); color: var(--df-text-primary); } .ai-tool-arg-val { flex: 1; word-break: break-all; white-space: pre-wrap; font-family: var(--df-font-mono); color: var(--df-text); }
.ai-tool-approval-reason { .ai-tool-approval-reason {
padding: 4px 10px 6px; margin-bottom: 6px; font-size: 11px; padding: 4px 10px 6px; margin-bottom: 6px; font-size: 11px;
color: var(--df-warning, #d97706); background: var(--df-warning-bg, rgba(217, 119, 6, 0.08)); color: var(--df-warning); background: var(--df-warning-bg);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm);
} }
/* 审批挂起时长提示(>2分钟橙色,>5分钟红色) */ /* 审批挂起时长提示(>2分钟橙色,>5分钟红色) */
.ai-tool-wait-time { .ai-tool-wait-time {
padding: 3px 10px; margin-bottom: 6px; font-size: 11px; padding: 3px 10px; margin-bottom: 6px; font-size: 11px;
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
color: var(--df-text-dim, #888); color: var(--df-text-dim);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm);
} }
.ai-tool-wait-time.is-long { .ai-tool-wait-time.is-long {
color: var(--df-warning, #d97706); color: var(--df-warning);
animation: pulseGlow 1.5s ease-in-out infinite; animation: pulseGlow 1.5s ease-in-out infinite;
} }
.ai-tool-wait-time.is-urgent { .ai-tool-wait-time.is-urgent {
color: var(--df-danger, #e5484d); color: var(--df-danger);
animation: pulseGlow 1s ease-in-out infinite; animation: pulseGlow 1s ease-in-out infinite;
} }
/* write_file 审批 diff 预览区(红删绿增行级) */ /* write_file 审批 diff 预览区(红删绿增行级);
基类 .df-diff-pre(+code)/.df-diff-line 消费 global.css 共享定义,此处仅留行配色变体 */
.ai-tool-approval-diff { margin: 0 10px 8px; border: 0.5px solid var(--df-border); border-radius: var(--df-radius-sm, 4px); overflow: hidden; } .ai-tool-approval-diff { margin: 0 10px 8px; border: 0.5px solid var(--df-border); border-radius: var(--df-radius-sm, 4px); overflow: hidden; }
.ai-tool-diff-pre { .df-diff-line--add { color: var(--df-success); background: var(--df-success-bg); }
margin: 0; padding: 6px 0; max-height: 240px; overflow: auto; .df-diff-line--del { color: var(--df-danger); background: var(--df-danger-bg); }
font-family: var(--df-font-mono); font-size: 11px; line-height: 1.5; background: var(--df-bg-card); .df-diff-line--ctx { color: var(--df-text-dim); }
}
.ai-tool-diff-pre code { display: block; white-space: pre; }
.ai-tool-diff-line { display: block; padding: 0 10px; white-space: pre-wrap; word-break: break-all; }
.ai-tool-diff-line--add { color: var(--df-success, #3ddb9c); background: var(--df-success-bg, rgba(61, 219, 160, 0.08)); }
.ai-tool-diff-line--del { color: var(--df-danger, #f06565); background: var(--df-danger-bg, rgba(240, 101, 101, 0.08)); }
.ai-tool-diff-line--ctx { color: var(--df-text-dim, #888); }
/* -- 审批按钮 -- */ /* -- 审批按钮 -- */
.ai-tool-actions { display: flex; gap: 6px; padding: 0 10px 8px; } .ai-tool-actions { display: flex; gap: 6px; padding: 0 10px 8px; }
@@ -566,11 +591,11 @@ const visibleArgs = computed(() => {
.ai-tool-btn--approve:hover { background: var(--df-success); color: #fff; border-color: var(--df-success); } .ai-tool-btn--approve:hover { background: var(--df-success); color: #fff; border-color: var(--df-success); }
/* M4:session 按钮(accent 描边态,介于 approve 弱背景与 always 强 warning 之间;对齐 DirAuthDialog session 语义) */ /* M4:session 按钮(accent 描边态,介于 approve 弱背景与 always 强 warning 之间;对齐 DirAuthDialog session 语义) */
.ai-tool-btn--session { .ai-tool-btn--session {
background: var(--df-accent-bg, rgba(123, 111, 240, 0.12)); background: var(--df-accent-bg);
color: var(--df-accent, #7b6ff0); color: var(--df-accent);
border-color: color-mix(in srgb, var(--df-accent, #7b6ff0) 40%, transparent); border-color: color-mix(in srgb, var(--df-accent) 40%, transparent);
} }
.ai-tool-btn--session:hover { background: var(--df-accent, #7b6ff0); color: #fff; border-color: var(--df-accent, #7b6ff0); } .ai-tool-btn--session:hover { background: var(--df-accent); color: #fff; border-color: var(--df-accent); }
/* path_auth 审批链阶段3b:always 按钮(warning 色调,与 DirAuthDialog.vue 同款语义) */ /* path_auth 审批链阶段3b:always 按钮(warning 色调,与 DirAuthDialog.vue 同款语义) */
.ai-tool-btn--always { background: var(--df-warning-bg); color: var(--df-warning); } .ai-tool-btn--always { background: var(--df-warning-bg); color: var(--df-warning); }
.ai-tool-btn--always:hover { background: var(--df-warning); color: #000; border-color: var(--df-warning); } .ai-tool-btn--always:hover { background: var(--df-warning); color: #000; border-color: var(--df-warning); }
@@ -587,15 +612,14 @@ const visibleArgs = computed(() => {
.ai-tool-btn-icon :deep(svg) { display: block; } .ai-tool-btn-icon :deep(svg) { display: block; }
.ai-tool-btn-spinner { .ai-tool-btn-spinner {
width: 12px; height: 12px; border: 1.5px solid currentColor; border-top-color: transparent; width: 12px; height: 12px; border: 1.5px solid currentColor; border-top-color: transparent;
border-radius: 50%; display: inline-block; flex-shrink: 0; animation: aiToolBtnSpin 0.7s linear infinite; border-radius: 50%; display: inline-block; flex-shrink: 0; animation: df-spin 0.7s linear infinite;
} }
@keyframes aiToolBtnSpin { to { transform: rotate(360deg); } }
/* -- 审批 loading 超时兜底 toast(复用 AiChat 同款视觉 token) -- */ /* -- 审批 loading 超时兜底 toast(复用 AiChat 同款视觉 token) -- */
.ai-tool-toast { .ai-tool-toast {
position: absolute; top: 6px; left: 50%; transform: translateX(-50%); position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
padding: 6px 12px; border-radius: var(--df-radius-sm); font-size: 11px; z-index: 100; padding: 6px 12px; border-radius: var(--df-radius-sm); font-size: 11px; z-index: 100;
box-shadow: 0 4px 16px rgba(0,0,0,0.3); max-width: 90%; overflow-wrap: anywhere; pointer-events: none; box-shadow: var(--df-shadow-sm); max-width: 90%; overflow-wrap: anywhere; pointer-events: none;
} }
.ai-tool-toast--warning { background: var(--df-warning-bg); color: var(--df-warning); border: 0.5px solid var(--df-warning); } .ai-tool-toast--warning { background: var(--df-warning-bg); color: var(--df-warning); border: 0.5px solid var(--df-warning); }
.ai-tool-toast-enter-active, .ai-tool-toast-leave-active { transition: opacity 0.2s, transform 0.2s; } .ai-tool-toast-enter-active, .ai-tool-toast-leave-active { transition: opacity 0.2s, transform 0.2s; }
@@ -605,15 +629,13 @@ const visibleArgs = computed(() => {
.ai-tool-card[data-risk='high'] { border-left: 2px solid var(--df-danger); } .ai-tool-card[data-risk='high'] { border-left: 2px solid var(--df-danger); }
.ai-tool-card[data-risk='medium'] { border-left: 2px solid var(--df-warning); } .ai-tool-card[data-risk='medium'] { border-left: 2px solid var(--df-warning); }
/* -- 风险徽章(审批区首行,High 橙红底/Medium 黄底,10px 大写字距) -- */ /* -- 风险徽章(审批区首行):wave2 迁 .df-badge 透明彩底(danger/warning 变体接管配色),
此处只留布局(独立成行+外边距) -- */
.ai-tool-risk-badge { .ai-tool-risk-badge {
display: inline-flex; align-items: center; align-self: flex-start; align-self: flex-start;
padding: 2px 8px; margin: 6px 10px 0; margin: 6px 10px 0;
font-size: 10px; font-weight: 600; letter-spacing: 0.5px; font-weight: 600; letter-spacing: 0.5px;
border-radius: var(--df-radius-sm);
} }
.ai-tool-risk-badge.is-high { background: var(--df-danger-bg); color: var(--df-danger); border: 0.5px solid color-mix(in srgb, var(--df-danger) 40%, transparent); }
.ai-tool-risk-badge.is-medium { background: var(--df-warning-bg); color: var(--df-warning); border: 0.5px solid color-mix(in srgb, var(--df-warning) 40%, transparent); }
/* 审批区改纵向 flex(徽章需独立成行,原块级布局不变) */ /* 审批区改纵向 flex(徽章需独立成行,原块级布局不变) */
.ai-tool-approval { display: flex; flex-direction: column; } .ai-tool-approval { display: flex; flex-direction: column; }
+9 -18
View File
@@ -13,8 +13,8 @@
<button class="ai-btn ai-btn--sm ai-btn--danger" :disabled="batchProcessing" @click="$emit('batch-approve', 'reject')"> <button class="ai-btn ai-btn--sm ai-btn--danger" :disabled="batchProcessing" @click="$emit('batch-approve', 'reject')">
{{ $t('aiTool.rejectAll') }} {{ $t('aiTool.rejectAll') }}
</button> </button>
<!-- High 风险计数徽标:批量批准将二次确认的项数,提示操作后果 --> <!-- High 风险计数徽标:批量批准将二次确认的项数,提示操作后果(wave2 迁 .df-badge danger) -->
<span v-if="highRiskPendingCount > 0" class="ai-batch-high-risk-hint"> <span v-if="highRiskPendingCount > 0" class="ai-batch-high-risk-hint df-badge df-badge--danger">
{{ $t('aiTool.batchHighRiskHint', { n: highRiskPendingCount }) }} {{ $t('aiTool.batchHighRiskHint', { n: highRiskPendingCount }) }}
</span> </span>
</div> </div>
@@ -26,8 +26,8 @@
<div v-if="group.calls.length >= 2" class="ai-tool-group-header" @click="toggleGroupCollapse(gi)"> <div v-if="group.calls.length >= 2" class="ai-tool-group-header" @click="toggleGroupCollapse(gi)">
<span class="ai-tool-group-icon" v-html="groupIcon(group.name)"></span> <span class="ai-tool-group-icon" v-html="groupIcon(group.name)"></span>
<span class="ai-tool-group-name">{{ groupDisplayName(group) }}</span> <span class="ai-tool-group-name">{{ groupDisplayName(group) }}</span>
<!-- R7 组头失败徽标:折叠组内失败卡不展开也能从组头发现(红字计数) --> <!-- R7 组头失败徽标:折叠组内失败卡不展开也能从组头发现(wave2 迁 .df-badge danger) -->
<span v-if="groupFailCounts[gi] > 0" class="ai-tool-group-fail">{{ $t('aiTool.groupFailCount', { n: groupFailCounts[gi] }) }}</span> <span v-if="groupFailCounts[gi] > 0" class="ai-tool-group-fail df-badge df-badge--danger">{{ $t('aiTool.groupFailCount', { n: groupFailCounts[gi] }) }}</span>
<span class="ai-tool-group-chevron" :class="{ 'is-open': !isGroupCollapsed(gi) }">▸</span> <span class="ai-tool-group-chevron" :class="{ 'is-open': !isGroupCollapsed(gi) }">▸</span>
</div> </div>
<ToolCard <ToolCard
@@ -451,23 +451,17 @@ function groupIcon(name: string): string {
gap: 8px; gap: 8px;
} }
/* -- 批量操作栏 -- */ /* -- 批量操作栏(wave2:白透明底残留改 token,浅色主题成立) -- */
.ai-batch-approve { .ai-batch-approve {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
padding: 6px 10px; padding: 6px 10px;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: rgba(255,255,255,0.02); background: var(--df-bg-card);
} }
/* 批量批准将二次确认的 High 风险项数徽标(橙红警示,不抢按钮焦点) */ /* 批量批准将二次确认的 High 风险项数徽标:配色由 df-badge--danger 接管,此处只留布局 */
.ai-batch-high-risk-hint { .ai-batch-high-risk-hint {
font-size: 10px;
color: var(--df-danger);
background: var(--df-danger-bg);
border: 0.5px solid color-mix(in srgb, var(--df-danger) 40%, transparent);
border-radius: var(--df-radius-sm);
padding: 2px 8px;
white-space: nowrap; white-space: nowrap;
} }
/* .ai-btn 基类:批量审批按钮(历史重构遗漏定义,补全治本) */ /* .ai-btn 基类:批量审批按钮(历史重构遗漏定义,补全治本) */
@@ -512,16 +506,13 @@ function groupIcon(name: string): string {
color: var(--df-text-secondary); color: var(--df-text-secondary);
} }
.ai-tool-group-header:hover { .ai-tool-group-header:hover {
background: rgba(255,255,255,0.03); background: var(--df-bg-card-hover);
} }
/* R7 组头失败徽标:失败计数红字,margin-left auto 推到 chevron 之前右对齐 */ /* R7 组头失败徽标:配色由 df-badge--danger 接管,此处只留布局(右对齐推到 chevron 前) */
.ai-tool-group-fail { .ai-tool-group-fail {
margin-left: auto; margin-left: auto;
margin-right: 2px; margin-right: 2px;
font-size: 10px;
font-weight: 600; font-weight: 600;
color: var(--df-danger);
opacity: 0.9;
white-space: nowrap; white-space: nowrap;
} }
.ai-tool-group-icon { .ai-tool-group-icon {
+29 -47
View File
@@ -120,12 +120,12 @@
<span v-if="typeof parsed?.encoding === 'string' && parsed.encoding !== 'utf-8'" class="ai-tool-write-meta">{{ $t('aiTool.encodingLabel', { enc: parsed.encoding }) }}</span> <span v-if="typeof parsed?.encoding === 'string' && parsed.encoding !== 'utf-8'" class="ai-tool-write-meta">{{ $t('aiTool.encodingLabel', { enc: parsed.encoding }) }}</span>
<!-- R12(2026-10-05):覆盖写入的行级 diff 回看(后端 diff 字段,新建/base64 为 null 不渲染) --> <!-- R12(2026-10-05):覆盖写入的行级 diff 回看(后端 diff 字段,新建/base64 为 null 不渲染) -->
<div v-if="resultDiffLines.length" class="ai-tool-write-diff"> <div v-if="resultDiffLines.length" class="ai-tool-write-diff">
<pre class="ai-tool-diff-pre"><code><span v-for="(ln, idx) in resultDiffLines" :key="idx" class="ai-tool-diff-line" :class="'ai-tool-diff-line--' + ln.kind">{{ ln.text }}{{ '\n' }}</span></code></pre> <pre class="df-diff-pre"><code><span v-for="(ln, idx) in resultDiffLines" :key="idx" class="df-diff-line" :class="'df-diff-line--' + ln.kind">{{ ln.text }}{{ '\n' }}</span></code></pre>
<button v-if="diffTotal > DIFF_PREVIEW_LINES" type="button" class="ai-tool-diff-toggle" @click="diffExpanded = !diffExpanded">{{ diffExpanded ? $t('aiTool.diffCollapse') : $t('aiTool.diffExpand', { n: diffTotal }) }}</button> <button v-if="diffTotal > DIFF_PREVIEW_LINES" type="button" class="ai-tool-diff-toggle" @click="diffExpanded = !diffExpanded">{{ diffExpanded ? $t('aiTool.diffCollapse') : $t('aiTool.diffExpand', { n: diffTotal }) }}</button>
</div> </div>
</div> </div>
<!-- patch_file 结果:文件路径/字节增减 + unified diff 红删绿增行级预览(复用 ai-tool-diff-pre/--add/--del/--ctx 既有样式) <!-- patch_file 结果:文件路径/字节增减 + unified diff 红删绿增行级预览(复用 df-diff-pre/--add/--del/--ctx 样式)
后端 generate_diff 产完整 diff,result.diff 字段此前被丢弃,用户无法验证改了什么 → 此分支渲染 diff --> 后端 generate_diff 产完整 diff,result.diff 字段此前被丢弃,用户无法验证改了什么 → 此分支渲染 diff -->
<div v-else-if="tc.name === 'patch_file' && tc.result && tc.status === 'completed' && parsed" class="ai-tool-patch-result"> <div v-else-if="tc.name === 'patch_file' && tc.result && tc.status === 'completed' && parsed" class="ai-tool-patch-result">
<div class="ai-tool-file-bar"> <div class="ai-tool-file-bar">
@@ -136,7 +136,7 @@
</div> </div>
<div v-if="parsed?.warning" class="ai-tool-approval-reason"><span aria-hidden="true">⚠</span> {{ parsed.warning }}</div> <div v-if="parsed?.warning" class="ai-tool-approval-reason"><span aria-hidden="true">⚠</span> {{ parsed.warning }}</div>
<div v-if="resultDiffLines.length" class="ai-tool-approval-diff"> <div v-if="resultDiffLines.length" class="ai-tool-approval-diff">
<pre class="ai-tool-diff-pre"><code><span v-for="(ln, idx) in resultDiffLines" :key="idx" class="ai-tool-diff-line" :class="'ai-tool-diff-line--' + ln.kind">{{ ln.text }}{{ '\n' }}</span></code></pre> <pre class="df-diff-pre"><code><span v-for="(ln, idx) in resultDiffLines" :key="idx" class="df-diff-line" :class="'df-diff-line--' + ln.kind">{{ ln.text }}{{ '\n' }}</span></code></pre>
<!-- R12a:长 diff 展开入口(默认预览 120 行,点开全量) --> <!-- R12a:长 diff 展开入口(默认预览 120 行,点开全量) -->
<button v-if="diffTotal > DIFF_PREVIEW_LINES" type="button" class="ai-tool-diff-toggle" @click="diffExpanded = !diffExpanded">{{ diffExpanded ? $t('aiTool.diffCollapse') : $t('aiTool.diffExpand', { n: diffTotal }) }}</button> <button v-if="diffTotal > DIFF_PREVIEW_LINES" type="button" class="ai-tool-diff-toggle" @click="diffExpanded = !diffExpanded">{{ diffExpanded ? $t('aiTool.diffCollapse') : $t('aiTool.diffExpand', { n: diffTotal }) }}</button>
</div> </div>
@@ -468,7 +468,7 @@ watch(() => props.tc.status, (s) => {
} }
.ai-tool-grep-match { .ai-tool-grep-match {
padding: 3px 12px; padding: 3px 12px;
border-bottom: 0.5px solid rgba(255,255,255,0.03); border-bottom: 0.5px solid var(--df-hover);
} }
.ai-tool-grep-match:last-child { .ai-tool-grep-match:last-child {
border-bottom: none; border-bottom: none;
@@ -511,7 +511,7 @@ watch(() => props.tc.status, (s) => {
word-break: break-all; word-break: break-all;
background: rgba(61,219,160,0.05); background: rgba(61,219,160,0.05);
padding: 2px 6px; padding: 2px 6px;
border-radius: var(--df-radius-xs, 3px); border-radius: var(--df-radius-xs);
} }
.ai-tool-grep-context { .ai-tool-grep-context {
margin: 2px 0 0; margin: 2px 0 0;
@@ -521,8 +521,8 @@ watch(() => props.tc.status, (s) => {
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 10px; font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
background: rgba(255,255,255,0.02); background: var(--df-hover);
border-radius: var(--df-radius-xs, 3px); border-radius: var(--df-radius-xs);
} }
.ai-tool-grep-context code { .ai-tool-grep-context code {
display: block; display: block;
@@ -533,7 +533,7 @@ watch(() => props.tc.status, (s) => {
font-family: var(--df-font-sans); font-family: var(--df-font-sans);
font-size: 10px; font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
background: rgba(255,255,255,0.04); background: var(--df-hover);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
padding: 2px 8px; padding: 2px 8px;
@@ -586,13 +586,13 @@ watch(() => props.tc.status, (s) => {
.ai-tool-dir-entry { .ai-tool-dir-entry {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 7px; gap: 6px;
padding: 3px 12px; padding: 3px 12px;
font-size: 11px; font-size: 11px;
transition: background 0.1s; transition: background 0.1s;
} }
.ai-tool-dir-entry:hover { .ai-tool-dir-entry:hover {
background: rgba(255,255,255,0.03); background: var(--df-hover);
} }
.ai-tool-dir-entry--directory .ai-tool-dir-name { .ai-tool-dir-entry--directory .ai-tool-dir-name {
font-weight: 500; font-weight: 500;
@@ -650,8 +650,8 @@ watch(() => props.tc.status, (s) => {
padding: 4px 10px 6px; padding: 4px 10px 6px;
margin-bottom: 6px; margin-bottom: 6px;
font-size: 11px; font-size: 11px;
color: var(--df-warning, #d97706); color: var(--df-warning);
background: var(--df-warning-bg, rgba(217, 119, 6, 0.08)); background: var(--df-warning-bg);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm, 4px);
} }
.ai-tool-approval-diff { .ai-tool-approval-diff {
@@ -660,29 +660,11 @@ watch(() => props.tc.status, (s) => {
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm, 4px);
overflow: hidden; overflow: hidden;
} }
.ai-tool-diff-pre { /* diff 基类 .df-diff-pre(+code)/.df-diff-line 消费 global.css 共享定义(2026-10-18 整洁波
margin: 0; 双轨合一,与 ToolCard.vue 审批 diff 同源),此处仅留行配色变体 */
padding: 6px 0; .df-diff-line--add { color: var(--df-success); background: var(--df-success-bg); }
max-height: 240px; .df-diff-line--del { color: var(--df-danger); background: var(--df-danger-bg); }
overflow: auto; .df-diff-line--ctx { color: var(--df-text-dim); }
font-family: var(--df-font-mono);
font-size: 11px;
line-height: 1.5;
background: var(--df-bg-card);
}
.ai-tool-diff-pre code {
display: block;
white-space: pre;
}
.ai-tool-diff-line {
display: block;
padding: 0 10px;
white-space: pre-wrap;
word-break: break-all;
}
.ai-tool-diff-line--add { color: var(--df-success, #3ddb9c); background: var(--df-success-bg, rgba(61, 219, 160, 0.08)); }
.ai-tool-diff-line--del { color: var(--df-danger, #f06565); background: var(--df-danger-bg, rgba(240, 101, 101, 0.08)); }
.ai-tool-diff-line--ctx { color: var(--df-text-dim, #888); }
/* -- Generic Result -- /* -- Generic Result --
max-height 100px→200px:通用结果常含 JSON/结构化文本,100px 仅约 5 行,默认滚动条挤压可读性; max-height 100px→200px:通用结果常含 JSON/结构化文本,100px 仅约 5 行,默认滚动条挤压可读性;
@@ -741,12 +723,12 @@ watch(() => props.tc.status, (s) => {
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: transparent; background: transparent;
color: var(--df-text-dim); color: var(--df-text-dim);
font-size: 10.5px; font-size: 10px;
cursor: pointer; cursor: pointer;
} }
.ai-tool-cmd-toggle:hover { .ai-tool-cmd-toggle:hover {
color: var(--df-text); color: var(--df-text);
background: var(--df-bg-hover, rgba(255,255,255,0.06)); background: var(--df-hover);
} }
.ai-tool-cmd-output { .ai-tool-cmd-output {
margin: 0; margin: 0;
@@ -803,8 +785,8 @@ watch(() => props.tc.status, (s) => {
} }
.ai-tool-http-trunc-warn { .ai-tool-http-trunc-warn {
padding: 4px 10px; padding: 4px 10px;
font-size: 10.5px; font-size: 10px;
color: var(--df-warning, #f0c75e); color: var(--df-warning);
border-top: 0.5px solid var(--df-border); border-top: 0.5px solid var(--df-border);
} }
@@ -828,10 +810,10 @@ watch(() => props.tc.status, (s) => {
} }
.ai-tool-fetch-mode--static, .ai-tool-fetch-mode--static,
.ai-tool-fetch-mode--obscura { .ai-tool-fetch-mode--obscura {
color: var(--df-success, #3ddb9c); color: var(--df-success);
} }
.ai-tool-fetch-mode--static_fallback { .ai-tool-fetch-mode--static_fallback {
color: var(--df-warning, #f0c75e); color: var(--df-warning);
} }
.ai-tool-fetch-title { .ai-tool-fetch-title {
padding: 4px 10px 2px; padding: 4px 10px 2px;
@@ -845,8 +827,8 @@ watch(() => props.tc.status, (s) => {
.ai-tool-obscura-hint { .ai-tool-obscura-hint {
margin: 4px 10px 6px; margin: 4px 10px 6px;
padding: 6px 8px; padding: 6px 8px;
background: var(--df-warning-bg, rgba(240,199,94,0.08)); background: var(--df-warning-bg);
border: 0.5px solid var(--df-warning, #f0c75e); border: 0.5px solid var(--df-warning);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm, 4px);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -854,8 +836,8 @@ watch(() => props.tc.status, (s) => {
} }
.ai-tool-obscura-hint-text { .ai-tool-obscura-hint-text {
font-family: var(--df-font-sans); font-family: var(--df-font-sans);
font-size: 10.5px; font-size: 10px;
color: var(--df-warning, #f0c75e); color: var(--df-warning);
line-height: 1.5; line-height: 1.5;
word-break: break-word; word-break: break-word;
} }
@@ -870,7 +852,7 @@ watch(() => props.tc.status, (s) => {
font-weight: 500; font-weight: 500;
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm, 4px);
border: none; border: none;
background: var(--df-accent, #5b8def); background: var(--df-accent);
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
font-family: var(--df-font-sans); font-family: var(--df-font-sans);
@@ -891,5 +873,5 @@ watch(() => props.tc.status, (s) => {
padding: 3px 12px; padding: 3px 12px;
cursor: pointer; cursor: pointer;
} }
.ai-tool-diff-toggle:hover { color: var(--df-text); background: var(--df-bg-secondary); } .ai-tool-diff-toggle:hover { color: var(--df-text); background: var(--df-bg-card); }
</style> </style>
@@ -0,0 +1,72 @@
<template>
<!-- AE-2025-07: Agentic 循环进度条(C 状态语义化)
仅 agentic 多轮(streaming 且收到过 AiAgentRound round>0 事件)显示;
单轮问答 agentRound 恒 0,不显示(避免误显)。
文案:第 {round} 轮 · 累计 {total} 次调用 · 进行中/待审批;
total 由前端聚合当前轮次 toolCalls(useTurnTrace),完成后进度条隐藏,
完成聚合语义由 MessageList 的执行轨迹卡承接。
降级省略:max(总轮次)后端 AiAgentRound 未透传 max_rounds,不显。
C4b 拆分自 AiChat.vue(纯展示,store 单例直读,零行为变更)。 -->
<div v-if="showAgenticProgress" class="ai-agentic-progress">
<span class="ai-agentic-progress-dot"></span>
<span class="ai-agentic-progress-text">{{ agenticProgressText }}</span>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { useAiStore } from '../../stores/ai'
import { collectTurnStats, turnMessages } from '../../composables/ai/useTurnTrace'
const store = useAiStore()
const { t } = useI18n()
// 仅 agentic 多轮(streaming 且 agentRound>0)显示;单轮问答不收 AiAgentRound 故恒隐藏。
const showAgenticProgress = computed(() =>
store.state.streaming && store.state.agentRound > 0,
)
// 进度文案(C 状态语义化):「第 N 轮 · 累计 M 次调用 · 进行中/待审批」。
// 累计调用数由前端聚合当前轮次消息流上的 toolCalls(后端事件无累计字段,不改协议);
// 替代旧「循环 N · X个工具完成」——旧 completedTools 每轮清零,轮初叙述期恒显 0 造成歧义。
// 「已完成」态不出现在状态栏:完成后进度条隐藏(既有设计),完成聚合由执行轨迹卡承接。
const agenticProgressText = computed(() => {
const pending = store.state.pendingApprovals.length
const total = collectTurnStats(turnMessages(store.state.messages)).total
return pending > 0
? t('ai.agenticProgress', { round: store.state.agentRound, total, pending })
: t('ai.agenticProgressNoPending', { round: store.state.agentRound, total })
})
</script>
<style scoped>
/* ═══ Agentic 循环进度条(样式随区块自 AiChat.vue 迁入,零视觉变更) ═══ */
.ai-agentic-progress {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 6px;
padding: 3px 8px;
background: color-mix(in srgb, var(--df-accent) 8%, transparent);
border-radius: var(--df-radius);
font-size: 11px;
color: var(--df-text-dim);
user-select: none;
}
.ai-agentic-progress-dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--df-accent);
flex-shrink: 0;
animation: ai-agentic-pulse 1.2s ease-in-out infinite;
}
.ai-agentic-progress-text {
font-family: var(--df-font-mono);
white-space: nowrap;
}
@keyframes ai-agentic-pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
</style>
+288
View File
@@ -0,0 +1,288 @@
<template>
<!-- ═══ 待发送队列(生成中排队的消息,完成后自动续发;仅显示当前活跃会话的条目)
C4b 拆分自 AiChat.vue 队列区(模板 + L2 发送韧性 + V7 排队时钟 + 队列编辑/回填,零行为变更;
store 单例共享,confirm 自持一份 useConfirm + ConfirmDialog——同 ChatInput/ConversationSidebar
模式:useConfirm 非单例,子组件发起的 confirm 须本组件渲染) ═══ -->
<div v-if="activeQueue.length > 0" class="ai-queue" :class="{ 'ai-queue--timeout': queueTimedOut }">
<div class="ai-queue-head">
<span class="ai-queue-title">{{ $t('aiChat.queueTitle', { n: activeQueue.length }) }}</span>
<div class="ai-queue-actions">
<button v-if="queueTimedOut" class="ai-queue-force" @click="handleForceSend">{{ $t('ai.forceSendBtn') }}</button>
<button class="ai-queue-clear" @click="handleClearQueue">{{ $t('aiChat.clearQueue') }}</button>
</div>
</div>
<div class="ai-queue-list">
<div v-for="(item, idx) in activeQueue" :key="idx" class="ai-queue-item">
<!-- 编辑态只编 text:inline input,回车/失焦写回,ESC 取消 -->
<template v-if="editingQueueIdx === idx">
<span v-if="item.skill" class="ai-queue-skill">/{{ item.skill }}</span>
<input
v-model="editingQueueText"
class="ai-queue-edit-input"
type="text"
@keydown="onQueueEditKeydown"
@blur="saveEditQueued"
/>
<button class="ai-queue-btn" @mousedown.prevent="saveEditQueued" :title="$t('aiChat.queueSave')" :aria-label="$t('aiChat.queueSave')">✓</button>
<button class="ai-queue-btn" @mousedown.prevent="cancelEditQueued" :title="$t('aiChat.queueCancel')" :aria-label="$t('aiChat.queueCancel')">✕</button>
</template>
<template v-else>
<span v-if="item.skill" class="ai-queue-skill">/{{ item.skill }}</span>
<span class="ai-queue-text" :title="item.text">{{ item.text }}</span>
<!-- V7 排队时钟:该项已等待时长 m:ss(nowTick 每秒推进,入发送随队列清空即停) -->
<span class="ai-queue-wait">{{ queueItemWait(item) }}</span>
<!-- I4 队列回填:取出该项填回输入框重新编辑(从队列移除) -->
<button class="ai-queue-btn" @click="backfillQueued(idx)" :title="$t('aiChat.queueBackfill')">{{ $t('aiChat.queueBackfill') }}</button>
<!-- 编辑按钮 -->
<button class="ai-queue-btn" @click="startEditQueued(idx)" :title="$t('aiChat.queueEdit')">{{ $t('aiChat.queueEdit') }}</button>
<!-- 立即发送(打断当前+发本条) -->
<button class="ai-queue-btn" @click="handleSendQueuedNow(idx)" :title="$t('aiChat.queueSendNow')">{{ $t('aiChat.queueSendNow') }}</button>
<button class="ai-queue-x" @click="store.cancelQueued(idx)" :title="$t('common.cancel')" :aria-label="$t('common.cancel')">×</button>
</template>
</div>
</div>
</div>
<!-- 确认弹层(强制发送/清空/回填覆盖二次确认;同 ChatInput 自持模式) -->
<ConfirmDialog
:visible="confirmState.visible"
:msg="confirmState.msg"
:danger-label="confirmState.dangerLabel"
@result="answerConfirm"
/>
</template>
<script setup lang="ts">
import { ref, computed, watch, onBeforeUnmount } from 'vue'
import { useI18n } from 'vue-i18n'
import { useAiStore } from '../../stores/ai'
import ConfirmDialog from '../ConfirmDialog.vue'
import { useConfirm } from '../../composables/useConfirm'
import type { SkillInfo } from '../../api/types'
// 回填链路跨组件:输入框 ref(chatInputRef)在父,本组件经 props 读草稿态(hasUnsentInput)、
// 经 emit 写草稿(fill-draft),由父转发 ChatInput——共享函数留主文件 props/emits 传(拆分纪律)。
const props = defineProps<{
/** 父侧 ChatInput.hasUnsentInput 转发(回填覆盖未发送草稿前的 confirm 守卫) */
hasUnsentInput: () => boolean
}>()
const emit = defineEmits<{
/** 队列项回填:父转发 ChatInput.fillDraft(text, skill) 写入输入框草稿 */
(e: 'fill-draft', text: string, skill: SkillInfo | null): void
}>()
const store = useAiStore()
const { t } = useI18n()
// ── 确认弹层(useConfirm 非单例,子组件自持一份 + 自渲染 ConfirmDialog,同 ChatInput 先例) ──
const { confirmState, confirmDialog, answerConfirm } = useConfirm()
/** 当前活跃会话的待发送队列(按 activeConversationId 过滤)。
* 队列是全局数组,多会话并发可各自排队;旧实现渲染全部会话的 queue,切/新建后会显示
* 旧会话排队消息。此处仅显当前活跃会话条目,相关操作(编辑/删除/立即发送/清空/超时)均按此收敛。 */
const activeQueue = computed(() =>
store.state.queue.filter(q => q.conversationId === store.state.activeConversationId),
)
// ── V7 排队时钟:响应式 tick 驱动排队项已等待时长 ──
// 原 queueWaitSeconds 在 computed 内直接取 Date.now(),非响应式依赖:纯等待期(无 store 变更)
// 永不重算,秒数冻结;且只覆盖队首。改为有排队时起 1s interval 推进 nowTick,展示函数读
// nowTick 建立依赖实现每秒刷新;队列清空(含队首进入发送被移除)即关表,卸载时显式清理防泄漏。
const nowTick = ref(Date.now())
let queueTickTimer: ReturnType<typeof setInterval> | null = null
/** 队首排队是否已超 30s(仅看当前活跃会话队列)。
* UX-P2-A1:isQueueTimedOut 内取 Date.now() 非响应式,纯等待期(无 store 变更)本 computed
* 永不重算,超时横幅/强制发送按钮延迟到下一次无关 store 变更才出现。显式读 nowTick
* (V7 排队时钟,有排队时 1s interval 推进)建立每秒依赖,超时判定随 tick 每秒重算。 */
const queueTimedOut = computed(() => {
void nowTick.value
return store.isQueueTimedOut(store.state.activeConversationId)
})
watch(
() => activeQueue.value.length > 0,
(waiting) => {
if (waiting && queueTickTimer === null) {
nowTick.value = Date.now()
queueTickTimer = setInterval(() => { nowTick.value = Date.now() }, 1000)
} else if (!waiting && queueTickTimer !== null) {
clearInterval(queueTickTimer)
queueTickTimer = null
}
},
{ immediate: true },
)
/** 秒数转 m:ss(分钟不封顶,长等待继续累计) */
function formatWaitTime(totalSeconds: number): string {
return `${Math.floor(totalSeconds / 60)}:${String(totalSeconds % 60).padStart(2, '0')}`
}
/** 排队项已等待时长(m:ss);读 nowTick 建立响应式依赖,每秒随 tick 刷新 */
function queueItemWait(item: { enqueuedAt: number }): string {
return formatWaitTime(Math.max(0, Math.floor((nowTick.value - item.enqueuedAt) / 1000)))
}
/** 强制发送:委托 tryForceSend 唯一负责弹 confirm + 移除队列 + force_send(作用于当前活跃会话) */
async function handleForceSend() {
await store.tryForceSend(confirmDialog, store.state.activeConversationId)
}
/** UI-4(看板 943)清空队列:二次确认后全清当前活跃会话排队消息。
* 一键误触会静默丢掉全部排队消息且不可恢复,复用 ConfirmDialog 先例
* (同 tryForceSend 的 confirmFn 注入形态),不引 window.confirm(仓风格)。 */
async function handleClearQueue() {
const convId = store.state.activeConversationId
if (!convId) return
const confirmed = await confirmDialog(t('aiChat.clearQueueConfirm'))
if (confirmed) store.clearQueue(convId)
}
// ── 队列消息编辑(只编 text)+ 立即发送(插队)──
/** 当前正在编辑的队列项 index;null=非编辑态 */
const editingQueueIdx = ref<number | null>(null)
/** 编辑态输入框文本(回车写回 / ESC 取消还原) */
const editingQueueText = ref('')
// UX-P3: 队列编辑态(editingQueueIdx/editingQueueText)绑定旧会话队列在 activeQueue
// 视图内的下标,切会话后 activeQueue 已换成新会话的集合,残留 idx/text 会错挂到
// 新会话同下标队列项上,切会话即重置(原随父 watch activeConversationId,拆分后本组件自管)。
watch(() => store.state.activeConversationId, () => {
if (editingQueueIdx.value !== null) cancelEditQueued()
})
/** 进入编辑态:记录 index + 快照当前 text(activeQueue 视图内下标) */
function startEditQueued(idx: number) {
const item = activeQueue.value[idx]
if (!item) return
editingQueueIdx.value = idx
editingQueueText.value = item.text
}
/** 取消编辑:还原非编辑态,不写回 */
function cancelEditQueued() {
editingQueueIdx.value = null
editingQueueText.value = ''
}
/** P1-1 队列编辑框键盘处理:输入法组词中(isComposing/229)的 Enter/Esc 属 IME 选词/取消组词,
* 不当提交/取消处理,防半截拼音被写回队列项。原 @keydown.enter/.esc 内联修饰符挂不了守卫,
* 收敛到本函数统一判。 */
function onQueueEditKeydown(e: KeyboardEvent) {
if (e.isComposing || e.keyCode === 229) return
if (e.key === 'Enter') {
e.preventDefault()
saveEditQueued()
} else if (e.key === 'Escape') {
e.preventDefault()
cancelEditQueued()
}
}
/** 保存编辑:回车/失焦触发,委托 store.editQueued 写回 text */
function saveEditQueued() {
if (editingQueueIdx.value === null) return
store.editQueued(editingQueueIdx.value, editingQueueText.value)
editingQueueIdx.value = null
editingQueueText.value = ''
}
/** 立即发送:委托 store.sendQueuedNow(移除+stop+sendMessage) */
async function handleSendQueuedNow(idx: number) {
await store.sendQueuedNow(idx)
}
/** I4 队列回填:取出该条填回输入框重新编辑(从队列移除,可改完再发)。
* cancelQueued 内部经 activeQueueRealIndex 做过滤视图下标映射,越界 no-op;
* 项携带技能时按名找回 SkillInfo 回挂 chip,找不到(技能已卸载)只回填文本,
* 与队列原地编辑只保 text 同一取舍。 */
async function backfillQueued(idx: number) {
const item = activeQueue.value[idx]
if (!item) return
// UX-P3: 输入框已有未发送草稿(文本/图片/技能 chip 任一非空)时回填会静默覆盖,
// 先 confirm 确认;取消则直接返回,队列项原样保留(尚未 cancelQueued)。
if (props.hasUnsentInput()) {
if (!await confirmDialog(t('aiChat.backfillOverwriteConfirm'))) return
}
const skill = item.skill
? store.state.skills.find(s => s.name === item.skill) ?? null
: null
store.cancelQueued(idx)
emit('fill-draft', item.text, skill)
}
onBeforeUnmount(() => {
// V7 排队时钟 interval 随组件卸载清理(watch 随卸载停但 interval 本体不自停,须显式清)
if (queueTickTimer !== null) { clearInterval(queueTickTimer); queueTickTimer = null }
})
</script>
<style scoped>
/* ═══ 待发送队列(样式随区块自 AiChat.vue 迁入,零视觉变更) ═══ */
.ai-queue {
margin-bottom: 6px;
padding: 6px 8px;
background: color-mix(in srgb, var(--df-accent) 8%, transparent);
border: 0.5px solid color-mix(in srgb, var(--df-accent) 30%, transparent);
border-radius: var(--df-radius);
}
.ai-queue--timeout {
background: color-mix(in srgb, var(--df-warning) 10%, transparent);
border-color: color-mix(in srgb, var(--df-warning) 40%, transparent);
}
.ai-queue-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 4px;
}
.ai-queue-title { font-size: 11px; color: var(--df-text-dim); font-weight: 600; }
.ai-queue--timeout .ai-queue-title { color: var(--df-warning); }
.ai-queue-actions { display: flex; align-items: center; gap: 8px; }
.ai-queue-force {
background: var(--df-warning); border: none; color: #000; cursor: pointer;
font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: calc(var(--df-radius) - 2px);
}
.ai-queue-force:hover { filter: brightness(1.1); }
.ai-queue-clear { background: none; border: none; color: var(--df-text-dim); cursor: pointer; font-size: 11px; padding: 0; }
.ai-queue-clear:hover { color: var(--df-text); }
.ai-queue-list { display: flex; flex-direction: column; gap: 3px; }
.ai-queue-item {
display: flex;
align-items: center;
gap: 6px;
padding: 3px 6px;
background: var(--df-bg-card);
border-radius: calc(var(--df-radius) - 2px);
font-size: 12px;
}
.ai-queue-skill { color: var(--df-accent); font-weight: 600; flex-shrink: 0; }
/* V7 排队时钟:每项已等待时长 */
.ai-queue-wait { color: var(--df-text-dim); font-size: 10px; flex-shrink: 0; opacity: 0.7; }
.ai-queue-text {
color: var(--df-text);
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ai-queue-x { background: none; border: none; color: var(--df-text-dim); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; flex-shrink: 0; }
.ai-queue-x:hover { color: var(--df-danger); }
/* 队列项编辑/立即发送按钮 + 编辑态 input */
.ai-queue-btn {
background: none; border: none; color: var(--df-text-dim); cursor: pointer;
font-size: 11px; line-height: 1; padding: 0 4px; flex-shrink: 0;
}
.ai-queue-btn:hover { color: var(--df-accent); }
.ai-queue-edit-input {
flex: 1; min-width: 0; font-size: 12px; padding: 1px 4px;
background: var(--df-bg-card); color: var(--df-text);
border: 0.5px solid var(--df-accent);
border-radius: calc(var(--df-radius) - 2px);
outline: none;
}
/* 聚焦可见环:边框恒为 accent 聚焦无变化,且 scoped 选择器特异性高于全局 :focus-visible 兜底,须就地补环,仅键盘聚焦显示 */
.ai-queue-edit-input:focus-visible { outline: 2px solid var(--df-accent); outline-offset: 1px; }
</style>
@@ -0,0 +1,117 @@
<template>
<!-- I12(2026-10-05):键盘快捷键速查。Teleport 到 body 防 .ai-panel overflow 裁剪;
主窗/分离窗各自实例独立渲染,入口在 TopBar ... 菜单(emit show-shortcuts)。
C4b 拆分自 AiChat.vue(visible 状态留父——onGlobalKeydown Esc 仲裁需读写,开/关经 props/emits) -->
<Teleport to="body">
<div v-if="visible" class="ai-shortcuts-mask" @click.self="emit('close')">
<div class="ai-shortcuts-panel" role="dialog" :aria-label="t('aiChat.shortcutsTitle')">
<div class="ai-shortcuts-head">
<span class="ai-shortcuts-title">{{ t('aiChat.shortcutsTitle') }}</span>
<button class="ai-shortcuts-close" :aria-label="t('aiChat.scCloseOverlay')" @click="emit('close')">✕</button>
</div>
<ul class="ai-shortcuts-list">
<li v-for="s in shortcuts" :key="s.key" class="ai-shortcuts-row">
<span class="ai-shortcuts-key">{{ s.key }}</span>
<span class="ai-shortcuts-act">{{ s.label }}</span>
</li>
</ul>
</div>
</div>
</Teleport>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
defineProps<{
/** 面板显隐(状态留父:TopBar emit show-shortcuts 置 true,onGlobalKeydown Esc 分支仲裁) */
visible: boolean
}>()
const emit = defineEmits<{
(e: 'close'): void
}>()
const { t } = useI18n()
// 键位表 shortcuts 与父 AiChat onGlobalKeydown 同族——键区调整时两边同步,防速查与真实键位漂移。
// computed:随 locale 即时翻译(仅面板打开时消费,开销可忽略)。
const shortcuts = computed(() => [
{ key: 'Ctrl+N', label: t('aiChat.scNewConv') },
{ key: 'Ctrl+I', label: t('aiChat.scFocusInput') },
{ key: 'Ctrl+R', label: t('aiChat.scRegenerate') },
{ key: 'Ctrl+L', label: t('aiChat.scClearChat') },
{ key: 'Ctrl+K', label: t('aiChat.scSearch') },
{ key: 'Ctrl+B', label: t('aiChat.scToggleSidebar') },
{ key: 'Esc', label: t('aiChat.scCloseOverlay') },
])
</script>
<style scoped>
/* ═══ I12 快捷键速查面板(Teleport 到 body,scoped 对 Teleport 内容仍生效——
Vue scoped 把 data 属性打在编译期节点上,与挂载位置无关;样式随区块自 AiChat.vue 迁入) ═══ */
.ai-shortcuts-mask {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.4);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.ai-shortcuts-panel {
background: var(--df-bg-card);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-lg, 8px);
box-shadow: var(--df-shadow-sm);
width: 320px;
max-width: calc(100vw - 48px);
padding: 14px 16px;
}
.ai-shortcuts-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.ai-shortcuts-title {
font-size: 13px;
font-weight: 600;
color: var(--df-text);
}
.ai-shortcuts-close {
background: transparent;
border: none;
color: var(--df-text-secondary);
cursor: pointer;
font-size: 12px;
padding: 2px 4px;
border-radius: 4px;
}
.ai-shortcuts-close:hover { color: var(--df-text); background: var(--df-bg-card); }
.ai-shortcuts-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 6px;
}
.ai-shortcuts-row {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
}
.ai-shortcuts-key {
font-family: var(--df-font-mono);
font-size: 11px;
background: var(--df-bg-card);
border: 0.5px solid var(--df-border);
border-radius: 4px;
padding: 2px 8px;
color: var(--df-text);
}
.ai-shortcuts-act { color: var(--df-text-secondary); }
</style>
+18 -16
View File
@@ -108,7 +108,9 @@ function onDismiss() {
</script> </script>
<style scoped> <style scoped>
/* 浮层 — 右上角 fixed,z-index 高于 AI 面板与其他模态 */ /* 浮层 — 右上角 fixed,z-index 高于 AI 面板与其他模态
wave2(2026-10-18):danger 系透明彩底范式(待审批=需用户处置的阻断信号)——
弹层底 bg-card+边框+10px 圆角,边框 color-mix 30%+左缘 3px 强调,标题同色 12px/600 */
.approval-overlay { .approval-overlay {
position: fixed; position: fixed;
top: 16px; top: 16px;
@@ -121,10 +123,10 @@ function onDismiss() {
min-width: 260px; min-width: 260px;
max-width: 360px; max-width: 360px;
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-accent); border: 0.5px solid color-mix(in srgb, var(--df-danger) 30%, transparent);
border-left: 3px solid var(--df-accent); border-left: 3px solid var(--df-danger);
border-radius: var(--df-radius-md); border-radius: var(--df-radius-lg);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--df-accent-soft); box-shadow: var(--df-shadow-md), 0 0 0 1px color-mix(in srgb, var(--df-danger) 12%, transparent);
cursor: pointer; cursor: pointer;
transition: transform 0.18s var(--df-ease), border-color 0.18s var(--df-ease), box-shadow 0.18s var(--df-ease); transition: transform 0.18s var(--df-ease), border-color 0.18s var(--df-ease), box-shadow 0.18s var(--df-ease);
user-select: none; user-select: none;
@@ -132,8 +134,8 @@ function onDismiss() {
.approval-overlay:hover { .approval-overlay:hover {
transform: translateX(-2px); transform: translateX(-2px);
border-color: var(--df-accent); border-color: color-mix(in srgb, var(--df-danger) 55%, transparent);
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 0 2px var(--df-accent); box-shadow: var(--df-shadow-md), 0 0 0 2px color-mix(in srgb, var(--df-danger) 45%, transparent);
} }
.approval-overlay-icon { .approval-overlay-icon {
@@ -144,8 +146,8 @@ function onDismiss() {
width: 36px; width: 36px;
height: 36px; height: 36px;
border-radius: 50%; border-radius: 50%;
background: var(--df-accent-bg); background: color-mix(in srgb, var(--df-danger) 10%, transparent);
color: var(--df-accent); color: var(--df-danger);
flex-shrink: 0; flex-shrink: 0;
} }
@@ -172,15 +174,15 @@ function onDismiss() {
} }
.approval-overlay-title { .approval-overlay-title {
font-size: 13px; font-size: 12px;
font-weight: 600; font-weight: 600;
color: var(--df-text); color: var(--df-danger);
margin-bottom: 2px; margin-bottom: 2px;
} }
.approval-overlay-desc { .approval-overlay-desc {
font-size: 11px; font-size: 12px;
color: var(--df-text-dim); color: var(--df-text-secondary);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@@ -190,8 +192,8 @@ function onDismiss() {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 22px; width: var(--df-h-icon-btn);
height: 22px; height: var(--df-h-icon-btn);
border: none; border: none;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: transparent; background: transparent;
@@ -202,7 +204,7 @@ function onDismiss() {
} }
.approval-overlay-close:hover { .approval-overlay-close:hover {
background: var(--df-sidebar-hover); background: var(--df-bg-card-hover);
color: var(--df-text); color: var(--df-text);
} }
+1 -1
View File
@@ -85,7 +85,7 @@ onMounted(async () => {
border-radius: 8px; border-radius: 8px;
padding: 8px 12px; padding: 8px 12px;
margin: 8px 0; margin: 8px 0;
background: var(--df-bg-secondary); background: var(--df-bg-card);
font-size: 12px; font-size: 12px;
} }
.ci-header { .ci-header {
+152 -32
View File
@@ -45,6 +45,9 @@
@select="selectMention" @select="selectMention"
@update:mention-index="mentionIndex = $event" @update:mention-index="mentionIndex = $event"
/> />
<!-- 2026-10-18 wave2: 工具行(workbench .inp-row 范式)——textarea 下方分隔线,
左侧功能钮 + 右侧发送/停止钮;纯布局重排,按钮类名/事件/禁用判定零变化 -->
<div class="ai-input-row">
<!-- 2026-08-06:📎 图片选择按钮(tauri 原生对话框选图 → 已配置上传端点则上传换 URL,否则本地 base64 引用) --> <!-- 2026-08-06:📎 图片选择按钮(tauri 原生对话框选图 → 已配置上传端点则上传换 URL,否则本地 base64 引用) -->
<button <button
type="button" type="button"
@@ -115,12 +118,14 @@
class="ai-send-btn" class="ai-send-btn"
:class="{ 'ai-send-btn--active': canSend }" :class="{ 'ai-send-btn--active': canSend }"
:disabled="!canSend" :disabled="!canSend"
:aria-label="$t('aiChat.queueSendNow')" :title="$t('aiChat.send')"
:aria-label="$t('aiChat.send')"
@click="handleSend" @click="handleSend"
> >
<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg> <svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
</button> </button>
</div> </div>
</div>
<!-- ⑥.4 Phase 4: @项目展开摘要(提取至 EnrichmentPanel.vue) --> <!-- ⑥.4 Phase 4: @项目展开摘要(提取至 EnrichmentPanel.vue) -->
<EnrichmentPanel <EnrichmentPanel
:has-enrichment="hasEnrichment" :has-enrichment="hasEnrichment"
@@ -132,6 +137,12 @@
/> />
<!-- 定时/待发箱抽屉(⏰ 入口;Teleport 到 body 渲染,此处仅挂组件) --> <!-- 定时/待发箱抽屉(⏰ 入口;Teleport 到 body 渲染,此处仅挂组件) -->
<OutboxDrawer :open="outboxOpen" @close="outboxOpen = false" /> <OutboxDrawer :open="outboxOpen" @close="outboxOpen = false" />
<!-- F2-4(走查-信息UX 面二):示例卡覆盖未发送草稿的二次确认弹层(组件自持,见 setup 注释) -->
<ConfirmDialog
:visible="confirmState.visible"
:msg="confirmState.msg"
@result="answerConfirm"
/>
<div class="ai-input-hint">{{ $t('aiChat.inputHint') }}</div> <div class="ai-input-hint">{{ $t('aiChat.inputHint') }}</div>
</div> </div>
</template> </template>
@@ -145,7 +156,7 @@
// - 出错 emit('error', { msg, type }) → 父 showToast(单一 toast 源) // - 出错 emit('error', { msg, type }) → 父 showToast(单一 toast 源)
// - 示例问题卡片在父(空状态区),父调 expose sendExamplePrompt 触发本组件发送 // - 示例问题卡片在父(空状态区),父调 expose sendExamplePrompt 触发本组件发送
// store 单例共享:useAiStore(sendMessage/editMessage/stopChat)、useProjectStore(@ 联想源) // store 单例共享:useAiStore(sendMessage/editMessage/stopChat)、useProjectStore(@ 联想源)
import { ref, computed, nextTick, watch } from 'vue' import { ref, computed, nextTick, watch, onBeforeUnmount } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useAiStore } from '../../stores/ai' import { useAiStore } from '../../stores/ai'
import { useProjectStore } from '../../stores/project' import { useProjectStore } from '../../stores/project'
@@ -162,6 +173,8 @@ import ImageInput from './ImageInput.vue'
import MentionPopover from './MentionPopover.vue' import MentionPopover from './MentionPopover.vue'
import EnrichmentPanel from './EnrichmentPanel.vue' import EnrichmentPanel from './EnrichmentPanel.vue'
import OutboxDrawer from './OutboxDrawer.vue' import OutboxDrawer from './OutboxDrawer.vue'
import ConfirmDialog from '../ConfirmDialog.vue'
import { useConfirm } from '../../composables/useConfirm'
import { taskApi } from '../../api/task' import { taskApi } from '../../api/task'
import type { AiMessage, ContentPart, SkillInfo, ProjectRecord, TaskRecord, IdeaRecord, MentionSpan } from '../../api/types' import type { AiMessage, ContentPart, SkillInfo, ProjectRecord, TaskRecord, IdeaRecord, MentionSpan } from '../../api/types'
import type { MentionItem } from './MentionItem' import type { MentionItem } from './MentionItem'
@@ -1078,6 +1091,8 @@ async function handleSend() {
// 生成中不再拦截:sendMessage 会把消息排入待发送队列,完成后自动续发 // 生成中不再拦截:sendMessage 会把消息排入待发送队列,完成后自动续发
// 先清输入(无论立即发还是入队);队列满/IPC 失败时 catch 回填 // 先清输入(无论立即发还是入队);队列满/IPC 失败时 catch 回填
inputText.value = '' inputText.value = ''
// F2-2:草稿已消费,立即落盘删项(不等防抖——快速关窗 300ms 内会残留已发送稿)
persistDraftNow()
pendingSkill.value = null pendingSkill.value = null
pendingImages.value = [] pendingImages.value = []
// Input Augmentation: 清空 mention 区间(与 inputText 清空同处,保证下条消息从空白态起步) // Input Augmentation: 清空 mention 区间(与 inputText 清空同处,保证下条消息从空白态起步)
@@ -1113,12 +1128,20 @@ async function handleSend() {
emit('sent') emit('sent')
} }
/** 点击示例问题卡片:填入输入框并发送(复用 handleSend 同款发送路径,错误回退一致) */ /** 点击示例问题卡片:填入输入框并发送(复用 handleSend 同款发送路径,错误回退一致)。
* F2-4(走查-信息UX 面二):输入框已有未发送草稿(文本/图片/技能 chip 任一)时先确认,
* 取消则原样保留草稿——对齐父级 backfillQueued 的覆盖确认语义,不再静默替换。 */
async function sendExamplePrompt(i18nKey: string) { async function sendExamplePrompt(i18nKey: string) {
if (hasUnsentInput() && !(await confirmDialog(t('aiChat.exampleOverwriteConfirm')))) return
inputText.value = t(i18nKey) inputText.value = t(i18nKey)
await handleSend() await handleSend()
} }
// ── F2-4:覆盖确认弹层(仓风格不引 window.confirm;AiChat 的 confirmDialog 状态机在父级
// 经模板绑定,子组件复用需父接线 → 本组件自持一份 useConfirm + ConfirmDialog,
// 行为/样式与父级 backfillQueued / clearQueue 确认同范式) ──
const { confirmState, confirmDialog, answerConfirm } = useConfirm()
// ── 父调用 expose(父 startEdit/cancelEdit/beforeunload 调用) ── // ── 父调用 expose(父 startEdit/cancelEdit/beforeunload 调用) ──
/** UX-09 进入编辑态:回填末条 user 内容到输入框,聚焦,光标置末 */ /** UX-09 进入编辑态:回填末条 user 内容到输入框,聚焦,光标置末 */
@@ -1140,7 +1163,9 @@ function startEditFocus(msg: AiMessage): void {
const len = el.value.length const len = el.value.length
el.setSelectionRange(len, len) el.setSelectionRange(len, len)
el.style.height = 'auto' el.style.height = 'auto'
el.style.height = Math.min(el.scrollHeight, 120) + 'px' // F2-3(走查-信息UX):编辑态回填高度复用 INPUT_MAX_HEIGHT,与 autoResize 同源;
// 原硬编码 120 使长草稿进编辑态首屏被压矮,任一按键才弹回 200
el.style.height = Math.min(el.scrollHeight, INPUT_MAX_HEIGHT) + 'px'
} }
}) })
} }
@@ -1155,6 +1180,8 @@ function clearInput(): void {
mentionOpen.value = false mentionOpen.value = false
mentionStart.value = -1 mentionStart.value = -1
if (inputEl.value) inputEl.value.style.height = 'auto' if (inputEl.value) inputEl.value.style.height = 'auto'
// F2-2:清空即落盘(取消编辑不应残留旧稿到下次重启)
persistDraftNow()
} }
/** I4 队列回填:父把取出的队列项文本填回输入框重新编辑。 /** I4 队列回填:父把取出的队列项文本填回输入框重新编辑。
@@ -1184,12 +1211,78 @@ function focus(): void {
} }
// ── V8 per-conv 草稿:切会话保存/恢复,防 A 会话未发送草稿串到 B 输入框 ── // ── V8 per-conv 草稿:切会话保存/恢复,防 A 会话未发送草稿串到 B 输入框 ──
// 草稿真相源在 aiShared.convDrafts(内存 Map,不落 localStorage)。父组件 AiChat 的 // 会话内真相源在 aiShared.convDrafts(内存 Map);F2-2(走查-信息UX 面二)追加落盘镜像:
// 键入过程防抖写 localStorage,重启/换装后经回退链恢复。父组件 AiChat 的
// activeConversationId watcher 注册更早先执行:编辑态切换时父先 cancelEdit 清输入, // activeConversationId watcher 注册更早先执行:编辑态切换时父先 cancelEdit 清输入,
// 本 watcher 后执行,旧会话保存到的是清空后的空串,与既有「切会话丢弃编辑缓冲」语义一致。 // 本 watcher 后执行,旧会话保存到的是清空后的空串,与既有「切会话丢弃编辑缓冲」语义一致。
// F2-2:per-conv 草稿 localStorage 镜像(df-ai-* 键约定;单 JSON 对象,LRU 限 20 条,
// 空串收敛删项——与内存 Map 同语义)。读写全程 try/catch:持久化是尽力而为,
// 解析失败/配额满不阻断输入主链。
const DRAFTS_KEY = 'df-ai-conv-drafts'
const DRAFTS_MAX = 20
function readDraftsStore(): Record<string, string> {
try {
const parsed: unknown = JSON.parse(localStorage.getItem(DRAFTS_KEY) || '{}')
return parsed && typeof parsed === 'object' ? (parsed as Record<string, string>) : {}
} catch {
return {}
}
}
function persistDraft(convId: string, text: string): void {
const all = readDraftsStore()
if (text) {
// 删后重插把该会话挪到键序末尾,Object 键序=写入序,溢出时从头淘汰即 LRU
delete all[convId]
all[convId] = text
const keys = Object.keys(all)
for (let i = 0; i < keys.length - DRAFTS_MAX; i++) delete all[keys[i]]
} else {
delete all[convId]
}
try {
localStorage.setItem(DRAFTS_KEY, JSON.stringify(all))
} catch {
// 配额满等:放弃本次落盘,内存草稿不受影响
}
}
// 防抖落盘:逐键写盘不必要,300ms 静默期合并;发送/清空/切会话/卸载走立即落盘收口
let draftPersistTimer: ReturnType<typeof setTimeout> | null = null
function persistDraftNow(): void {
if (draftPersistTimer) {
clearTimeout(draftPersistTimer)
draftPersistTimer = null
}
const convId = store.state.activeConversationId
if (convId) persistDraft(convId, inputText.value)
}
watch(inputText, () => {
if (draftPersistTimer) clearTimeout(draftPersistTimer)
draftPersistTimer = setTimeout(persistDraftNow, 300)
})
// F2-2:卸载(面板收起/关窗)前冲刷在途防抖,防最后 300ms 键入的草稿丢失
onBeforeUnmount(() => {
if (draftPersistTimer) persistDraftNow()
})
watch(() => store.state.activeConversationId, (nv, ov) => { watch(() => store.state.activeConversationId, (nv, ov) => {
if (ov) setConvDraft(ov, inputText.value) // immediate:挂载时活跃会话已就位(分离窗/恢复会话直开)也走恢复链,不只在切换时
if (ov) {
setConvDraft(ov, inputText.value)
persistDraft(ov, inputText.value)
}
inputText.value = getConvDraft(nv) inputText.value = getConvDraft(nv)
// 内存 Map 无记录时回退落盘稿(重启后 Map 为空;同会话内 Map 恒比落盘新,优先)
if (!inputText.value && nv) {
const persisted = readDraftsStore()[nv]
if (typeof persisted === 'string') inputText.value = persisted
}
// 随输入框的临时态不跨会话携带:mention 区间偏移只对旧文本有效,照搬到恢复的文本会渲染错位 // 随输入框的临时态不跨会话携带:mention 区间偏移只对旧文本有效,照搬到恢复的文本会渲染错位
// chip;技能 chip 与待发图片同理,残留到新会话会静默混入下一条消息 // chip;技能 chip 与待发图片同理,残留到新会话会静默混入下一条消息
pendingMentionSpans.value = [] pendingMentionSpans.value = []
@@ -1205,7 +1298,7 @@ watch(() => store.state.activeConversationId, (nv, ov) => {
mentionStart.value = -1 mentionStart.value = -1
autoResize() autoResize()
}) })
}) }, { immediate: true })
// ── 脉络卡「带入上下文」外部投递:以输入框实时内容为基底追加(草稿 Map 不含键入 // ── 脉络卡「带入上下文」外部投递:以输入框实时内容为基底追加(草稿 Map 不含键入
// 过程,直接写 Map 会丢当前输入),一次性消费防重放;追加后聚焦输入框由用户决断 ── // 过程,直接写 Map 会丢当前输入),一次性消费防重放;追加后聚焦输入框由用户决断 ──
@@ -1259,32 +1352,33 @@ defineExpose({
零视觉变更。原 AiChat scoped 不渗透子组件根,输入框/技能联想/发送按钮元素失配 → 本组件自持。 零视觉变更。原 AiChat scoped 不渗透子组件根,输入框/技能联想/发送按钮元素失配 → 本组件自持。
CSS 变量(--df-*)由根级 global.css 提供,共享同一份。.ai-input-area 容器留父级 AiChat scoped。) ═══ --> CSS 变量(--df-*)由根级 global.css 提供,共享同一份。.ai-input-area 容器留父级 AiChat scoped。) ═══ -->
<style scoped> <style scoped>
/* 2026-10-18 wave2: 输入盒迁移 workbench .inp-box 范式——bg-card 底+0.5px 边框+9px 圆角,
focus-within 边框转 info;纵向布局让全宽图片预览行自然换行(替代原 flex-wrap 手法) */
.ai-input-wrap { .ai-input-wrap {
position: relative; position: relative;
display: flex; display: flex;
/* F-260614-05 Phase 2b: flex-wrap 让全宽的图片预览行强制 textarea+按钮换行到下一行 */ flex-direction: column;
flex-wrap: wrap;
align-items: center;
gap: 6px;
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-lg); border-radius: 9px;
padding: 6px 8px; padding: 9px 12px;
transition: border-color 0.15s; transition: border-color 0.15s;
} }
/* F-260614-05 Phase 2b: 图片预览样式已提取到 styles/components.css 全局(ImageInput.vue 共享) */ /* F-260614-05 Phase 2b: 图片预览样式已提取到 styles/components.css 全局(ImageInput.vue 共享) */
.ai-input-wrap:focus-within { .ai-input-wrap:focus-within {
border-color: color-mix(in srgb, var(--df-accent) 40%, transparent); border-color: var(--df-info);
} }
/* ── 技能 chip / 联想浮层样式已提取到 styles/components.css 全局(SkillMention.vue + MentionPopover.vue 共享)── */ /* ── 技能 chip / 联想浮层样式已提取到 styles/components.css 全局(SkillMention.vue + MentionPopover.vue 共享)── */
/* ── UX-10 §1.4: @ 实体引用浮层样式已随 MentionPopover.vue 提取 ── */ /* ── UX-10 §1.4: @ 实体引用浮层样式已随 MentionPopover.vue 提取 ── */
/* textarea 透明无边框占满输入盒首行(workbench .inp-box textarea 范式);
autosize 高度参数(min/height/max-height)为行为契约,禁动 */
.ai-input { .ai-input {
flex: 1; width: 100%;
background: transparent; background: transparent;
border: none; border: none;
outline: none; outline: none;
@@ -1301,6 +1395,19 @@ defineExpose({
.ai-input::placeholder { .ai-input::placeholder {
color: var(--df-text-dim); color: var(--df-text-dim);
} }
/* 工具行(workbench .inp-row 范式):textarea 下方 --df-border 分隔线,左功能钮+右发送钮 */
.ai-input-row {
display: flex;
align-items: center;
gap: 6px;
margin-top: 6px;
padding-top: 6px;
border-top: 0.5px solid var(--df-border);
}
/* 发送钮(workbench .isend 范式):info→accent 135° 渐变+深色 icon+600 字重;
禁用态 opacity .4(禁用判定逻辑不动)。原 --active 实心紫规则并入基类,类名绑定保留无害 */
.ai-send-btn { .ai-send-btn {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -1309,38 +1416,37 @@ defineExpose({
height: 28px; height: 28px;
border: none; border: none;
border-radius: var(--df-radius); border-radius: var(--df-radius);
background: var(--df-bg-raised); background: linear-gradient(135deg, var(--df-info), var(--df-accent));
color: var(--df-text-dim); color: color-mix(in srgb, var(--df-bg) 70%, #000);
font-weight: 600;
cursor: pointer; cursor: pointer;
transition: background 0.15s, color 0.15s; transition: filter 0.15s, opacity 0.15s;
flex-shrink: 0; flex-shrink: 0;
margin-left: auto;
} }
.ai-send-btn:not(:disabled):hover {
filter: brightness(1.1);
}
/* 功能钮统一 28px 高 bg-card 边框钮(workbench 工具行左侧范式),hover 边框亮 */
.ai-img-pick-btn { .ai-img-pick-btn {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 28px; width: 28px;
height: 28px; height: 28px;
border: none; border: 0.5px solid var(--df-border);
border-radius: var(--df-radius); border-radius: var(--df-radius);
background: transparent; background: var(--df-bg-card);
color: var(--df-text-dim); color: var(--df-text-dim);
cursor: pointer; cursor: pointer;
transition: background 0.15s, color 0.15s; transition: background 0.15s, color 0.15s, border-color 0.15s;
flex-shrink: 0; flex-shrink: 0;
margin-right: 4px;
} }
.ai-img-pick-btn:hover { .ai-img-pick-btn:hover {
background: var(--df-bg-raised); background: var(--df-bg-card-hover);
border-color: var(--df-border-strong);
color: var(--df-text); color: var(--df-text);
} }
.ai-send-btn--active {
background: var(--df-accent);
color: #fff;
}
.ai-send-btn--active:hover {
background: var(--df-accent-hover);
}
.ai-send-btn:disabled { .ai-send-btn:disabled {
opacity: 0.4; opacity: 0.4;
cursor: not-allowed; cursor: not-allowed;
@@ -1364,20 +1470,34 @@ defineExpose({
.ai-send-btn--retry:hover { .ai-send-btn--retry:hover {
background: #d63a3f; background: #d63a3f;
} }
/* 命令提示 chip(workbench .icmd 范式):mono 10px --df-text-dim */
.ai-input-hint { .ai-input-hint {
font-family: var(--df-font-mono);
font-size: 10px; font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
text-align: right; text-align: right;
margin-top: 4px; margin-top: 4px;
opacity: 0.6;
} }
/* ── ⑥.4 Phase 4: @项目展开摘要样式已随 EnrichmentPanel.vue 提取 ── */ /* ── ⑥.4 Phase 4: @项目展开摘要样式已随 EnrichmentPanel.vue 提取 ── */
/* B1: 非视觉模型贴图警示条(待发送图片预览行下方,warning 色轻量提示,不抢输入框注意力) */ /* B1: 非视觉模型贴图警示条(待发送图片预览行下方,warning 色轻量提示,不抢输入框注意力) */
.ai-img-warn-chip { .ai-img-warn-chip {
font-size: 10.5px; font-size: 10px;
color: var(--df-warning); color: var(--df-warning);
padding: 1px 4px; padding: 1px 4px;
} }
/* ── 2026-10-18 wave2: 草稿/mention 弹层对齐 workbench 弹层范式 ──
SkillMention/MentionPopover 共用 styles/components.css 的 .ai-skill-* 全局基类(禁碰),
经 :deep 在此集中覆写一份(两子组件弹层同源,避免各自 scoped 重复):
8px 圆角+浅阴影;选中项 bg-card-hover+左 2px 强调边(inset 阴影实现,零布局位移) */
.ai-input-wrap :deep(.ai-skill-popover) {
border-radius: var(--df-radius-md);
box-shadow: var(--df-shadow-sm);
}
.ai-input-wrap :deep(.ai-skill-item--active) {
background: var(--df-bg-card-hover);
box-shadow: inset 2px 0 0 var(--df-accent);
}
</style> </style>
+5 -5
View File
@@ -104,16 +104,16 @@ watch(
<style scoped> <style scoped>
.conflict-resolver { .conflict-resolver {
border: 1px solid var(--df-warning, #ffc107); border: 1px solid var(--df-warning);
border-radius: 8px; border-radius: 8px;
padding: 8px 12px; padding: 8px 12px;
margin: 8px 0; margin: 8px 0;
background: var(--df-bg-secondary); background: var(--df-bg-card);
} }
.conflict-header { .conflict-header {
font-weight: 600; font-weight: 600;
margin-bottom: 8px; margin-bottom: 8px;
color: var(--df-warning, #ffc107); color: var(--df-warning);
} }
.conflict-item { .conflict-item {
border-top: 1px solid var(--df-border); border-top: 1px solid var(--df-border);
@@ -153,8 +153,8 @@ watch(
padding: 2px 6px; padding: 2px 6px;
border-radius: 4px; border-radius: 4px;
} }
.badge--file { background: rgba(255, 193, 7, 0.15); color: #ffc107; } .badge--file { background: var(--df-warning-bg); color: var(--df-warning); }
.badge--semantic { background: rgba(220, 53, 69, 0.15); color: #dc3545; } .badge--semantic { background: var(--df-danger-bg); color: var(--df-danger); }
.conflict-file code { font-size: 12px; color: var(--df-text); } .conflict-file code { font-size: 12px; color: var(--df-text); }
.conflict-diffs { .conflict-diffs {
display: grid; display: grid;
+32 -21
View File
@@ -125,8 +125,10 @@ function bringIn(g: ProjectBriefs, b: ContextBrief) {
</script> </script>
<style scoped> <style scoped>
/* wave2(2026-10-18):旧 token 全量迁 --df-*;统一透明彩底卡范式,accent 系(脉络=系统功能信号)
——边框 color-mix 30% + 底 6% + 标题同色 12px/600 + 正文 secondary 12px + 透明底描边钮 */
.ctx-briefs { .ctx-briefs {
border-bottom: 1px solid var(--border, #e0e0e0); border-bottom: 0.5px solid var(--df-border);
padding: 4px 10px; padding: 4px 10px;
font-size: 12px; font-size: 12px;
} }
@@ -138,29 +140,36 @@ function bringIn(g: ProjectBriefs, b: ContextBrief) {
padding: 3px 2px; padding: 3px 2px;
border: none; border: none;
background: none; background: none;
color: var(--text-secondary, #666); color: var(--df-accent);
cursor: pointer;
font-size: 12px; font-size: 12px;
font-weight: 600;
cursor: pointer;
} }
.ctx-briefs-count { .ctx-briefs-count {
background: var(--accent-soft, rgba(64, 128, 255, 0.15)); background: var(--df-accent-soft);
color: var(--accent, #4080ff); color: var(--df-accent);
border-radius: 8px; border-radius: var(--df-radius-md);
padding: 0 6px; padding: 0 6px;
font-size: 11px; font-size: 11px;
font-weight: 400;
} }
.ctx-briefs-body { .ctx-briefs-body {
max-height: 220px; max-height: 220px;
overflow-y: auto; overflow-y: auto;
padding-bottom: 4px; padding: 6px 8px;
background: color-mix(in srgb, var(--df-accent) 6%, transparent);
border: 0.5px solid color-mix(in srgb, var(--df-accent) 30%, transparent);
border-radius: var(--df-radius);
margin-bottom: 4px;
} }
.ctx-briefs-empty { .ctx-briefs-empty {
color: var(--text-tertiary, #999); color: var(--df-text-dim);
padding: 6px 2px; padding: 6px 2px;
} }
.ctx-briefs-project { .ctx-briefs-project {
font-weight: 600; font-weight: 600;
color: var(--text-primary, #333); color: var(--df-text);
font-size: 12px;
padding: 5px 2px 2px; padding: 5px 2px 2px;
} }
.ctx-briefs-focus-dot { .ctx-briefs-focus-dot {
@@ -169,12 +178,12 @@ function bringIn(g: ProjectBriefs, b: ContextBrief) {
height: 5px; height: 5px;
margin-right: 4px; margin-right: 4px;
border-radius: 50%; border-radius: 50%;
background: var(--accent, #4080ff); background: var(--df-accent);
vertical-align: 2px; vertical-align: 2px;
} }
.ctx-briefs-item { .ctx-briefs-item {
padding: 4px 2px; padding: 4px 2px;
border-top: 1px dashed var(--border, #eee); border-top: 0.5px dashed var(--df-border);
} }
.ctx-briefs-item-head { .ctx-briefs-item-head {
display: flex; display: flex;
@@ -183,7 +192,7 @@ function bringIn(g: ProjectBriefs, b: ContextBrief) {
} }
.ctx-briefs-item-title { .ctx-briefs-item-title {
font-weight: 500; font-weight: 500;
color: var(--text-primary, #333); color: var(--df-text);
} }
.ctx-briefs-item-link { .ctx-briefs-item-link {
padding: 0; padding: 0;
@@ -194,29 +203,31 @@ function bringIn(g: ProjectBriefs, b: ContextBrief) {
cursor: pointer; cursor: pointer;
} }
.ctx-briefs-item-link:hover { .ctx-briefs-item-link:hover {
color: var(--accent, #4080ff); color: var(--df-accent);
} }
.ctx-briefs-item-time { .ctx-briefs-item-time {
margin-left: auto; margin-left: auto;
flex-shrink: 0; flex-shrink: 0;
font-size: 11px; font-size: 10px;
color: var(--text-tertiary, #999); color: var(--df-text-dim);
font-family: var(--df-font-mono);
} }
.ctx-briefs-item-summary { .ctx-briefs-item-summary {
color: var(--text-secondary, #666); color: var(--df-text-secondary);
font-size: 12px;
margin: 2px 0; margin: 2px 0;
line-height: 1.4; line-height: 1.4;
} }
.ctx-briefs-bring { .ctx-briefs-bring {
border: 1px solid var(--border, #ddd); border: 0.5px solid color-mix(in srgb, var(--df-accent) 40%, transparent);
background: none; background: transparent;
color: var(--accent, #4080ff); color: var(--df-accent);
border-radius: 4px; border-radius: var(--df-radius-sm);
padding: 1px 8px; padding: 1px 8px;
font-size: 11px; font-size: 11px;
cursor: pointer; cursor: pointer;
} }
.ctx-briefs-bring:hover { .ctx-briefs-bring:hover {
background: var(--accent-soft, rgba(64, 128, 255, 0.1)); background: var(--df-accent-soft);
} }
</style> </style>
+151 -46
View File
@@ -52,6 +52,18 @@
@keydown="onItemKeydown($event, conv.id, true)" @keydown="onItemKeydown($event, conv.id, true)"
> >
<div class="ai-conv-item-main"> <div class="ai-conv-item-main">
<!-- wave2 u-agent 范式: 左侧 7px 状态点。字段源 store.isGenerating(conv_state
generating/stopping/compressed) / pendingCountOf(审批挂起) / loop_state='parked',
无 error 字段故不映射;优先级 generating > 待审批 > parked > 灰 -->
<span
class="df-dot ai-conv-status"
:class="store.isGenerating(conv.id) ? 'df-dot--run ai-conv-status--run'
: pendingCountOf(conv.id) > 0 ? 'ai-conv-status--danger'
: conv.loop_state === 'parked' ? 'ai-conv-status--paused'
: 'df-dot--stop'"
:title="store.isGenerating(conv.id) ? t('aiChat.generating') : undefined"
aria-hidden="true"
></span>
<!-- UX走查 P3-1: 搜索态此前无重命名入口(无 startRename 分支),与分组视图降级不一致; <!-- UX走查 P3-1: 搜索态此前无重命名入口(无 startRename 分支),与分组视图降级不一致;
双击入口对齐分组视图,菜单入口供键盘用户(P2-6) --> 双击入口对齐分组视图,菜单入口供键盘用户(P2-6) -->
<input <input
@@ -70,7 +82,6 @@
@dblclick.stop="startRename(conv)" @dblclick.stop="startRename(conv)"
> >
{{ conv.title || t('aiChat.newConversation') }} {{ conv.title || t('aiChat.newConversation') }}
<span v-if="store.isGenerating(conv.id)" class="ai-conv-gen-dot" :title="t('aiChat.generating')"></span>
<!-- V1: 待审批徽标(橙点计数,复用既有 aiChat.pendingApprovalCount 文案) --> <!-- V1: 待审批徽标(橙点计数,复用既有 aiChat.pendingApprovalCount 文案) -->
<span v-if="pendingCountOf(conv.id) > 0" class="ai-conv-approve-badge" :title="t('aiChat.pendingApprovalCount', { n: pendingCountOf(conv.id) })">{{ pendingCountOf(conv.id) }}</span> <span v-if="pendingCountOf(conv.id) > 0" class="ai-conv-approve-badge" :title="t('aiChat.pendingApprovalCount', { n: pendingCountOf(conv.id) })">{{ pendingCountOf(conv.id) }}</span>
<!-- 无人值守边界徽标:该会话已授权任务边界(镜像渐进填充);点击随会话切回显 --> <!-- 无人值守边界徽标:该会话已授权任务边界(镜像渐进填充);点击随会话切回显 -->
@@ -145,6 +156,16 @@
@keydown="onItemKeydown($event, conv.id, true)" @keydown="onItemKeydown($event, conv.id, true)"
> >
<div class="ai-conv-item-main"> <div class="ai-conv-item-main">
<!-- wave2 u-agent 范式: 左侧 7px 状态点(映射源同搜索态块注) -->
<span
class="df-dot ai-conv-status"
:class="store.isGenerating(conv.id) ? 'df-dot--run ai-conv-status--run'
: pendingCountOf(conv.id) > 0 ? 'ai-conv-status--danger'
: conv.loop_state === 'parked' ? 'ai-conv-status--paused'
: 'df-dot--stop'"
:title="store.isGenerating(conv.id) ? t('aiChat.generating') : undefined"
aria-hidden="true"
></span>
<input <input
v-if="editingConvId === conv.id" v-if="editingConvId === conv.id"
:ref="setEditEl" :ref="setEditEl"
@@ -168,8 +189,6 @@
class="ai-conv-item-title-badge" class="ai-conv-item-title-badge"
width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"
><polyline points="20 6 9 17 4 12"/></svg> ><polyline points="20 6 9 17 4 12"/></svg>
<!-- F-09: 多会话并发生成指示器(后台/当前会话生成中均显脉冲点,多会话可同时显示) -->
<span v-if="store.isGenerating(conv.id)" class="ai-conv-gen-dot" :title="t('aiChat.generating')"></span>
<!-- V1: 待审批徽标(橙点计数,复用既有 aiChat.pendingApprovalCount 文案) --> <!-- V1: 待审批徽标(橙点计数,复用既有 aiChat.pendingApprovalCount 文案) -->
<span v-if="pendingCountOf(conv.id) > 0" class="ai-conv-approve-badge" :title="t('aiChat.pendingApprovalCount', { n: pendingCountOf(conv.id) })">{{ pendingCountOf(conv.id) }}</span> <span v-if="pendingCountOf(conv.id) > 0" class="ai-conv-approve-badge" :title="t('aiChat.pendingApprovalCount', { n: pendingCountOf(conv.id) })">{{ pendingCountOf(conv.id) }}</span>
<!-- 无人值守边界徽标:该会话已授权任务边界(镜像渐进填充);点击随会话切回显 --> <!-- 无人值守边界徽标:该会话已授权任务边界(镜像渐进填充);点击随会话切回显 -->
@@ -225,6 +244,8 @@
@keydown.space.prevent="onRecover(conv.id)" @keydown.space.prevent="onRecover(conv.id)"
> >
<div class="ai-conv-item-main"> <div class="ai-conv-item-main">
<!-- wave2: 本组数据源 ai_list_recoverable(loop_state='parked' 完备真相),整组恒 parked→静态琥珀点 -->
<span class="df-dot ai-conv-status ai-conv-status--paused" aria-hidden="true"></span>
<span class="ai-conv-item-title"> <span class="ai-conv-item-title">
{{ conv.title || t('aiChat.newConversation') }} {{ conv.title || t('aiChat.newConversation') }}
<span class="ai-conv-recover-badge">⏸</span> <span class="ai-conv-recover-badge">⏸</span>
@@ -260,9 +281,18 @@
@keydown="onItemKeydown($event, conv.id)" @keydown="onItemKeydown($event, conv.id)"
> >
<div class="ai-conv-item-main"> <div class="ai-conv-item-main">
<!-- wave2 u-agent 范式: 归档项同款状态点(归档为静息态,默认落灰) -->
<span
class="df-dot ai-conv-status"
:class="store.isGenerating(conv.id) ? 'df-dot--run ai-conv-status--run'
: pendingCountOf(conv.id) > 0 ? 'ai-conv-status--danger'
: conv.loop_state === 'parked' ? 'ai-conv-status--paused'
: 'df-dot--stop'"
:title="store.isGenerating(conv.id) ? t('aiChat.generating') : undefined"
aria-hidden="true"
></span>
<span class="ai-conv-item-title" :title="conv.title || ''"> <span class="ai-conv-item-title" :title="conv.title || ''">
{{ conv.title || t('aiChat.newConversation') }} {{ conv.title || t('aiChat.newConversation') }}
<span v-if="store.isGenerating(conv.id)" class="ai-conv-gen-dot" :title="t('aiChat.generating')"></span>
<!-- V1: 待审批徽标(橙点计数,复用既有 aiChat.pendingApprovalCount 文案) --> <!-- V1: 待审批徽标(橙点计数,复用既有 aiChat.pendingApprovalCount 文案) -->
<span v-if="pendingCountOf(conv.id) > 0" class="ai-conv-approve-badge" :title="t('aiChat.pendingApprovalCount', { n: pendingCountOf(conv.id) })">{{ pendingCountOf(conv.id) }}</span> <span v-if="pendingCountOf(conv.id) > 0" class="ai-conv-approve-badge" :title="t('aiChat.pendingApprovalCount', { n: pendingCountOf(conv.id) })">{{ pendingCountOf(conv.id) }}</span>
<!-- 无人值守边界徽标:该会话已授权任务边界(镜像渐进填充);点击随会话切回显 --> <!-- 无人值守边界徽标:该会话已授权任务边界(镜像渐进填充);点击随会话切回显 -->
@@ -296,6 +326,17 @@
</div> </div>
</template> </template>
<!-- F4-1: 会话列表分页——底部「加载更多」续拉下一页(首屏 50/组,归档组同口径放开) -->
<div
v-if="convListPaging.hasMore"
class="ai-conv-load-more"
role="button"
tabindex="0"
@click="onLoadMore"
@keydown.enter.prevent="onLoadMore"
@keydown.space.prevent="onLoadMore"
>{{ convListPaging.loading ? t('common.loading') : t('gitChanges.loadMore') }}</div>
<div v-if="store.state.conversations.length === 0" class="ai-conv-empty"> <div v-if="store.state.conversations.length === 0" class="ai-conv-empty">
{{ t('aiChat.emptyConversation') }} {{ t('aiChat.emptyConversation') }}
</div> </div>
@@ -338,7 +379,8 @@ import { convPendingApprovals } from '../../composables/ai/aiShared'
// 镜像由边界配置卡在切会话/写入时渐进填充,无批量 IPC 属契约限制) // 镜像由边界配置卡在切会话/写入时渐进填充,无批量 IPC 属契约限制)
import { getConvBoundary, fetchConvBoundary } from '../../composables/ai/useTaskBoundary' import { getConvBoundary, fetchConvBoundary } from '../../composables/ai/useTaskBoundary'
// UX走查 P2-7 只读订阅:rename/archive/pin 失败通知由 useAiConversations 发布,本组件弹就近 toast // UX走查 P2-7 只读订阅:rename/archive/pin 失败通知由 useAiConversations 发布,本组件弹就近 toast
import { convOpFailNotice } from '../../composables/ai/useAiConversations' // F4-1: 会话列表分页游标(reactive,绑「加载更多」显隐/loading)+ 续拉/拉满动作
import { convOpFailNotice, convListPaging, loadMoreConversations, loadAllConversations } from '../../composables/ai/useAiConversations'
import { useToast } from '../../composables/useToast' import { useToast } from '../../composables/useToast'
import { formatRelative } from '../../utils/time' import { formatRelative } from '../../utils/time'
import type { AiConversationSummary } from '../../api/types' import type { AiConversationSummary } from '../../api/types'
@@ -662,6 +704,28 @@ const searchResults = computed<AiConversationSummary[] | null>(
() => store.filteredConversations.value, () => store.filteredConversations.value,
) )
// ── F4-1: 会话列表分页(加载更多按钮 + 搜索全量兜底) ──
/** 「加载更多」:续拉下一页(失败/无新增静默,按钮 loading 态由 convListPaging 驱动) */
function onLoadMore(): void {
void loadMoreConversations()
}
// 搜索输入即拉满:搜索过滤(stores.filteredConversations)跑在已加载列表上,未拉满时
// 第 51 条起的会话搜不到(硬 50 截断=搜索失灵)——输入非空且还有未拉页时一次拉尽,
// 之后搜索自然覆盖全量;已拉满(hasMore=false)零开销不触发。
watch(() => store.state.searchQuery, (q) => {
if (q.trim() && convListPaging.hasMore && !convListPaging.loading) {
void loadAllConversations()
}
})
// 加载更多/搜索拉满追加的新会话补拉边界徽标镜像(A10 空洞随列表加深扩大;
// hydrate 对已入镜像的会话跳过,常规刷新时零 IPC)
watch(() => store.state.conversations.length, () => {
void hydrateBoundaryBadges()
})
// ── 侧栏宽度拖拽 ── // ── 侧栏宽度拖拽 ──
const resizeState = { startX: 0, startWidth: 0 } const resizeState = { startX: 0, startWidth: 0 }
function onResizeMove(e: MouseEvent) { function onResizeMove(e: MouseEvent) {
@@ -756,7 +820,7 @@ defineExpose({
transition: background 0.15s var(--df-ease); transition: background 0.15s var(--df-ease);
} }
.ai-sidebar-resize-handle:hover { .ai-sidebar-resize-handle:hover {
background: var(--df-accent, #4f8cff); background: var(--df-accent);
opacity: 0.5; opacity: 0.5;
} }
/* 拖拽中全局锁 cursor + 禁选中文本(挂在 body 上,跨元素生效) */ /* 拖拽中全局锁 cursor + 禁选中文本(挂在 body 上,跨元素生效) */
@@ -773,18 +837,26 @@ body.ai-sidebar-resizing * {
border-bottom: 0.5px solid var(--df-border); border-bottom: 0.5px solid var(--df-border);
} }
.ai-conv-sidebar-title { .ai-conv-sidebar-title {
font-size: 12px; font-size: 13px;
font-weight: 500; font-weight: 600;
color: var(--df-text); color: var(--df-text);
} }
/* UX-06 §3.1: 对话搜索框(紧贴 header 下,样式跟随周围输入控件) */ /* UX-06 §3.1: 对话搜索框(wave2 u-agent .sb-search 范式:容器成框,卡底+focus 边框 info) */
.ai-conv-search { .ai-conv-search {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 6px 10px; margin: 8px 10px;
border-bottom: 0.5px solid var(--df-border); padding: 0 8px;
height: 30px;
background: var(--df-bg-card);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm);
transition: border-color 0.15s var(--df-ease);
}
.ai-conv-search:focus-within {
border-color: var(--df-info);
} }
.ai-conv-search-icon { .ai-conv-search-icon {
flex: none; flex: none;
@@ -800,8 +872,8 @@ body.ai-sidebar-resizing * {
font-size: 12px; font-size: 12px;
color: var(--df-text); color: var(--df-text);
} }
/* 聚焦可见环:无边框输入聚焦无变化,且 scoped 选择器特异性高于全局 :focus-visible 兜底,须就地补环,仅键盘聚焦显示 */ /* 聚焦可见环:容器已随 :focus-within 变 info 边框,键盘环同色补强(scoped 特异性须盖全局兜底) */
.ai-conv-search-input:focus-visible { outline: 2px solid var(--df-accent); outline-offset: 1px; } .ai-conv-search-input:focus-visible { outline: 2px solid var(--df-info); outline-offset: 1px; }
.ai-conv-search-input::placeholder { .ai-conv-search-input::placeholder {
color: var(--df-text-dim); color: var(--df-text-dim);
} }
@@ -819,12 +891,15 @@ body.ai-sidebar-resizing * {
.ai-conv-list { .ai-conv-list {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
padding: 4px; padding: 4px 6px; /* u-agent .sb-list 范式;滚动条走 global ::-webkit-scrollbar token 体系 */
} }
/* wave2 u-agent 范式: 分组头 10px uppercase + letter-spacing 1px + dim */
.ai-conv-group-title { .ai-conv-group-title {
padding: 8px 8px 3px; padding: 10px 8px 4px;
font-size: 10px; font-size: 10px;
font-weight: 600; font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
color: var(--df-text-dim); color: var(--df-text-dim);
user-select: none; user-select: none;
} }
@@ -851,7 +926,10 @@ body.ai-sidebar-resizing * {
.ai-conv-group-count { .ai-conv-group-count {
margin-left: 2px; margin-left: 2px;
font-weight: 400; font-weight: 400;
opacity: 0.7; font-family: var(--df-font-mono); /* mono 计数(df-mono 范式),upper/lsp 回退保证数字不散 */
font-size: 10px;
letter-spacing: 0;
opacity: 0.9;
} }
.ai-conv-group-empty { .ai-conv-group-empty {
padding: 2px 8px 4px 20px; padding: 2px 8px 4px 20px;
@@ -859,40 +937,48 @@ body.ai-sidebar-resizing * {
color: var(--df-text-dim); color: var(--df-text-dim);
font-style: italic; font-style: italic;
} }
/* wave2 u-agent .cv 范式: 单行条目,8px 级密度;hover/active 同走灰阶卡底(GitHub 两级同底、
active 由左 2px accent 实线区分),深浅主题同 token 自动适配 */
.ai-conv-item { .ai-conv-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 6px 8px; padding: 8px;
border-radius: var(--df-radius); border-radius: var(--df-radius);
cursor: pointer; cursor: pointer;
transition: background 0.15s; transition: background 0.15s;
gap: 4px; gap: 6px;
} }
.ai-conv-item:hover { .ai-conv-item:hover {
background: var(--df-sidebar-hover); background: var(--df-bg-card-hover);
} }
.ai-conv-item--active { .ai-conv-item--active {
background: var(--df-sidebar-active); background: var(--df-bg-card-hover);
box-shadow: inset 2px 0 0 var(--df-accent);
} }
/* 切换进行时(UX走查 P1):与活跃项同底色示"已选中"(乐观预高亮),降不透明度示"加载中"; /* 切换进行时(UX走查 P1):与活跃项同底色示"已选中"(乐观预高亮),降不透明度示"加载中";
IPC 返回后 activeConversationId 落定、本类移除,视觉无缝衔接;失败回滚高亮回原活跃项 */ IPC 返回后 activeConversationId 落定、本类移除,视觉无缝衔接;失败回滚高亮回原活跃项 */
.ai-conv-item--switching { .ai-conv-item--switching {
background: var(--df-sidebar-active); background: var(--df-bg-card-hover);
opacity: 0.7; opacity: 0.7;
} }
.ai-conv-item--archived .ai-conv-item-title { .ai-conv-item--archived .ai-conv-item-title {
opacity: 0.6; opacity: 0.6;
} }
/* wave2: 行内布局对齐 .cv-top([状态点][标题省略][时间]) */
.ai-conv-item-main { .ai-conv-item-main {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: row;
gap: 2px; align-items: center;
gap: 6px;
} }
.ai-conv-item-title { .ai-conv-item-title {
font-size: 11px; flex: 1;
min-width: 0;
font-size: 12px;
font-weight: 500;
color: var(--df-text); color: var(--df-text);
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@@ -901,7 +987,6 @@ body.ai-sidebar-resizing * {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 3px; gap: 3px;
min-width: 0;
} }
/* UX-2025-20 §7.4: AI 生成标题淡入(0.3s opacity + transform 过渡) */ /* UX-2025-20 §7.4: AI 生成标题淡入(0.3s opacity + transform 过渡) */
.ai-conv-item-title--flash { .ai-conv-item-title--flash {
@@ -916,34 +1001,35 @@ body.ai-sidebar-resizing * {
to { opacity: 1; transform: translateX(0); } to { opacity: 1; transform: translateX(0); }
} }
.ai-conv-item-edit { .ai-conv-item-edit {
flex: 1 1 0; /* wave2: main 已行化,输入框按 flex 填充(min-width:0 防 input 固有宽撑破窄侧栏) */
min-width: 0;
width: auto;
font-size: 11px; font-size: 11px;
color: var(--df-text); color: var(--df-text);
width: 100%;
height: 18px; height: 18px;
padding: 0 4px; padding: 0 4px;
border: 1px solid var(--df-accent); border: 1px solid var(--df-accent);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: var(--df-bg, #fff); background: var(--df-bg);
outline: none; outline: none;
box-sizing: border-box; box-sizing: border-box;
} }
/* 聚焦可见环:边框恒为 accent 聚焦无变化,且 scoped 选择器特异性高于全局 :focus-visible 兜底,须就地补环,仅键盘聚焦显示 */ /* 聚焦可见环:边框恒为 accent 聚焦无变化,且 scoped 选择器特异性高于全局 :focus-visible 兜底,须就地补环,仅键盘聚焦显示 */
.ai-conv-item-edit:focus-visible { outline: 2px solid var(--df-accent); outline-offset: 1px; } .ai-conv-item-edit:focus-visible { outline: 2px solid var(--df-accent); outline-offset: 1px; }
/* wave2 u-agent 范式: 时间/计数元数据 mono 10px dim(.df-mono 同款视觉) */
.ai-conv-item-time { .ai-conv-item-time {
font-size: 9px; flex: none;
font-family: var(--df-font-mono);
font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
} }
/* 多会话并发生成指示器(会话项标题行内脉冲点,多会话可同时显示) */ /* wave2 u-agent .st 状态点变体: 公共 .df-dot/.df-dot--run/.df-dot--stop 管造型与绿/灰底,
.ai-conv-gen-dot { 此处只补动效与缺位色(全 token): run 绿+glow+脉冲(global df-pulse)、danger 待审批红、paused 停靠琥珀 */
display: inline-block; .ai-conv-status--run { box-shadow: 0 0 6px var(--df-success); animation: df-pulse 1.5s infinite; }
width: 6px; .ai-conv-status--danger { background: var(--df-danger); }
height: 6px; .ai-conv-status--paused { background: var(--df-warning); }
border-radius: 50%;
background: var(--df-accent);
flex-shrink: 0;
animation: ai-conv-gen-pulse 1.4s ease-in-out infinite;
}
@keyframes ai-conv-gen-pulse { @keyframes ai-conv-gen-pulse {
/* 供 .ai-conv-recover-dot 分组级脉冲用(原行内 gen-dot 已由状态点接管) */
0%, 100% { opacity: 0.35; transform: scale(0.85); } 0%, 100% { opacity: 0.35; transform: scale(0.85); }
50% { opacity: 1; transform: scale(1.15); } 50% { opacity: 1; transform: scale(1.15); }
} }
@@ -954,7 +1040,7 @@ body.ai-sidebar-resizing * {
height: 6px; height: 6px;
border-radius: 50%; border-radius: 50%;
margin-right: 5px; margin-right: 5px;
background: var(--df-warning, #f0c75e); background: var(--df-warning);
animation: ai-conv-gen-pulse 2s ease-in-out infinite; animation: ai-conv-gen-pulse 2s ease-in-out infinite;
} }
.ai-conv-item--recoverable { .ai-conv-item--recoverable {
@@ -965,7 +1051,7 @@ body.ai-sidebar-resizing * {
margin-left: 2px; margin-left: 2px;
font-size: 10px; font-size: 10px;
line-height: 1; line-height: 1;
color: var(--df-warning, #f0c75e); color: var(--df-warning);
cursor: help; cursor: help;
} }
/* V1: 跨会话待审批徽标(橙点计数,warning 色系与待审批语义一致;固定尺寸不挤标题换行) */ /* V1: 跨会话待审批徽标(橙点计数,warning 色系与待审批语义一致;固定尺寸不挤标题换行) */
@@ -974,7 +1060,7 @@ body.ai-sidebar-resizing * {
height: 12px; height: 12px;
padding: 0 3px; padding: 0 3px;
border-radius: 6px; border-radius: 6px;
background: var(--df-warning, #f0c75e); background: var(--df-warning);
color: #000; color: #000;
font-size: 9px; font-size: 9px;
font-weight: 600; font-weight: 600;
@@ -1031,9 +1117,13 @@ body.ai-sidebar-resizing * {
color: var(--df-text); color: var(--df-text);
} }
/* 已置顶对话视觉强调(左边线,不依赖菜单展开,一眼识别)。 /* 已置顶对话视觉强调(左边线,不依赖菜单展开,一眼识别)。
pinned 类挂在 .ai-conv-item 上(操作收进更多菜单后,按钮不再常驻,改 item 级类)。 */ pinned 类挂在 .ai-conv-item 上(操作收进更多菜单后,按钮不再常驻,改 item 级类)。
wave2: 选中态同占左缘,置顶线降为 45% 透明 accent 让位,选中实线优先 */
.ai-conv-item--pinned { .ai-conv-item--pinned {
box-shadow: inset 2px 0 0 var(--df-accent, var(--df-text)); box-shadow: inset 2px 0 0 color-mix(in srgb, var(--df-accent) 45%, transparent);
}
.ai-conv-item--active.ai-conv-item--pinned {
box-shadow: inset 2px 0 0 var(--df-accent);
} }
/* ── 「更多」操作菜单(置顶/归档/删除)── /* ── 「更多」操作菜单(置顶/归档/删除)──
「...」按钮 hover 时随 actions 浮出(同原 4 按钮交互),点击展开下拉。 「...」按钮 hover 时随 actions 浮出(同原 4 按钮交互),点击展开下拉。
@@ -1055,8 +1145,8 @@ body.ai-sidebar-resizing * {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1px; gap: 1px;
background: var(--df-bg, #fff); background: var(--df-bg);
border: 1px solid var(--df-border, #e2e2e2); border: 1px solid var(--df-border);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
} }
@@ -1087,6 +1177,21 @@ body.ai-sidebar-resizing * {
font-size: 11px; font-size: 11px;
color: var(--df-text-dim); color: var(--df-text-dim);
} }
/* F4-1: 列表底部「加载更多」(轻量文字行,hover 同列表项灰阶卡底范式) */
.ai-conv-load-more {
margin: 4px 2px;
padding: 6px 8px;
border-radius: var(--df-radius);
font-size: 11px;
color: var(--df-text-dim);
text-align: center;
cursor: pointer;
user-select: none;
}
.ai-conv-load-more:hover {
background: var(--df-bg-card-hover);
color: var(--df-text);
}
/* UX走查 P2-7: 会话操作失败就近 toast(仅 error 一型)。视觉对齐 AiChat .ai-toast, /* UX走查 P2-7: 会话操作失败就近 toast(仅 error 一型)。视觉对齐 AiChat .ai-toast,
但 AiChat 版是 scoped 样式渗透不进来,故自持一份;侧栏窄,max-width 收 85% */ 但 AiChat 版是 scoped 样式渗透不进来,故自持一份;侧栏窄,max-width 收 85% */
@@ -1101,7 +1206,7 @@ body.ai-sidebar-resizing * {
z-index: 30; /* 高于操作菜单(20),菜单展开时失败反馈不被盖 */ z-index: 30; /* 高于操作菜单(20),菜单展开时失败反馈不被盖 */
max-width: 85%; max-width: 85%;
overflow-wrap: anywhere; overflow-wrap: anywhere;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); box-shadow: var(--df-shadow-sm);
background: var(--df-danger-bg); background: var(--df-danger-bg);
color: var(--df-danger); color: var(--df-danger);
border: 0.5px solid var(--df-danger); border: 0.5px solid var(--df-danger);
+2 -2
View File
@@ -154,12 +154,12 @@ watch(() => visibleDirAuths.value.map(d => d.id).join('|'), async () => {
border-radius: var(--df-radius); border-radius: var(--df-radius);
} }
.ai-dir-auth-text { .ai-dir-auth-text {
font-size: 11.5px; font-size: 11px;
font-weight: 600; font-weight: 600;
color: var(--df-warning); color: var(--df-warning);
} }
.ai-dir-auth-hint { .ai-dir-auth-hint {
font-size: 10.5px; font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
opacity: 0.9; opacity: 0.9;
word-break: break-all; word-break: break-all;
+6 -5
View File
@@ -34,7 +34,7 @@ const examplePrompts = [
<div class="ai-empty"> <div class="ai-empty">
<template v-if="!hasProvider"> <template v-if="!hasProvider">
<div class="ai-empty-icon"> <div class="ai-empty-icon">
<svg aria-hidden="true" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="var(--df-warning)" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg> <svg aria-hidden="true" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
</div> </div>
<p class="ai-empty-text">{{ $t('aiChat.emptyNoProvider') }}</p> <p class="ai-empty-text">{{ $t('aiChat.emptyNoProvider') }}</p>
<p class="ai-empty-sub">{{ $t('aiChat.emptyNoProviderHint') }}</p> <p class="ai-empty-sub">{{ $t('aiChat.emptyNoProviderHint') }}</p>
@@ -46,7 +46,7 @@ const examplePrompts = [
</template> </template>
<template v-else> <template v-else>
<div class="ai-empty-icon"> <div class="ai-empty-icon">
<svg aria-hidden="true" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="var(--df-text-dim)" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a7 7 0 014 12.74V17a1 1 0 01-1 1H9a1 1 0 01-1-1v-2.26A7 7 0 0112 2z"/><line x1="9" y1="21" x2="15" y2="21"/></svg> <svg aria-hidden="true" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a7 7 0 014 12.74V17a1 1 0 01-1 1H9a1 1 0 01-1-1v-2.26A7 7 0 0112 2z"/><line x1="9" y1="21" x2="15" y2="21"/></svg>
</div> </div>
<p class="ai-empty-text">{{ $t('aiChat.emptyTitle') }}</p> <p class="ai-empty-text">{{ $t('aiChat.emptyTitle') }}</p>
<p class="ai-empty-sub">{{ $t('aiChat.emptyHint') }}</p> <p class="ai-empty-sub">{{ $t('aiChat.emptyHint') }}</p>
@@ -73,7 +73,8 @@ const examplePrompts = [
justify-content: center; justify-content: center;
gap: 8px; gap: 8px;
} }
.ai-empty-icon { margin-bottom: 4px; opacity: 0.4; } /* wave2:空态图标统一 dim 色(经 currentColor 接管 stroke),引导文字 secondary 层级 */
.ai-empty-icon { margin-bottom: 4px; opacity: 0.4; color: var(--df-text-dim); }
.ai-empty-text { .ai-empty-text {
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
@@ -81,7 +82,7 @@ const examplePrompts = [
} }
.ai-empty-sub { .ai-empty-sub {
font-size: 12px; font-size: 12px;
color: var(--df-text-dim); color: var(--df-text-secondary);
text-align: center; text-align: center;
line-height: 1.5; line-height: 1.5;
} }
@@ -117,7 +118,7 @@ const examplePrompts = [
border-radius: var(--df-radius); border-radius: var(--df-radius);
background: var(--df-bg-card); background: var(--df-bg-card);
color: var(--df-text-secondary); color: var(--df-text-secondary);
font-size: 11.5px; font-size: 11px;
line-height: 1.4; line-height: 1.4;
text-align: left; text-align: left;
cursor: pointer; cursor: pointer;
+14 -14
View File
@@ -74,30 +74,30 @@ function handleSelectOption(opt: string): void {
</script> </script>
<style scoped> <style scoped>
/* 复用 MaxRoundsCard 样式基调(warning 色系,求助属"需用户介入"信号,视觉一致) */ /* wave2(2026-10-18):统一透明彩底卡范式,danger 系(断路器熔断=最高警示级)——
边框 color-mix 30% + 底 8% + 标题同色 12px/600 + 正文 secondary 12px + 透明底描边钮 */
.ai-help-required { .ai-help-required {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 3px; gap: 3px;
margin-bottom: 6px; margin-bottom: 6px;
padding: 6px 8px; padding: 6px 8px;
background: color-mix(in srgb, var(--df-warning) 10%, transparent); background: color-mix(in srgb, var(--df-danger) 8%, transparent);
border: 0.5px solid color-mix(in srgb, var(--df-warning) 40%, transparent); border: 0.5px solid color-mix(in srgb, var(--df-danger) 30%, transparent);
border-radius: var(--df-radius); border-radius: var(--df-radius);
} }
.ai-help-required-text { .ai-help-required-text {
font-size: 11.5px; font-size: 12px;
font-weight: 600; font-weight: 600;
color: var(--df-warning); color: var(--df-danger);
} }
.ai-help-required-hint { .ai-help-required-hint {
font-size: 10.5px; font-size: 12px;
color: var(--df-text-dim); color: var(--df-text-secondary);
opacity: 0.9;
word-break: break-all; word-break: break-all;
/* M7:context 含错误堆栈,长栈撑高卡片。等宽字体利堆栈行对齐;max-height + overflow-y:auto /* M7:context 含错误堆栈,长栈撑高卡片。等宽字体利堆栈行对齐;max-height + overflow-y:auto
短内容自动不显滚动条,长堆栈滚动扫看(比折叠实用,无需展开按钮)。 */ 短内容自动不显滚动条,长堆栈滚动扫看(比折叠实用,无需展开按钮)。 */
font-family: var(--df-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); font-family: var(--df-font-mono);
max-height: 200px; max-height: 200px;
overflow-y: auto; overflow-y: auto;
} }
@@ -109,15 +109,15 @@ function handleSelectOption(opt: string): void {
margin-top: 2px; margin-top: 2px;
} }
.ai-help-required-btn { .ai-help-required-btn {
border: 0.5px solid color-mix(in srgb, var(--df-warning) 60%, transparent); border: 0.5px solid color-mix(in srgb, var(--df-danger) 40%, transparent);
background: var(--df-warning); background: color-mix(in srgb, var(--df-danger) 10%, transparent);
color: #000; color: var(--df-danger);
cursor: pointer; cursor: pointer;
font-size: 11px; font-size: 11px;
font-weight: 600; font-weight: 600;
padding: 3px 10px; padding: 3px 10px;
border-radius: calc(var(--df-radius) - 2px); border-radius: calc(var(--df-radius) - 2px);
transition: filter 0.15s var(--df-ease); transition: background 0.15s var(--df-ease);
} }
.ai-help-required-btn:hover { filter: brightness(1.1); } .ai-help-required-btn:hover { background: color-mix(in srgb, var(--df-danger) 16%, transparent); }
</style> </style>
+2 -2
View File
@@ -84,7 +84,7 @@ const emit = defineEmits<{
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
/* 类型标签小色块(项目/任务区分) */ /* 类型标签小色块(项目/任务区分)。2026-10-18: 原底色引用未定义 token 静默失效,修正为 bg-card-hover */
.ai-mention-item-type { .ai-mention-item-type {
flex-shrink: 0; flex-shrink: 0;
padding: 1px 5px; padding: 1px 5px;
@@ -92,7 +92,7 @@ const emit = defineEmits<{
font-size: 9px; font-size: 9px;
font-weight: 600; font-weight: 600;
letter-spacing: 0.3px; letter-spacing: 0.3px;
background: var(--df-bg-hover); background: var(--df-bg-card-hover);
color: var(--df-text-dim); color: var(--df-text-dim);
} }
.ai-mention-item-type--project { .ai-mention-item-type--project {
+19 -14
View File
@@ -149,29 +149,34 @@ const imageParts = computed(() => msgImageParts(props.msg))
align-items: flex-start; align-items: flex-start;
flex-direction: row-reverse; flex-direction: row-reverse;
} }
/* 头像通用 */ /* 头像通用 — workbench .av 范式:24px 圆角方块渐变,用户 warning→danger 系,
字色随主题底色反转保证渐变上对比;内部字符 9px 700(当前为 svg 图标,字号字重为字符兜底) */
.ai-msg-avatar { .ai-msg-avatar {
width: 22px; width: 24px;
height: 22px; height: 24px;
border-radius: 50%; border-radius: var(--df-radius);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-shrink: 0; flex-shrink: 0;
font-size: 9px;
font-weight: 700;
} }
.ai-msg-avatar--user { .ai-msg-avatar--user {
background: var(--df-info-bg, rgba(100,181,246,0.15)); background: linear-gradient(135deg, color-mix(in srgb, var(--df-warning) 70%, var(--df-danger)), var(--df-danger));
color: var(--df-info, #64b5f6); color: var(--df-bg);
} }
/* 气泡通用 */ /* 气泡通用 — workbench 聊天范式:用户气泡=bg-card 底+0.5px 边框+9px 圆角。
9px 圆角与 9px 13px 内距均为 u-agent workbench 移植值,勿规整 */
.ai-msg-bubble { .ai-msg-bubble {
border-radius: 10px; border-radius: 9px;
padding: 8px 12px; padding: 9px 13px;
word-break: break-word; word-break: break-word;
max-width: 80%; max-width: 80%;
} }
.ai-msg-bubble--user { .ai-msg-bubble--user {
background: var(--df-info-bg, rgba(100,181,246,0.1)); background: var(--df-bg-card);
border: 0.5px solid var(--df-border);
color: var(--df-text); color: var(--df-text);
} }
/* chip */ /* chip */
@@ -181,13 +186,13 @@ const imageParts = computed(() => msgImageParts(props.msg))
border-radius: 4px; border-radius: 4px;
font-size: 11px; font-size: 11px;
margin: 0 2px; margin: 0 2px;
background: var(--df-accent-bg, rgba(108,99,255,0.1)); background: var(--df-accent-bg);
color: var(--df-accent, #6c63ff); color: var(--df-accent);
} }
/* 技能调用徽章(问题3):与 mention chip 同视觉家族,亮一档紫色底 + ⚡ 前缀区分 */ /* 技能调用徽章(问题3):与 mention chip 同视觉家族,亮一档紫色底 + ⚡ 前缀区分 */
.ai-msg-chip--skill { .ai-msg-chip--skill {
background: var(--df-accent-bg, rgba(108,99,255,0.18)); background: var(--df-accent-bg);
color: var(--df-accent, #6c63ff); color: var(--df-accent);
font-weight: 600; font-weight: 600;
} }
/* 图片 */ /* 图片 */
+144 -165
View File
@@ -45,7 +45,7 @@ const emit = defineEmits<{
}>() }>()
const store = useAiStore() const store = useAiStore()
const { t } = useI18n() const { t, locale } = useI18n()
// ── 消息任务关联(有的消息有,有的没):从 toolCalls[].args 派生 ── // ── 消息任务关联(有的消息有,有的没):从 toolCalls[].args 派生 ──
// 数据源:AiToolCallInfo.args 已携带工具入参,任务工具的 task_id 就在其中 // 数据源:AiToolCallInfo.args 已携带工具入参,任务工具的 task_id 就在其中
@@ -676,23 +676,28 @@ const _decoCache = new Map<string, string>()
const DECO_CACHE_LIMIT = 800 const DECO_CACHE_LIMIT = 800
function decorateCodeHtml(raw: string): string { function decorateCodeHtml(raw: string): string {
if (!raw || !raw.includes('<pre><code')) return raw if (!raw || !raw.includes('<pre><code')) return raw
const hit = _decoCache.get(raw) // F1-1:复制按钮文案走 i18n(v-html 渲染层拿不到 $t,经参数注入);locale 入缓存键,
// 否则切语言后命中旧缓存,按钮文案停留在旧语言。locale 读取同时建立响应式依赖,
// 切语言时调用方(computed/渲染函数)重算拿到新语言装饰结果。
const cacheKey = locale.value + '\u0000' + raw
const hit = _decoCache.get(cacheKey)
if (hit !== undefined) { if (hit !== undefined) {
// LRU:命中即置为最近使用(delete+set 移到 Map 末尾),淘汰时优先保留热项 // LRU:命中即置为最近使用(delete+set 移到 Map 末尾),淘汰时优先保留热项
_decoCache.delete(raw) _decoCache.delete(cacheKey)
_decoCache.set(raw, hit) _decoCache.set(cacheKey, hit)
return hit return hit
} }
// marked 的 code renderer 统一输出 <pre><code class="hljs ...">…</code></pre> // marked 的 code renderer 统一输出 <pre><code class="hljs ...">…</code></pre>
//(含缩进码块),代码内容已 HTML 转义,正则非贪婪到首个闭合标签不会越界。 //(含缩进码块),代码内容已 HTML 转义,正则非贪婪到首个闭合标签不会越界。
// R4 语言角标:code class 形如 hljs language-ts,捕获 language-xxx 输出到 .md-code-block // R4 语言角标:code class 形如 hljs language-ts,捕获 language-xxx 输出到 .md-code-block
// 的 data-lang,CSS ::after 显示;无语言(裸块/auto 猜测无 language- 类)不显角标。 // 的 data-lang,CSS ::after 显示;无语言(裸块/auto 猜测无 language- 类)不显角标。
const copyLabel = t('aiChat.copyCode')
const out = raw.replace( const out = raw.replace(
/<pre><code([^>]*)>([\s\S]*?)<\/code><\/pre>/g, /<pre><code([^>]*)>([\s\S]*?)<\/code><\/pre>/g,
(_m: string, attrs: string, body: string) => { (_m: string, attrs: string, body: string) => {
const lang = /language-([a-z0-9+#.-]+)/i.exec(attrs)?.[1] ?? '' const lang = /language-([a-z0-9+#.-]+)/i.exec(attrs)?.[1] ?? ''
const langAttr = lang ? ` data-lang="${lang}"` : '' const langAttr = lang ? ` data-lang="${lang}"` : ''
return `<div class="md-code-block"${langAttr}><button type="button" class="md-code-copy">复制</button><pre><code${attrs}>${body}</code></pre></div>` return `<div class="md-code-block"${langAttr}><button type="button" class="md-code-copy">${copyLabel}</button><pre><code${attrs}>${body}</code></pre></div>`
}, },
) )
// 有界 LRU 淘汰:超限删最久未用项(Map 首项)后插入,替代原整体 clear // 有界 LRU 淘汰:超限删最久未用项(Map 首项)后插入,替代原整体 clear
@@ -700,7 +705,7 @@ function decorateCodeHtml(raw: string): string {
const oldest = _decoCache.keys().next().value const oldest = _decoCache.keys().next().value
if (oldest !== undefined) _decoCache.delete(oldest) if (oldest !== undefined) _decoCache.delete(oldest)
} }
_decoCache.set(raw, out) _decoCache.set(cacheKey, out)
return out return out
} }
/** renderMd 包装:渲染 + 代码块装饰(双层 memo:renderMd 的 _mdCache + 本缓存,未变即零成本) */ /** renderMd 包装:渲染 + 代码块装饰(双层 memo:renderMd 的 _mdCache + 本缓存,未变即零成本) */
@@ -744,7 +749,7 @@ async function onMdCodeCopyClick(e: MouseEvent): Promise<void> {
} }
// 成功态短暂反馈(直接改按钮 DOM;下次 v-html 重渲染自然还原,无需状态机) // 成功态短暂反馈(直接改按钮 DOM;下次 v-html 重渲染自然还原,无需状态机)
const prev = btn.textContent const prev = btn.textContent
btn.textContent = ok ? '已复制' : '复制失败' btn.textContent = ok ? t('aiChat.copied') : t('aiChat.copyFailed')
btn.classList.add(ok ? 'is-ok' : 'is-err') btn.classList.add(ok ? 'is-ok' : 'is-err')
setTimeout(() => { setTimeout(() => {
btn.textContent = prev btn.textContent = prev
@@ -924,13 +929,12 @@ function collapsedPreviewHtml(msg: AiMessage): string {
// R3:折叠条带量 —— 折叠态按钮显示「已折叠 N 字符 / 约 M tokens,点击展开」。 // R3:折叠条带量 —— 折叠态按钮显示「已折叠 N 字符 / 约 M tokens,点击展开」。
// 折叠量按 M1 的标定估算(400px 视口 ≈ 阈值字符量,见 LONG_MSG_THRESHOLD 注), // 折叠量按 M1 的标定估算(400px 视口 ≈ 阈值字符量,见 LONG_MSG_THRESHOLD 注),
// 即 content.length - 阈值;token 为粗估(中英混合 1 token ≈ 2.5 字符),只供量级感知。 // 即 content.length - 阈值;token 为粗估(中英混合 1 token ≈ 2.5 字符),只供量级感知。
// 文案硬编码中文:i18n locale 文件本批锁定(他代理并行追加,不新增键), // 文案走 i18n(F1-1 补键);展开态仍复用既有 aiChat.collapse 键。
// 展开态仍复用既有 aiChat.collapse 键。
const CHAR_PER_TOKEN_EST = 2.5 const CHAR_PER_TOKEN_EST = 2.5
function collapsedLongLabel(msg: AiMessage): string { function collapsedLongLabel(msg: AiMessage): string {
const folded = Math.max(0, (msg.content?.length ?? 0) - LONG_MSG_THRESHOLD) const folded = Math.max(0, (msg.content?.length ?? 0) - LONG_MSG_THRESHOLD)
const tokens = Math.max(1, Math.round(folded / CHAR_PER_TOKEN_EST)) const tokens = Math.max(1, Math.round(folded / CHAR_PER_TOKEN_EST))
return `已折叠 ${folded} 字符 / 约 ${tokens} tokens,点击展开` return t('aiChat.foldedSummary', { chars: folded, tokens })
} }
/** /**
@@ -1226,7 +1230,13 @@ const renderItems = computed<RenderItem[]>(() => {
bucket = [] bucket = []
if (msgs.length === 0) return if (msgs.length === 0) return
const lastStoreId = store.state.messages[store.state.messages.length - 1]?.id const lastStoreId = store.state.messages[store.state.messages.length - 1]?.id
const executing = isViewingGenerating.value && msgs[msgs.length - 1].id === lastStoreId // F1-3(10-17 走查):执行中判定补充「桶内存在 running/pending_approval 工具」。
// 仅靠「桶末=store 末条」时,生成中注入补充消息会在 store 末尾 push 本地 user 气泡,
// 判定瞬间失配 → 执行桶被误判为完成态,降级成默认折叠 trace 卡,正在跑/待审批的
// 工具卡跌进折叠体不可见(下一轮 assistant push 才自愈)。桶内工具仍活跃即说明该轮
// 未收敛,保持 step 形态内联可见;工具全部收敛后回到末条比对,历史桶不受影响(BUG-261001)。
const hasLiveTool = msgs.some(m => (m.toolCalls ?? []).some(tc => tc.status === 'running' || tc.status === 'pending_approval'))
const executing = isViewingGenerating.value && (msgs[msgs.length - 1].id === lastStoreId || hasLiveTool)
// 961③: 轮号=当前发起计数(与轨迹卡是否产出解耦,单消息桶不吞号) // 961③: 轮号=当前发起计数(与轨迹卡是否产出解耦,单消息桶不吞号)
const round = currentRound const round = currentRound
const built = buildBucket(msgs, round, executing, lastTs) const built = buildBucket(msgs, round, executing, lastTs)
@@ -1566,7 +1576,7 @@ watch(() => store.state.activeConversationId, (newId, oldId) => {
onBeforeUnmount(() => { onBeforeUnmount(() => {
cancelPendingRaf() cancelPendingRaf()
document.removeEventListener('click', closeTokenPopoverOnOutsideClick) document.removeEventListener('click', closeTokenPopoverOnOutsideClick)
document.removeEventListener('keydown', closeAgentTraceOnEsc) document.removeEventListener('keydown', closeOverlaysOnEsc)
}) })
// token 详情面板:点击外部关闭(token 区内的 @click.stop 已阻冒泡,故文档级点击必为外部) // token 详情面板:点击外部关闭(token 区内的 @click.stop 已阻冒泡,故文档级点击必为外部)
@@ -1575,11 +1585,14 @@ function closeTokenPopoverOnOutsideClick(): void {
} }
document.addEventListener('click', closeTokenPopoverOnOutsideClick) document.addEventListener('click', closeTokenPopoverOnOutsideClick)
// 子代理轨迹浮层 Esc 关闭(与遮罩点击/X 同为关闭出口;仅浮层开着时消费,不干扰其他快捷键) // 浮层 Esc 关闭:子代理轨迹浮层 + token 详情 popover(F6-3:后者原先仅外点关闭,
function closeAgentTraceOnEsc(e: KeyboardEvent): void { // 键盘用户开了面板只能点别处)。两者同时开着时逐层关(先浮层后 popover),Esc 不冒泡旁路。
if (e.key === 'Escape' && agentPeekVisible.value) closeAgentTrace() function closeOverlaysOnEsc(e: KeyboardEvent): void {
if (e.key !== 'Escape') return
if (agentPeekVisible.value) closeAgentTrace()
else if (tokenPopoverMsgId.value !== null) tokenPopoverMsgId.value = null
} }
document.addEventListener('keydown', closeAgentTraceOnEsc) document.addEventListener('keydown', closeOverlaysOnEsc)
// Markdown 预热(父原 loadMarkdown 在 onMounted 调,子组件同样幂等——useMarkdown 单例, // Markdown 预热(父原 loadMarkdown 在 onMounted 调,子组件同样幂等——useMarkdown 单例,
// 多次调用安全,确保子组件挂载即预热)。 // 多次调用安全,确保子组件挂载即预热)。
@@ -2141,7 +2154,7 @@ defineExpose({
background: var(--df-bg-card); background: var(--df-bg-card);
color: var(--df-text-dim); color: var(--df-text-dim);
cursor: pointer; cursor: pointer;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); box-shadow: var(--df-shadow-sm);
z-index: 15; z-index: 15;
transition: color 0.15s var(--df-ease), border-color 0.15s var(--df-ease); transition: color 0.15s var(--df-ease), border-color 0.15s var(--df-ease);
} }
@@ -2161,7 +2174,7 @@ defineExpose({
width: 8px; width: 8px;
height: 8px; height: 8px;
border-radius: 50%; border-radius: 50%;
background: var(--df-warning, #e8a33d); background: var(--df-warning);
animation: ai-btb-pulse 2s ease-in-out infinite; animation: ai-btb-pulse 2s ease-in-out infinite;
} }
@keyframes ai-btb-pulse { @keyframes ai-btb-pulse {
@@ -2172,14 +2185,8 @@ defineExpose({
/* -- Empty State 样式已随 EmptyState.vue 提取 -- */ /* -- Empty State 样式已随 EmptyState.vue 提取 -- */
/* -- Message Layout -- */ /* -- Message Layout -- */
.ai-msg-user { /* 用户消息行 .ai-msg-user 随 MessageItem.vue 抽离(自带 scoped,本组件 scoped 不渗透其内部),
position: relative; 原重复定义删除(2026-10-18 整洁波,死样式验证:模板零引用+scoped 隔离永不命中) */
display: flex;
gap: 8px;
align-items: flex-start;
flex-direction: row-reverse; /* 头像在右:DOM 仍 avatar 在先,视觉反转成【气泡】【头像】靠右 */
margin-top: -3px; /* user 与上方消息间距略收(全局 gap 14 → 视觉 11),更紧凑 */
}
.ai-msg-ai { .ai-msg-ai {
position: relative; position: relative;
display: flex; display: flex;
@@ -2197,7 +2204,8 @@ defineExpose({
gap: 8px; gap: 8px;
} }
/* -- Avatar -- */ /* -- Avatar -- workbench .av 范式:24px 圆角方块渐变(用户 warning→danger 系 / AI info→accent 系),
字色随主题底色反转保证渐变上对比;内部字符 9px 700(当前为 svg 图标,字号字重为字符兜底) */
.ai-msg-avatar { .ai-msg-avatar {
width: 24px; width: 24px;
height: 24px; height: 24px;
@@ -2206,41 +2214,44 @@ defineExpose({
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-shrink: 0; flex-shrink: 0;
font-size: 9px;
font-weight: 700;
} }
.ai-msg-avatar--user { /* .ai-msg-avatar--user 随 MessageItem.vue 抽离(自带 scoped) */
background: var(--df-info-bg);
color: var(--df-info);
}
.ai-msg-avatar--ai { .ai-msg-avatar--ai {
background: var(--df-accent-bg); background: linear-gradient(135deg, color-mix(in srgb, var(--df-info) 70%, var(--df-accent)), var(--df-accent));
color: var(--df-accent); color: var(--df-bg);
} }
/* -- Bubble -- */ /* -- Bubble -- workbench 聊天范式:用户=bg-card 底+0.5px 边框+9px 圆角;AI=无气泡(透明底直接排版)。
9px 圆角与 9px 13px 内距均为 u-agent workbench 移植值,勿规整 */
.ai-msg-bubble { .ai-msg-bubble {
position: relative; position: relative;
font-size: 13px; font-size: 13px;
line-height: 1.6; line-height: 1.6;
max-width: var(--df-msg-max-width); max-width: var(--df-msg-max-width);
padding: 8px 12px; padding: 9px 13px;
border-radius: var(--df-radius-lg); border-radius: 9px;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
.ai-msg-bubble--user { /* 用户气泡 .ai-msg-bubble--user 随 MessageItem.vue 抽离(自带 scoped,原「同范式兜底」
background: var(--df-accent); 实为 scoped 隔离永不命中的死规则,2026-10-18 整洁波删除) */
color: #fff;
border-bottom-right-radius: var(--df-radius-sm);
}
.ai-msg-bubble--ai { .ai-msg-bubble--ai {
background: var(--df-bg-card); background: transparent;
border: none;
padding: 0;
color: var(--df-text); color: var(--df-text);
border: 0.5px solid var(--df-border);
border-bottom-left-radius: var(--df-radius-sm);
} }
/* 错误气泡对齐 workbench .blocked-card 范式:30% 红边框+6% 红底+12px 字;
AI 无气泡后本卡自含 padding/边框/圆角(排在 --ai 后覆盖) */
.ai-msg-bubble--error { .ai-msg-bubble--error {
background: var(--df-danger-bg); padding: 10px 13px;
border: 1px solid color-mix(in srgb, var(--df-danger) 30%, transparent);
border-radius: 9px;
background: color-mix(in srgb, var(--df-danger) 6%, transparent);
color: var(--df-danger); color: var(--df-danger);
border-color: rgba(240,101,101,0.3); font-size: 12px;
margin-top: 6px;
} }
/* 修正 的 display:block 方案——display:block 让 table 失去表格 /* 修正 的 display:block 方案——display:block 让 table 失去表格
布局上下文,tr/td 脱离 table 上下文塌成块级堆叠丢列对齐(用户截图反馈测试报告四列表格错乱)。 布局上下文,tr/td 脱离 table 上下文塌成块级堆叠丢列对齐(用户截图反馈测试报告四列表格错乱)。
@@ -2255,8 +2266,8 @@ defineExpose({
overflow-x: auto; overflow-x: auto;
} }
/* M1:超长 assistant 文本折叠——max-height 截断 + 底部渐变遮罩 + 展开按钮。 /* M1:超长 assistant 文本折叠——max-height 截断 + 底部渐变遮罩 + 展开按钮。
背景 var(--df-bg-card) 对齐 .ai-msg-bubble--ai(L876):渐变淡出到气泡背景, AI 气泡已透明(workbench 范式):渐变淡出到页面背景 --df-bg,视觉上内容「沉入」页面
视觉上内容「沉入」气泡而非被硬切。overflow:hidden 覆盖 .ai-md 的 overflow-x:auto。 */ 而非被硬切。overflow:hidden 覆盖 .ai-md 的 overflow-x:auto。 */
.ai-msg-bubble--collapsed { .ai-msg-bubble--collapsed {
max-height: 400px; max-height: 400px;
overflow: hidden; overflow: hidden;
@@ -2269,7 +2280,7 @@ defineExpose({
left: 0; left: 0;
right: 0; right: 0;
height: 48px; height: 48px;
background: linear-gradient(transparent, var(--df-bg-card)); background: linear-gradient(transparent, var(--df-bg));
pointer-events: none; /* 让点击穿透到下方展开按钮 */ pointer-events: none; /* 让点击穿透到下方展开按钮 */
} }
/* 展开按钮:气泡底部居中,置于渐变遮罩之上 */ /* 展开按钮:气泡底部居中,置于渐变遮罩之上 */
@@ -2293,10 +2304,12 @@ defineExpose({
background: var(--df-bg-card-hover); background: var(--df-bg-card-hover);
} }
/* ── JSON 工具结果折叠防御(对齐 miniapp .msg-toolresult 视觉:灰 #b0b0b0 / 11px / /* ── JSON 工具结果折叠防御(对齐 miniapp .msg-toolresult 视觉:弱化灰字 / 11px /
等宽 / max-height 80px 裁剪):assistant content 为纯 JSON 工具结果时弱化为折叠块, 等宽 / max-height 80px 裁剪):assistant content 为纯 JSON 工具结果时弱化为折叠块,
不渲染 markdown 大气泡刷屏。默认 max-height 80px + overflow-y:auto 可滚动, 不渲染 markdown 大气泡刷屏。默认 max-height 80px + overflow-y:auto 可滚动,
点击整块切换 --expanded(移除高度限制)展开/收起完整内容。 ── */ 点击整块切换 --expanded(移除高度限制)展开/收起完整内容。
F1-2:灰字由硬编码 #b0b0b0 改 --df-text-dim——硬编码值在浅色主题白底上
对比度约 2.6:1 不可读;token 双主题各有值,弱化语义不变。 ── */
.ai-msg-json { .ai-msg-json {
max-height: 80px; max-height: 80px;
overflow-y: auto; overflow-y: auto;
@@ -2307,7 +2320,7 @@ defineExpose({
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 11px; font-size: 11px;
line-height: 1.5; line-height: 1.5;
color: #b0b0b0; color: var(--df-text-dim);
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
} }
@@ -2325,27 +2338,8 @@ defineExpose({
border-color: var(--df-accent); border-color: var(--df-accent);
} }
/* ── Input Augmentation: 用户气泡内 mention chip(圆角徽标,复用 ChatInput .ai-skill-chip-name 风格) ── /* ── mention chip(.ai-msg-chip 族)随 MessageItem.vue 抽离(自带 scoped,含 --skill 变体;
用户气泡背景 = --df-accent(主题强调色,如深色蓝/紫),chip 用半透明白底+深字 保证对比度; 此处原 kind 变体因 scoped 隔离永不命中,2026-10-18 整洁波删除) ── */
按 kind 区分颜色变体(project/task/idea/skill),与 @ mention 浮层 .ai-mention-item-type--* 视觉呼应。 */
.ai-msg-chip {
display: inline-block;
padding: 1px 6px;
margin: 0 1px;
border-radius: var(--df-radius);
font-size: 0.9em;
font-weight: 600;
line-height: 1.4;
background: rgba(255, 255, 255, 0.22);
color: #fff;
vertical-align: baseline;
white-space: nowrap;
}
/* kind 颜色变体(用更亮的底色区分,但保持白字可读) */
.ai-msg-chip--project { background: rgba(255, 255, 255, 0.32); }
.ai-msg-chip--task { background: rgba(255, 255, 255, 0.26); }
.ai-msg-chip--idea { background: rgba(255, 255, 255, 0.22); border: 1px solid rgba(255, 255, 255, 0.35); }
.ai-msg-chip--skill { background: rgba(0, 0, 0, 0.18); }
/* ── UX 密度改造:居中时间分隔线(相邻消息间隔 ≥30 分钟或跨天; /* ── UX 密度改造:居中时间分隔线(相邻消息间隔 ≥30 分钟或跨天;
per-block 相对时间漂移无价值已移除,精确时刻在消息容器 title) ── */ per-block 相对时间漂移无价值已移除,精确时刻在消息容器 title) ── */
@@ -2368,10 +2362,13 @@ defineExpose({
background: color-mix(in srgb, var(--df-text-dim) 22%, transparent); background: color-mix(in srgb, var(--df-text-dim) 22%, transparent);
} }
/* ── 最终回答卡:左 2px 品牌色强调边条 + 背景微抬升(与轨迹内思考 pill 明确分层) ── */ /* ── 最终回答卡:左 2px 品牌色强调边条 + 背景微抬升(与轨迹内思考 pill 明确分层);
AI 无气泡后本卡自含 padding 保持卡感(普通 AI 消息仍无气泡) ── */
.ai-msg-bubble--answer { .ai-msg-bubble--answer {
border-left: 2px solid var(--df-accent); border-left: 2px solid var(--df-accent);
background: color-mix(in srgb, var(--df-accent) 4%, var(--df-bg-card)); border-radius: var(--df-radius);
background: color-mix(in srgb, var(--df-accent) 4%, transparent);
padding: 8px 12px;
} }
/* ── 轮次导航条(仅多轮长会话 ≥3 张轨迹卡出现,sticky 置顶,只做跳转) ── */ /* ── 轮次导航条(仅多轮长会话 ≥3 张轨迹卡出现,sticky 置顶,只做跳转) ── */
@@ -2415,8 +2412,8 @@ defineExpose({
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 22px; width: var(--df-h-icon-btn);
height: 22px; height: var(--df-h-icon-btn);
border: none; border: none;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: rgba(0, 0, 0, 0.35); background: rgba(0, 0, 0, 0.35);
@@ -2426,14 +2423,13 @@ defineExpose({
transition: opacity 0.2s; transition: opacity 0.2s;
flex-shrink: 0; flex-shrink: 0;
} }
.ai-msg-user:hover .ai-copy-btn,
.ai-msg-ai:hover .ai-copy-btn--ai { .ai-msg-ai:hover .ai-copy-btn--ai {
opacity: 1; opacity: 1;
} }
.ai-copy-btn:hover { .ai-copy-btn:hover {
background: rgba(0, 0, 0, 0.55); background: rgba(0, 0, 0, 0.55);
} }
/* 图片复制按钮排在文本复制按钮左侧(right 让位 22px 按钮 + 4px 间距) */ /* 图片复制按钮排在文本复制按钮左侧(right 让位 26px 按钮 + 4px 间距) */
.ai-copy-btn--image { .ai-copy-btn--image {
right: 30px; right: 30px;
} }
@@ -2443,6 +2439,23 @@ defineExpose({
.ai-md :deep(.md-code-block) { .ai-md :deep(.md-code-block) {
position: relative; position: relative;
} }
/* workbench .code 范式:比 --df-bg 更深一档的底 + 边框 + md 圆角 + mono 11px,
覆盖全局 ai-md.css 的 .ai-md pre(现有 hljs github-dark 语法高亮色不动)。
浅色主题降为 8% 黑:45% 全量在浅底上会压垮正文/高亮对比,违背双主题成立铁律。 */
.ai-md :deep(pre) {
background: color-mix(in srgb, var(--df-bg), #000 45%);
border: 1px solid var(--df-border);
border-radius: var(--df-radius-md);
font-family: var(--df-font-mono);
font-size: 11px;
}
.ai-md :deep(pre code) {
font-size: 11px;
line-height: 1.6;
}
[data-theme='light'] .ai-md :deep(pre) {
background: color-mix(in srgb, var(--df-bg), #000 8%);
}
.ai-md :deep(.md-code-copy) { .ai-md :deep(.md-code-copy) {
position: absolute; position: absolute;
top: 6px; top: 6px;
@@ -2468,8 +2481,8 @@ defineExpose({
} }
.ai-md :deep(.md-code-copy.is-ok) { .ai-md :deep(.md-code-copy.is-ok) {
opacity: 1; opacity: 1;
color: var(--df-success, #4caf50); color: var(--df-success);
border-color: var(--df-success, #4caf50); border-color: var(--df-success);
} }
.ai-md :deep(.md-code-copy.is-err) { .ai-md :deep(.md-code-copy.is-err) {
opacity: 1; opacity: 1;
@@ -2519,7 +2532,7 @@ defineExpose({
/* Fatal 错误(不可重试)的提示文案——替代隐藏的「重试」按钮, /* Fatal 错误(不可重试)的提示文案——替代隐藏的「重试」按钮,
说明为何无重试入口,引导走「去设置」。 */ 说明为何无重试入口,引导走「去设置」。 */
.ai-msg-not-retryable { .ai-msg-not-retryable {
font-size: 10.5px; font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
font-style: italic; font-style: italic;
align-self: center; align-self: center;
@@ -2528,12 +2541,12 @@ defineExpose({
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 3px; gap: 3px;
padding: 2px 7px; padding: 2px 6px;
border: none; border: none;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: transparent; background: transparent;
color: var(--df-text-dim); color: var(--df-text-dim);
font-size: 10.5px; font-size: 10px;
line-height: 1.4; line-height: 1.4;
cursor: pointer; cursor: pointer;
transition: background 0.15s, color 0.15s; transition: background 0.15s, color 0.15s;
@@ -2565,11 +2578,11 @@ defineExpose({
margin-top: 4px; margin-top: 4px;
padding: 3px 8px; padding: 3px 8px;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: color-mix(in srgb, var(--df-warning, #ffc107) 10%, transparent); background: color-mix(in srgb, var(--df-warning) 10%, transparent);
width: fit-content; width: fit-content;
} }
.ai-msg-truncated-text { .ai-msg-truncated-text {
font-size: 10.5px; font-size: 10px;
line-height: 1.4; line-height: 1.4;
color: var(--df-text-dim); color: var(--df-text-dim);
} }
@@ -2600,7 +2613,7 @@ defineExpose({
padding-top: 6px; padding-top: 6px;
border-top: 0.5px solid var(--df-border); border-top: 0.5px solid var(--df-border);
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 9px; font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
opacity: 0.7; opacity: 0.7;
} }
@@ -2618,8 +2631,9 @@ defineExpose({
cursor: pointer; cursor: pointer;
opacity: 1; opacity: 1;
} }
/* workbench .round-meta 范式:元数据 hover 变 --df-info */
.ai-token-usage-trigger:hover { .ai-token-usage-trigger:hover {
color: var(--df-text); color: var(--df-info);
opacity: 1; opacity: 1;
} }
.ai-token-sep { .ai-token-sep {
@@ -2627,7 +2641,7 @@ defineExpose({
} }
/* G4.3:估算值标注(估算非真实,弱化 dim + warning 色调,不喧宾夺主) */ /* G4.3:估算值标注(估算非真实,弱化 dim + warning 色调,不喧宾夺主) */
.ai-token-est { .ai-token-est {
color: var(--df-warning, #f0c75e); color: var(--df-warning);
opacity: 0.85; opacity: 0.85;
} }
/* 详情面板:复用 TopBar popout 风格(absolute / right 0 / bg-card / border / shadow) */ /* 详情面板:复用 TopBar popout 风格(absolute / right 0 / bg-card / border / shadow) */
@@ -2638,7 +2652,7 @@ defineExpose({
margin-top: 4px; margin-top: 4px;
padding: 8px 10px; padding: 8px 10px;
min-width: 200px; min-width: 200px;
background: var(--df-bg-card, var(--df-bg)); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: 4px; border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
@@ -2678,23 +2692,7 @@ defineExpose({
font-weight: 500; font-weight: 500;
} }
/* 用户气泡内的图片(多模态消息渲染) */ /* 用户气泡内图片(.ai-msg-images/.ai-msg-image)随 MessageItem.vue 抽离(自带 scoped) */
.ai-msg-images {
display: flex;
flex-wrap: wrap;
gap: 4px;
margin-top: 6px;
}
.ai-msg-image {
max-width: 200px;
max-height: 200px;
width: auto;
height: auto;
border-radius: var(--df-radius);
object-fit: contain;
display: block;
background: var(--df-bg);
}
/* ═══ 压缩摘要 system 块(compressed 原文已展开,摘要置顶提示发给 AI 的是它) ═══ /* ═══ 压缩摘要 system 块(compressed 原文已展开,摘要置顶提示发给 AI 的是它) ═══
用户诉求:压缩只后端省 token,界面不藏消息。原文 compressed 照常 user/ai 气泡展开, 用户诉求:压缩只后端省 token,界面不藏消息。原文 compressed 照常 user/ai 气泡展开,
@@ -2773,7 +2771,7 @@ defineExpose({
.ai-trace-head { .ai-trace-head {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 7px; gap: 8px;
padding: 6px 10px; padding: 6px 10px;
font-size: 11px; font-size: 11px;
cursor: pointer; cursor: pointer;
@@ -2806,6 +2804,11 @@ defineExpose({
font-size: 10px; font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
} }
/* workbench .round-meta 范式:轮次/时间/token 小元数据 hover 变 --df-info(折叠交互不动) */
.ai-trace-head:hover .ai-trace-agg,
.ai-trace-head:hover .ai-trace-tokens {
color: var(--df-info);
}
/* 任务关联 chip(仅含任务工具调用的轮次渲染):accent 弱化底 + hover 提亮,点击跳任务 */ /* 任务关联 chip(仅含任务工具调用的轮次渲染):accent 弱化底 + hover 提亮,点击跳任务 */
.ai-trace-task-chip { .ai-trace-task-chip {
flex-shrink: 0; flex-shrink: 0;
@@ -2826,7 +2829,8 @@ defineExpose({
} }
/* ── 轨迹展开态 rail 面板:左轨竖线贯通,思考 pill 与工具卡图标锚定其上(git-graph 式轮次结构)。 /* ── 轨迹展开态 rail 面板:左轨竖线贯通,思考 pill 与工具卡图标锚定其上(git-graph 式轮次结构)。
轨 x=22px 对齐工具卡图标中心(卡内 padding 10px + 24px 图标位一半),pill 灯泡图标同 x。 ── */ 轨 x=22px 对齐工具卡图标中心(卡内 padding 10px + 24px 图标位一半),pill 灯泡图标同 x。
workbench .tr 范式:1px 连线用 --df-border。 ── */
.ai-trace-body { .ai-trace-body {
position: relative; position: relative;
padding: 2px 10px 8px 0; padding: 2px 10px 8px 0;
@@ -2838,7 +2842,7 @@ defineExpose({
top: 0; top: 0;
bottom: 0; bottom: 0;
width: 1px; width: 1px;
background: color-mix(in srgb, var(--df-text-dim) 22%, transparent); background: var(--df-border);
} }
.ai-trace-round { .ai-trace-round {
position: relative; position: relative;
@@ -2852,10 +2856,10 @@ defineExpose({
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 7px; gap: 6px;
width: 100%; width: 100%;
min-height: 24px; min-height: 24px;
padding: 3px 8px 3px 38px; padding: 3px 8px 3px var(--df-icon-gutter);
border: none; border: none;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: transparent; background: transparent;
@@ -2872,16 +2876,16 @@ defineExpose({
} }
.ai-think-ic { .ai-think-ic {
position: absolute; position: absolute;
left: 10px; left: 11px;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
width: 24px; width: 22px;
height: 24px; height: 22px;
border-radius: var(--df-radius-sm); border-radius: 50%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: var(--df-accent-bg); background: color-mix(in srgb, var(--df-accent) 15%, transparent);
color: var(--df-accent); color: var(--df-accent);
flex-shrink: 0; flex-shrink: 0;
} }
@@ -2896,14 +2900,14 @@ defineExpose({
flex: 0 0 auto; flex: 0 0 auto;
white-space: nowrap; white-space: nowrap;
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 9.5px; font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
opacity: 0.75; opacity: 0.75;
margin-left: auto; margin-left: auto;
} }
/* 展开的完整思考段落:保持既有卡片样式(气泡卡同底),挂在 pill 下方缩进对齐正文 */ /* 展开的完整思考段落:保持既有卡片样式(气泡卡同底),挂在 pill 下方缩进对齐正文 */
.ai-think-full { .ai-think-full {
margin: 2px 0 6px 38px; margin: 2px 0 6px var(--df-icon-gutter);
padding: 8px 12px; padding: 8px 12px;
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
@@ -2916,30 +2920,14 @@ defineExpose({
} }
/* 执行中态轨迹卡(骨架与完成态完全同构,仅色/态微差):accent 底 + 脉冲点替代 chevron, /* 执行中态轨迹卡(骨架与完成态完全同构,仅色/态微差):accent 底 + 脉冲点替代 chevron,
step→trace 切换时卡片高度/内边距一致,只 patch 内部文字 → 无跳变 */ step→trace 切换时卡片高度/内边距一致,只 patch 内部文字 → 无跳变。
(.ai-trace-toggle--running/.ai-step-line/.ai-step-text 旧单行摘要骨架已废:step 卡
改用 trace-card 同构骨架,模板零引用,2026-10-18 整洁波删除) */
.ai-trace-card--running { .ai-trace-card--running {
border-style: solid; border-style: solid;
border-color: color-mix(in srgb, var(--df-accent) 28%, transparent); border-color: color-mix(in srgb, var(--df-accent) 28%, transparent);
background: color-mix(in srgb, var(--df-accent) 7%, transparent); background: color-mix(in srgb, var(--df-accent) 7%, transparent);
} }
.ai-trace-toggle--running {
color: var(--df-text-dim);
opacity: 0.9;
}
/* 执行中实时步骤摘要(已完成步骤收进一行,accent 呼吸点对齐状态栏 .ai-agentic-progress) */
.ai-step-line {
display: flex;
align-items: center;
gap: 6px;
max-width: var(--df-msg-max-width);
padding: 4px 10px;
border-radius: var(--df-radius);
background: color-mix(in srgb, var(--df-accent) 7%, transparent);
font-size: 11px;
color: var(--df-text-secondary);
user-select: none;
}
.ai-step-dot { .ai-step-dot {
width: 6px; width: 6px;
height: 6px; height: 6px;
@@ -2948,13 +2936,6 @@ defineExpose({
flex-shrink: 0; flex-shrink: 0;
animation: ai-step-pulse 1.2s ease-in-out infinite; animation: ai-step-pulse 1.2s ease-in-out infinite;
} }
.ai-step-text {
font-family: var(--df-font-mono);
font-size: 10.5px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@keyframes ai-step-pulse { @keyframes ai-step-pulse {
0%, 100% { opacity: 1; } 0%, 100% { opacity: 1; }
50% { opacity: 0.3; } 50% { opacity: 0.3; }
@@ -2969,7 +2950,7 @@ defineExpose({
max-width: var(--df-msg-max-width); max-width: var(--df-msg-max-width);
padding: 4px 10px; padding: 4px 10px;
border-radius: var(--df-radius); border-radius: var(--df-radius);
background: color-mix(in srgb, var(--df-warning, #f0c75e) 8%, transparent); background: color-mix(in srgb, var(--df-warning) 8%, transparent);
font-size: 11px; font-size: 11px;
color: var(--df-text-secondary); color: var(--df-text-secondary);
user-select: none; user-select: none;
@@ -2978,13 +2959,13 @@ defineExpose({
width: 5px; width: 5px;
height: 5px; height: 5px;
border-radius: 50%; border-radius: 50%;
background: var(--df-warning, #f0c75e); background: var(--df-warning);
flex-shrink: 0; flex-shrink: 0;
animation: ai-step-pulse 1.2s ease-in-out infinite; animation: ai-step-pulse 1.2s ease-in-out infinite;
} }
.ai-retry-text { .ai-retry-text {
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 10.5px; font-size: 10px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@@ -3018,10 +2999,10 @@ defineExpose({
flex-shrink: 0; flex-shrink: 0;
} }
.ai-agent-fin--warn { .ai-agent-fin--warn {
background: color-mix(in srgb, var(--df-warning, #f0c75e) 8%, transparent); background: color-mix(in srgb, var(--df-warning) 8%, transparent);
} }
.ai-agent-fin--warn .ai-agent-fin-dot { .ai-agent-fin--warn .ai-agent-fin-dot {
background: var(--df-warning, #f0c75e); background: var(--df-warning);
} }
.ai-agent-fin--err { .ai-agent-fin--err {
background: color-mix(in srgb, var(--df-danger) 10%, transparent); background: color-mix(in srgb, var(--df-danger) 10%, transparent);
@@ -3044,7 +3025,7 @@ defineExpose({
flex-shrink: 0; flex-shrink: 0;
} }
.ai-agent-fin--warn .ai-agent-fin-status { .ai-agent-fin--warn .ai-agent-fin-status {
color: var(--df-warning, #f0c75e); color: var(--df-warning);
} }
.ai-agent-fin--err .ai-agent-fin-status { .ai-agent-fin--err .ai-agent-fin-status {
color: var(--df-danger); color: var(--df-danger);
@@ -3057,7 +3038,8 @@ defineExpose({
.ai-agent-fin-meta { .ai-agent-fin-meta {
flex-shrink: 0; flex-shrink: 0;
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 10.5px; font-size: 10px;
color: var(--df-text-dim);
} }
/* 被拒工具 chip(P2-1):琥珀警示层与 truncated 同色系;限宽防长清单挤掉摘要行 */ /* 被拒工具 chip(P2-1):琥珀警示层与 truncated 同色系;限宽防长清单挤掉摘要行 */
.ai-agent-fin-rejected { .ai-agent-fin-rejected {
@@ -3068,9 +3050,9 @@ defineExpose({
white-space: nowrap; white-space: nowrap;
padding: 0 6px; padding: 0 6px;
border-radius: 999px; border-radius: 999px;
font-size: 10.5px; font-size: 10px;
background: color-mix(in srgb, var(--df-warning, #f0c75e) 16%, transparent); background: color-mix(in srgb, var(--df-warning) 16%, transparent);
color: var(--df-warning, #f0c75e); color: var(--df-warning);
} }
/* 无轨迹(启动失败)卡:禁点视觉,hover 不提亮(cursor 维持默认) */ /* 无轨迹(启动失败)卡:禁点视觉,hover 不提亮(cursor 维持默认) */
.ai-agent-fin--notrace { .ai-agent-fin--notrace {
@@ -3080,7 +3062,7 @@ defineExpose({
.ai-agent-fin--notrace:hover { .ai-agent-fin--notrace:hover {
background: color-mix(in srgb, var(--df-text-secondary) 6%, transparent); background: color-mix(in srgb, var(--df-text-secondary) 6%, transparent);
} }
/* peek 拉取中的加载微标(挂在具体卡右端) */ /* peek 拉取中的加载微标(挂在具体卡右端);旋转动画消费 global.css @keyframes df-spin */
.ai-agent-fin-spin { .ai-agent-fin-spin {
flex-shrink: 0; flex-shrink: 0;
width: 10px; width: 10px;
@@ -3088,10 +3070,7 @@ defineExpose({
border: 1.5px solid color-mix(in srgb, var(--df-text-secondary) 35%, transparent); border: 1.5px solid color-mix(in srgb, var(--df-text-secondary) 35%, transparent);
border-top-color: var(--df-text-secondary); border-top-color: var(--df-text-secondary);
border-radius: 50%; border-radius: 50%;
animation: ai-agent-fin-spin 0.8s linear infinite; animation: df-spin 0.8s linear infinite;
}
@keyframes ai-agent-fin-spin {
to { transform: rotate(360deg); }
} }
/* ═══ S3 子代理轨迹浮层(只读,关即弃) ═══ */ /* ═══ S3 子代理轨迹浮层(只读,关即弃) ═══ */
@@ -3112,7 +3091,7 @@ defineExpose({
background: var(--df-bg-raised); background: var(--df-bg-raised);
border: 0.5px solid var(--df-border-strong); border: 0.5px solid var(--df-border-strong);
border-radius: var(--df-radius-lg); border-radius: var(--df-radius-lg);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); box-shadow: var(--df-shadow-md);
overflow: hidden; overflow: hidden;
} }
.ai-agent-peek-head { .ai-agent-peek-head {
@@ -3124,7 +3103,7 @@ defineExpose({
flex-shrink: 0; flex-shrink: 0;
} }
.ai-agent-peek-title { .ai-agent-peek-title {
font-size: 12.5px; font-size: 12px;
font-weight: 600; font-weight: 600;
color: var(--df-text); color: var(--df-text);
} }
@@ -3169,7 +3148,7 @@ defineExpose({
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
gap: 6px; gap: 6px;
font-size: 10.5px; font-size: 10px;
font-weight: 600; font-weight: 600;
color: var(--df-text-secondary); color: var(--df-text-secondary);
margin-bottom: 4px; margin-bottom: 4px;
@@ -3193,7 +3172,7 @@ defineExpose({
.ai-agent-peek-msg--tool .ai-agent-peek-text, .ai-agent-peek-msg--tool .ai-agent-peek-text,
.ai-agent-peek-msg--system .ai-agent-peek-text { .ai-agent-peek-msg--system .ai-agent-peek-text {
color: var(--df-text-secondary); color: var(--df-text-secondary);
font-size: 11.5px; font-size: 11px;
} }
/* 浮层头身份标识行:置于标题下方,窄容器内单行省略 */ /* 浮层头身份标识行:置于标题下方,窄容器内单行省略 */
.ai-agent-peek-head-text { .ai-agent-peek-head-text {
@@ -3214,7 +3193,7 @@ defineExpose({
.ai-agent-peek-agent { .ai-agent-peek-agent {
flex-shrink: 0; flex-shrink: 0;
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 10.5px; font-size: 10px;
color: var(--df-info); color: var(--df-info);
background: var(--df-info-bg); background: var(--df-info-bg);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
+25 -10
View File
@@ -73,7 +73,7 @@
// OutboxDrawer:定时/待发消息统一列表(跨会话),支持 改期/立即发送/取消 + 底部新建。 // OutboxDrawer:定时/待发消息统一列表(跨会话),支持 改期/立即发送/取消 + 底部新建。
// 挂载点在 ChatInput.vue(⏰ 入口按钮旁,Teleport 自脱离输入区布局); // 挂载点在 ChatInput.vue(⏰ 入口按钮旁,Teleport 自脱离输入区布局);
// 后端 ai_outbox_* 命令未接线时 invoke 静默降级(useAiOutbox 内),抽屉空态可用。 // 后端 ai_outbox_* 命令未接线时 invoke 静默降级(useAiOutbox 内),抽屉空态可用。
import { ref, computed, watch } from 'vue' import { ref, computed, watch, onBeforeUnmount } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useAiOutbox, type AiOutboxItem } from '../../composables/ai/useAiOutbox' import { useAiOutbox, type AiOutboxItem } from '../../composables/ai/useAiOutbox'
import { useAiStore } from '../../stores/ai' import { useAiStore } from '../../stores/ai'
@@ -96,6 +96,20 @@ watch(() => props.open, (v) => {
if (v) void refresh() if (v) void refresh()
}) })
// F6-2(走查-信息UX 面六):Esc 关抽屉(与遮罩点击/✕ 同出口,键盘可达)。
// 监听挂 document:AiChat 全局 Esc 仲裁在 window 层,document 先于 window 收到冒泡,
// 此处消费即收口(stopPropagation),防「关抽屉的同时误关分离窗」一次按键双效果;
// IME 组词中的 Esc(229/isComposing)归输入法,不关抽屉(仓内三处同款守卫)。
function onEscClose(e: KeyboardEvent): void {
if (!props.open || e.key !== 'Escape') return
if (e.isComposing || e.keyCode === 229) return
e.preventDefault()
e.stopPropagation()
emit('close')
}
document.addEventListener('keydown', onEscClose)
onBeforeUnmount(() => document.removeEventListener('keydown', onEscClose))
// ── 列表展示 ── // ── 列表展示 ──
// 排序:活跃在前(sending→pending→failed),终态沉底;同级按 due_at 升序(尽快项 due null 排最前) // 排序:活跃在前(sending→pending→failed),终态沉底;同级按 due_at 升序(尽快项 due null 排最前)
@@ -230,7 +244,8 @@ async function onCreate(): Promise<void> {
.outbox-panel { .outbox-panel {
width: min(420px, 92vw); width: min(420px, 92vw);
height: 100%; height: 100%;
background: var(--df-bg-card); /* wave2:抽屉底 bg-raised(比 bg-card 抬一级,与遮罩分层) */
background: var(--df-bg-raised);
border-left: 0.5px solid var(--df-border); border-left: 0.5px solid var(--df-border);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -259,7 +274,7 @@ async function onCreate(): Promise<void> {
border-radius: var(--df-radius); border-radius: var(--df-radius);
} }
.outbox-close:hover { .outbox-close:hover {
background: var(--df-bg-raised); background: var(--df-bg-card-hover);
color: var(--df-text); color: var(--df-text);
} }
.outbox-list { .outbox-list {
@@ -309,8 +324,8 @@ async function onCreate(): Promise<void> {
border-color: color-mix(in srgb, var(--df-warning) 40%, transparent); border-color: color-mix(in srgb, var(--df-warning) 40%, transparent);
} }
.outbox-badge--failed { .outbox-badge--failed {
color: #e5484d; color: var(--df-danger);
border-color: color-mix(in srgb, #e5484d 40%, transparent); border-color: color-mix(in srgb, var(--df-danger) 40%, transparent);
} }
.outbox-text { .outbox-text {
font-size: 12px; font-size: 12px;
@@ -336,7 +351,7 @@ async function onCreate(): Promise<void> {
transition: background 0.15s, color 0.15s; transition: background 0.15s, color 0.15s;
} }
.outbox-act:hover:not(:disabled) { .outbox-act:hover:not(:disabled) {
background: var(--df-bg-raised); background: var(--df-bg-card-hover);
color: var(--df-text); color: var(--df-text);
} }
.outbox-act:disabled { .outbox-act:disabled {
@@ -353,12 +368,12 @@ async function onCreate(): Promise<void> {
color: #fff; color: #fff;
} }
.outbox-act--danger:hover:not(:disabled) { .outbox-act--danger:hover:not(:disabled) {
color: #e5484d; color: var(--df-danger);
border-color: color-mix(in srgb, #e5484d 40%, transparent); border-color: color-mix(in srgb, var(--df-danger) 40%, transparent);
} }
.outbox-dt { .outbox-dt {
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
background: var(--df-bg-raised); background: var(--df-bg-card);
color: var(--df-text); color: var(--df-text);
font-size: 11px; font-size: 11px;
padding: 3px 6px; padding: 3px 6px;
@@ -382,7 +397,7 @@ async function onCreate(): Promise<void> {
box-sizing: border-box; box-sizing: border-box;
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius); border-radius: var(--df-radius);
background: var(--df-bg-raised); background: var(--df-bg-card);
color: var(--df-text); color: var(--df-text);
font-size: 12px; font-size: 12px;
font-family: var(--df-font-sans); font-family: var(--df-font-sans);
+21 -16
View File
@@ -276,7 +276,8 @@ const echoSummary = computed(() => {
</script> </script>
<style scoped> <style scoped>
/* 输入区上方的轻量折叠条,视觉克制度对齐 .ai-input-hint(不抢输入框焦点注意力) */ /* 输入区上方的轻量折叠条,视觉克制度对齐 .ai-input-hint(不抢输入框焦点注意力)
wave2(2026-10-18):info 系透明彩底范式(授权边界=信息/配置信号,非警示) */
.ai-boundary { .ai-boundary {
margin-bottom: 4px; margin-bottom: 4px;
font-size: 11px; font-size: 11px;
@@ -292,7 +293,7 @@ const echoSummary = computed(() => {
color: var(--df-text-dim); color: var(--df-text-dim);
font-size: 11px; font-size: 11px;
cursor: pointer; cursor: pointer;
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm);
max-width: 100%; max-width: 100%;
} }
.ai-boundary-toggle:hover { color: var(--df-text); } .ai-boundary-toggle:hover { color: var(--df-text); }
@@ -301,26 +302,29 @@ const echoSummary = computed(() => {
flex-shrink: 0; flex-shrink: 0;
} }
.ai-boundary-chevron.is-open { transform: rotate(90deg); } .ai-boundary-chevron.is-open { transform: rotate(90deg); }
.ai-boundary-toggle-label { font-weight: 600; } /* 标题同色(info)12px 600 */
.ai-boundary-toggle-label { font-weight: 600; font-size: 12px; color: var(--df-info); }
.ai-boundary-echo { .ai-boundary-echo {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
color: var(--df-accent); color: var(--df-info);
opacity: 0.85; opacity: 0.85;
} }
.ai-boundary-body { .ai-boundary-body {
margin-top: 4px; margin-top: 4px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 7px; gap: 8px;
padding: 8px; padding: 8px;
background: color-mix(in srgb, var(--df-accent) 5%, transparent); background: color-mix(in srgb, var(--df-info) 6%, transparent);
border: 0.5px solid color-mix(in srgb, var(--df-accent) 20%, transparent); border: 0.5px solid color-mix(in srgb, var(--df-info) 30%, transparent);
border-radius: var(--df-radius); border-radius: var(--df-radius);
font-size: 12px;
color: var(--df-text-secondary);
} }
.ai-boundary-locked { .ai-boundary-locked {
font-size: 10.5px; font-size: 10px;
color: var(--df-warning); color: var(--df-warning);
} }
.ai-boundary-loadfail { .ai-boundary-loadfail {
@@ -328,7 +332,7 @@ const echoSummary = computed(() => {
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
gap: 6px; gap: 6px;
font-size: 10.5px; font-size: 10px;
color: var(--df-danger); color: var(--df-danger);
} }
.ai-boundary-row { .ai-boundary-row {
@@ -350,7 +354,7 @@ const echoSummary = computed(() => {
color: var(--df-text-dim); color: var(--df-text-dim);
white-space: nowrap; white-space: nowrap;
} }
.ai-boundary-unlimited input { accent-color: var(--df-accent); margin: 0; } .ai-boundary-unlimited input { accent-color: var(--df-info); margin: 0; }
.ai-boundary-unlimited:has(input:disabled) { cursor: not-allowed; opacity: 0.6; } .ai-boundary-unlimited:has(input:disabled) { cursor: not-allowed; opacity: 0.6; }
.ai-boundary-input { .ai-boundary-input {
flex: 1; flex: 1;
@@ -363,7 +367,7 @@ const echoSummary = computed(() => {
border-radius: calc(var(--df-radius) - 2px); border-radius: calc(var(--df-radius) - 2px);
outline: none; outline: none;
} }
.ai-boundary-input:focus { border-color: color-mix(in srgb, var(--df-accent) 40%, transparent); } .ai-boundary-input:focus { border-color: color-mix(in srgb, var(--df-info) 40%, transparent); }
.ai-boundary-input:disabled { opacity: 0.5; cursor: not-allowed; } .ai-boundary-input:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-boundary-input--num { flex: 0 0 90px; } .ai-boundary-input--num { flex: 0 0 90px; }
.ai-boundary-mini-btn { .ai-boundary-mini-btn {
@@ -413,10 +417,11 @@ const echoSummary = computed(() => {
align-items: center; align-items: center;
gap: 8px; gap: 8px;
} }
/* 一次授权钮:info 系透明底描边钮(对应色操作钮范式) */
.ai-boundary-confirm { .ai-boundary-confirm {
border: none; border: 0.5px solid color-mix(in srgb, var(--df-info) 40%, transparent);
background: var(--df-accent); background: color-mix(in srgb, var(--df-info) 10%, transparent);
color: #fff; color: var(--df-info);
font-size: 11px; font-size: 11px;
font-weight: 600; font-weight: 600;
padding: 4px 10px; padding: 4px 10px;
@@ -424,7 +429,7 @@ const echoSummary = computed(() => {
border-radius: calc(var(--df-radius) - 2px); border-radius: calc(var(--df-radius) - 2px);
transition: background 0.15s var(--df-ease); transition: background 0.15s var(--df-ease);
} }
.ai-boundary-confirm:hover:not(:disabled) { background: var(--df-accent-hover); } .ai-boundary-confirm:hover:not(:disabled) { background: color-mix(in srgb, var(--df-info) 18%, transparent); }
.ai-boundary-confirm:disabled { opacity: 0.5; cursor: not-allowed; } .ai-boundary-confirm:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-boundary-clear { .ai-boundary-clear {
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
@@ -442,7 +447,7 @@ const echoSummary = computed(() => {
.ai-boundary-field.is-error span { color: var(--df-danger); } .ai-boundary-field.is-error span { color: var(--df-danger); }
/* A11: 脏编辑提示条(切会话保留编辑时的可见说明) */ /* A11: 脏编辑提示条(切会话保留编辑时的可见说明) */
.ai-boundary-dirty { .ai-boundary-dirty {
font-size: 10.5px; font-size: 10px;
color: var(--df-warning); color: var(--df-warning);
} }
</style> </style>
+20 -17
View File
@@ -99,15 +99,16 @@ async function handleStopArchive(): Promise<void> {
</script> </script>
<style scoped> <style scoped>
/* 复用 HelpRequiredCard 样式基调(warning 色系,停靠属"需用户拍板"信号,视觉一致) */ /* wave2(2026-10-18):统一透明彩底卡范式,danger 系(非正常终局停靠=需用户拍板信号)——
边框 color-mix 30% + 底 8% + 标题同色 12px/600 + 正文 secondary 12px + 透明底描边钮 */
.ai-task-parked { .ai-task-parked {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 3px; gap: 3px;
margin-bottom: 6px; margin-bottom: 6px;
padding: 6px 8px; padding: 6px 8px;
background: color-mix(in srgb, var(--df-warning) 10%, transparent); background: color-mix(in srgb, var(--df-danger) 8%, transparent);
border: 0.5px solid color-mix(in srgb, var(--df-warning) 40%, transparent); border: 0.5px solid color-mix(in srgb, var(--df-danger) 30%, transparent);
border-radius: var(--df-radius); border-radius: var(--df-radius);
} }
.ai-task-parked-head { .ai-task-parked-head {
@@ -115,37 +116,39 @@ async function handleStopArchive(): Promise<void> {
align-items: center; align-items: center;
gap: 6px; gap: 6px;
} }
/* stop_kind 标签:透明 danger 描边 chip;fatal 连续失败重入耗尽=实底警示级最高 */
.ai-task-parked-tag { .ai-task-parked-tag {
flex-shrink: 0; flex-shrink: 0;
padding: 0 6px; padding: 0 6px;
border-radius: calc(var(--df-radius) - 2px); border-radius: calc(var(--df-radius) - 2px);
background: var(--df-warning); background: color-mix(in srgb, var(--df-danger) 12%, transparent);
color: #000; border: 0.5px solid color-mix(in srgb, var(--df-danger) 30%, transparent);
color: var(--df-danger);
font-size: 10px; font-size: 10px;
font-weight: 600; font-weight: 600;
line-height: 16px; line-height: 16px;
} }
.ai-task-parked-tag--fatal { .ai-task-parked-tag--fatal {
background: var(--df-danger); background: var(--df-danger);
border-color: var(--df-danger);
color: #fff; color: #fff;
} }
.ai-task-parked-title { .ai-task-parked-title {
font-size: 11.5px; font-size: 12px;
font-weight: 600; font-weight: 600;
color: var(--df-warning); color: var(--df-danger);
} }
.ai-task-parked-reason { .ai-task-parked-reason {
font-size: 11px; font-size: 12px;
color: var(--df-text-dim); color: var(--df-text-secondary);
opacity: 0.9;
word-break: break-word; word-break: break-word;
white-space: pre-wrap; white-space: pre-wrap;
} }
/* preserved 行与 reason 同色系但更弱一级:保证信息在,不与真实原因抢视觉权重 */ /* preserved 行与 reason 同色系但更弱一级:保证信息在,不与真实原因抢视觉权重 */
.ai-task-parked-preserved { .ai-task-parked-preserved {
font-size: 10.5px; font-size: 11px;
color: var(--df-text-dim); color: var(--df-text-dim);
opacity: 0.8; opacity: 0.85;
} }
.ai-task-parked-actions { .ai-task-parked-actions {
display: flex; display: flex;
@@ -155,17 +158,17 @@ async function handleStopArchive(): Promise<void> {
margin-top: 2px; margin-top: 2px;
} }
.ai-task-parked-btn { .ai-task-parked-btn {
border: 0.5px solid color-mix(in srgb, var(--df-warning) 60%, transparent); border: 0.5px solid color-mix(in srgb, var(--df-danger) 40%, transparent);
background: var(--df-warning); background: color-mix(in srgb, var(--df-danger) 10%, transparent);
color: #000; color: var(--df-danger);
cursor: pointer; cursor: pointer;
font-size: 11px; font-size: 11px;
font-weight: 600; font-weight: 600;
padding: 3px 10px; padding: 3px 10px;
border-radius: calc(var(--df-radius) - 2px); border-radius: calc(var(--df-radius) - 2px);
transition: filter 0.15s var(--df-ease); transition: background 0.15s var(--df-ease), color 0.15s var(--df-ease);
} }
.ai-task-parked-btn:hover { filter: brightness(1.1); } .ai-task-parked-btn:hover { background: color-mix(in srgb, var(--df-danger) 16%, transparent); }
.ai-task-parked-btn:disabled { opacity: 0.5; cursor: not-allowed; } .ai-task-parked-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-task-parked-btn--muted { .ai-task-parked-btn--muted {
background: transparent; background: transparent;
+109 -78
View File
@@ -14,7 +14,7 @@
<button <button
v-if="pendingApprovalCount > 0" v-if="pendingApprovalCount > 0"
type="button" type="button"
class="ai-approval-badge" class="ai-approval-badge df-badge df-badge--danger"
:title="$t('aiChat.pendingApprovalHint')" :title="$t('aiChat.pendingApprovalHint')"
@click="emit('scroll-to-pending')" @click="emit('scroll-to-pending')"
> >
@@ -24,7 +24,7 @@
<button <button
v-if="unattendedStatus?.breaker_tripped" v-if="unattendedStatus?.breaker_tripped"
type="button" type="button"
class="ai-unattended-badge ai-unattended-badge--tripped" class="ai-unattended-badge df-badge df-badge--danger"
:title="$t('aiChat.unattendedResetHint')" :title="$t('aiChat.unattendedResetHint')"
@click="resetUnattendedBreaker" @click="resetUnattendedBreaker"
> >
@@ -33,7 +33,7 @@
<button <button
v-else-if="unattendedStatus?.enabled" v-else-if="unattendedStatus?.enabled"
type="button" type="button"
class="ai-unattended-badge" class="ai-unattended-badge df-badge df-badge--accent"
:title="$t('aiChat.unattendedBadgeHint')" :title="$t('aiChat.unattendedBadgeHint')"
@click="jumpToUnattendedSettings" @click="jumpToUnattendedSettings"
> >
@@ -50,7 +50,7 @@
:title="store.state.providers.length > 1 ? $t('aiChat.providerSwitchSetsDefault') : ''" :title="store.state.providers.length > 1 ? $t('aiChat.providerSwitchSetsDefault') : ''"
@click="cycleProvider" @click="cycleProvider"
> >
<span class="provider-dot" :class="'provider-dot--' + providerStatus"></span> <span class="df-dot provider-dot" :class="'provider-dot--' + providerStatus"></span>
<span class="provider-name">{{ activeProviderName }}</span> <span class="provider-name">{{ activeProviderName }}</span>
</button> </button>
<div class="ai-provider-bar ai-provider-empty" v-else> <div class="ai-provider-bar ai-provider-empty" v-else>
@@ -182,7 +182,7 @@
</div> </div>
<!-- #14 桌面任务卡:后台在途任务(多会话并发生成中,点击切回) --> <!-- #14 桌面任务卡:后台在途任务(多会话并发生成中,点击切回) -->
<div v-if="runningTasks.length || recoverableTasks.length" class="ai-running-tasks-inline"> <div v-if="runningTasks.length || recoverableTasks.length" class="ai-running-tasks-inline">
<button type="button" class="ai-running-tasks-badge ai-tool-badge" :class="{ 'is-active': runningTasksExpanded }" @click="togglePanel('running')" :title="$t('aiChat.runningTasks')"> <button type="button" class="ai-running-tasks-badge ai-tool-badge df-badge df-badge--info" :class="{ 'is-active': runningTasksExpanded }" @click="togglePanel('running')" :title="$t('aiChat.runningTasks')">
<span class="ai-running-tasks-pulse"></span> <span class="ai-running-tasks-pulse"></span>
{{ runningTasks.length }} {{ runningTasks.length }}
</button> </button>
@@ -236,6 +236,8 @@
<span class="ai-history-text">{{ h.text }}</span> <span class="ai-history-text">{{ h.text }}</span>
<span class="ai-history-time">{{ h.time }}</span> <span class="ai-history-time">{{ h.time }}</span>
</div> </div>
<!-- F6-1:目标消息在折叠段内未渲染,面板不收 + 行内提示 -->
<div v-if="locateMissHint" class="ai-locate-miss">{{ locateMissHint }}</div>
</div> </div>
</Transition> </Transition>
</div> </div>
@@ -251,6 +253,8 @@
<span class="ai-summary-label">{{ $t('aiChat.compressedSummaryLabel') }} #{{ summaryMsgs.length - i }}</span> <span class="ai-summary-label">{{ $t('aiChat.compressedSummaryLabel') }} #{{ summaryMsgs.length - i }}</span>
<p class="ai-summary-preview">{{ s.text }}</p> <p class="ai-summary-preview">{{ s.text }}</p>
</div> </div>
<!-- F6-1:摘要项同享定位未命中提示(压缩段折叠时 system 消息同样不在 DOM) -->
<div v-if="locateMissHint" class="ai-locate-miss">{{ locateMissHint }}</div>
</div> </div>
</Transition> </Transition>
</div> </div>
@@ -413,6 +417,7 @@ onMounted(() => { void refreshUnattended() })
onBeforeUnmount(() => { onBeforeUnmount(() => {
unattendedDisposed = true unattendedDisposed = true
if (unattendedTimer) { clearTimeout(unattendedTimer); unattendedTimer = null } if (unattendedTimer) { clearTimeout(unattendedTimer); unattendedTimer = null }
if (locateMissTimer) { clearTimeout(locateMissTimer); locateMissTimer = null }
}) })
// ══ 更多菜单 popout 状态(上下文管理操作收纳)══ // ══ 更多菜单 popout 状态(上下文管理操作收纳)══
@@ -768,8 +773,23 @@ const summaryMsgs = computed<SummaryItem[]>(() => msgDerived.value.summaries)
const historyExpanded = ref(false) const historyExpanded = ref(false)
/** 点击历史消息项 → 滚动定位到对应的消息气泡 */ /** 点击历史消息项 → 滚动定位到对应的消息气泡 */
// F6-1(走查-信息UX 面六):目标消息在折叠段(已归档/已压缩)内时,折叠态不渲染
// [data-msg-id] 元素,querySelector 必空。原实现先收面板再查 DOM,未命中即静默无反应;
// 现改为面板保持展开 + 行内提示引导展开分隔条。展开折叠段的状态在 MessageList 内持有,
// 本组件不可达,提示是最小闭环(不跨组件撬状态)。
const locateMissHint = ref('')
let locateMissTimer: ReturnType<typeof setTimeout> | null = null
function showLocateMiss(): void {
locateMissHint.value = t('aiChat.historyLocateInSegment')
if (locateMissTimer) clearTimeout(locateMissTimer)
locateMissTimer = setTimeout(() => {
locateMissHint.value = ''
locateMissTimer = null
}, 5000)
}
function scrollToMessage(msgId: string) { function scrollToMessage(msgId: string) {
historyExpanded.value = false
// 消息列表已有 data-msg-id 属性,直接 DOM 查询定位。 // 消息列表已有 data-msg-id 属性,直接 DOM 查询定位。
// msgId 由后端生成,可能含 CSS 选择器元字符(: . [ ] / 空格 等), // msgId 由后端生成,可能含 CSS 选择器元字符(: . [ ] / 空格 等),
// 模板拼 selector 会被选择器解析器当伪类/类名异常 → querySelector 抛错或返回 null。 // 模板拼 selector 会被选择器解析器当伪类/类名异常 → querySelector 抛错或返回 null。
@@ -787,8 +807,13 @@ function scrollToMessage(msgId: string) {
el = Array.from(all).find(n => n.getAttribute('data-msg-id') === msgId) ?? null el = Array.from(all).find(n => n.getAttribute('data-msg-id') === msgId) ?? null
} }
if (el) { if (el) {
locateMissHint.value = ''
historyExpanded.value = false
el.scrollIntoView({ behavior: 'smooth', block: 'center' }) el.scrollIntoView({ behavior: 'smooth', block: 'center' })
return
} }
// 未命中:不收面板,提示替代静默
showLocateMiss()
} }
/** 目标/历史下拉容器 DOM 引用(用于点击外部检测) */ /** 目标/历史下拉容器 DOM 引用(用于点击外部检测) */
@@ -824,6 +849,7 @@ const contextExpanded = ref(false)
/** 弹出面板互斥:goals/history/summary/context/running 五个 badge 面板,点一个收起其他,再点当前切换。 */ /** 弹出面板互斥:goals/history/summary/context/running 五个 badge 面板,点一个收起其他,再点当前切换。 */
function togglePanel(panel: 'goals' | 'history' | 'summary' | 'context' | 'running') { function togglePanel(panel: 'goals' | 'history' | 'summary' | 'context' | 'running') {
locateMissHint.value = ''
const refs = { goals: goalsExpanded, history: historyExpanded, summary: summaryExpanded, context: contextExpanded, running: runningTasksExpanded } const refs = { goals: goalsExpanded, history: historyExpanded, summary: summaryExpanded, context: contextExpanded, running: runningTasksExpanded }
const willOpen = !refs[panel].value const willOpen = !refs[panel].value
goalsExpanded.value = historyExpanded.value = summaryExpanded.value = contextExpanded.value = runningTasksExpanded.value = false goalsExpanded.value = historyExpanded.value = summaryExpanded.value = contextExpanded.value = runningTasksExpanded.value = false
@@ -965,56 +991,37 @@ onBeforeUnmount(() => {
white-space: nowrap; white-space: nowrap;
max-width: 200px; max-width: 200px;
} }
/* 审批徽标(待审批>0 时显于头部,点击跳首个审批卡;div→button 后归零默认样式) */ /* 审批徽标(待审批>0 时显于头部,点击跳首个审批卡)
2026-10-18 wave2:迁 .df-badge--danger 透明彩底徽章(色由全局公共类接管,此处只留布局) */
.ai-approval-badge { .ai-approval-badge {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
background: var(--df-warning-bg);
color: var(--df-warning);
padding: 2px 8px;
border-radius: var(--df-radius-sm);
font-size: 11px;
font-weight: 500; font-weight: 500;
white-space: nowrap; white-space: nowrap;
transition: opacity 0.15s var(--df-ease); transition: opacity 0.15s var(--df-ease);
font-family: inherit;
appearance: none; appearance: none;
/* review ③:div→button 后 UA outset 边框需显式归零(appearance:none 不含 border) */
border: none;
} }
.ai-approval-badge:hover { .ai-approval-badge:hover {
opacity: 0.85; opacity: 0.85;
} }
.ai-approval-badge:focus-visible { .ai-approval-badge:focus-visible {
outline: 1.5px solid var(--df-accent, #4a9eff); outline: 1.5px solid var(--df-accent);
outline-offset: 1px; outline-offset: 1px;
} }
/* 挂机引擎态徽章(开启=accent 弱底;熔断=红底红字,点击复位) */ /* 挂机引擎态徽章(开启=accent / 熔断=danger,均由 df-badge 变体接管,此处只留布局) */
.ai-unattended-badge { .ai-unattended-badge {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
background: var(--df-accent-bg);
color: var(--df-accent);
padding: 2px 8px;
border-radius: var(--df-radius-sm);
font-size: 11px;
font-weight: 500; font-weight: 500;
white-space: nowrap; white-space: nowrap;
font-family: inherit;
appearance: none; appearance: none;
border: none;
transition: opacity 0.15s var(--df-ease); transition: opacity 0.15s var(--df-ease);
} }
.ai-unattended-badge:hover { .ai-unattended-badge:hover {
opacity: 0.85; opacity: 0.85;
} }
.ai-unattended-badge--tripped {
background: var(--df-danger-bg);
color: var(--df-danger);
border: 0.5px solid var(--df-danger);
}
/* ═══ 模型选择器(对话透明化 L1:紧凑下拉) ═══ */ /* ═══ 模型选择器(对话透明化 L1:紧凑下拉) ═══ */
.ai-model-picker { .ai-model-picker {
@@ -1053,25 +1060,28 @@ onBeforeUnmount(() => {
display: flex; display: flex;
gap: 4px; gap: 4px;
} }
/* ── 图标按钮(共享工具类,header-actions 内清空/压缩/最大化/分离/关闭等)── */ /* ── 图标按钮(共享工具类,header-actions 内清空/压缩/最大化/分离/关闭等)
2026-10-18 wave2:统一 workbench .hd-btn 范式——bg-card 底+边框+md 圆角+hover 边框亮 ── */
.ai-btn-icon { .ai-btn-icon {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 26px; width: 26px;
height: 26px; height: 26px;
border: none; border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-md);
background: transparent; background: var(--df-bg-card);
color: var(--df-text-dim); color: var(--df-text-dim);
cursor: pointer; cursor: pointer;
transition: background 0.15s, color 0.15s; transition: border-color 0.15s var(--df-ease), color 0.15s var(--df-ease), background 0.15s var(--df-ease);
} }
.ai-btn-icon:hover { .ai-btn-icon:hover {
background: var(--df-bg-card); border-color: var(--df-border-strong);
background: var(--df-bg-card-hover);
color: var(--df-text-secondary); color: var(--df-text-secondary);
} }
.ai-btn-icon--active { .ai-btn-icon--active {
border-color: color-mix(in srgb, var(--df-accent) 45%, transparent);
background: var(--df-accent-bg); background: var(--df-accent-bg);
color: var(--df-accent); color: var(--df-accent);
} }
@@ -1080,7 +1090,8 @@ onBeforeUnmount(() => {
cursor: not-allowed; cursor: not-allowed;
} }
.ai-btn-icon:disabled:hover { .ai-btn-icon:disabled:hover {
background: transparent; border-color: var(--df-border);
background: var(--df-bg-card);
color: var(--df-text-dim); color: var(--df-text-dim);
} }
/* ── 更多菜单 popout(清空/压缩上下文等低频操作收纳;CSS 原缺失致打开样式错乱)── */ /* ── 更多菜单 popout(清空/压缩上下文等低频操作收纳;CSS 原缺失致打开样式错乱)── */
@@ -1094,7 +1105,7 @@ onBeforeUnmount(() => {
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius); border-radius: var(--df-radius);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); box-shadow: var(--df-shadow-sm);
z-index: 100; z-index: 100;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -1113,16 +1124,13 @@ onBeforeUnmount(() => {
cursor: pointer; cursor: pointer;
white-space: nowrap; white-space: nowrap;
} }
.ai-more-item:hover:not(:disabled) { background: var(--df-bg-hover, rgba(0,0,0,0.06)); color: var(--df-text); } .ai-more-item:hover:not(:disabled) { background: var(--df-bg-card-hover); color: var(--df-text); }
.ai-more-item:disabled { opacity: 0.35; cursor: not-allowed; } .ai-more-item:disabled { opacity: 0.35; cursor: not-allowed; }
/* Transition:淡入 + 下滑 */ /* Transition:淡入 + 下滑 */
.ai-more-popout-enter-active, .ai-more-popout-leave-active { transition: opacity .15s, transform .15s; } .ai-more-popout-enter-active, .ai-more-popout-leave-active { transition: opacity .15s, transform .15s; }
.ai-more-popout-enter-from, .ai-more-popout-leave-to { opacity: 0; transform: translateY(-4px); } .ai-more-popout-enter-from, .ai-more-popout-leave-to { opacity: 0; transform: translateY(-4px); }
/* 压缩中 spinner 图标旋转动画(@keyframes ai-btn-spin 在父级 AiChat.vue 全局定义, /* 压缩中 spinner:.ai-btn-spinner(含 ai-btn-spin 旋转动画)由 components.css 全局定义,
scoped 不重命名 @keyframes,此处按名引用) */ 原本地重复 animation 声明删除(2026-10-18 整洁波,逐字重复零视觉变更) */
.ai-btn-spinner {
animation: ai-btn-spin 0.9s linear infinite;
}
/* 底部工具区(标题左 + 工具右) */ /* 底部工具区(标题左 + 工具右) */
.ai-bottom-tools { .ai-bottom-tools {
display: flex; display: flex;
@@ -1192,6 +1200,10 @@ onBeforeUnmount(() => {
.ai-task-progress--warn .ai-task-progress-dot { .ai-task-progress--warn .ai-task-progress-dot {
animation-duration: 3.2s; animation-duration: 3.2s;
} }
/* 警示档(静默>10min)状态点转琥珀:给判断材料,不自动判死 */
.ai-task-progress--warn .ai-task-progress-dot {
background: var(--df-warning);
}
.ai-task-progress-stage { .ai-task-progress-stage {
font-size: 11px; font-size: 11px;
color: var(--df-text-dim); color: var(--df-text-dim);
@@ -1200,39 +1212,45 @@ onBeforeUnmount(() => {
font-size: 11px; font-size: 11px;
color: color-mix(in srgb, var(--df-warning) 70%, var(--df-text-secondary)); color: color-mix(in srgb, var(--df-warning) 70%, var(--df-text-secondary));
} }
/* ═══ Provider Bar (header 中间区;div→button 后归零默认样式) ═══ */ /* ═══ Provider Bar (header 中间区)
2026-10-18 wave2:对齐 workbench .session-status pill 范式——bg-card 底+边框+8px 圆角+12px 字,
状态点迁 .df-dot(7px 尺寸由全局公共类提供);div→button 后归零默认样式 ═══ */
.ai-provider-bar { .ai-provider-bar {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 4px; gap: 6px;
font-size: 11px; font-size: 12px;
color: var(--df-text-secondary); color: var(--df-text-secondary);
white-space: nowrap; white-space: nowrap;
font-family: inherit; font-family: inherit;
appearance: none; appearance: none;
background: none; background: var(--df-bg-card);
border: none; border: 0.5px solid var(--df-border);
padding: 0; border-radius: var(--df-radius-md);
padding: 4px 12px;
transition: border-color 0.15s var(--df-ease);
} }
.ai-provider-bar--switchable { .ai-provider-bar--switchable {
cursor: pointer; cursor: pointer;
} }
.ai-provider-bar--switchable:hover { .ai-provider-bar--switchable:hover {
color: var(--df-text-primary); border-color: var(--df-border-strong);
color: var(--df-text);
} }
.ai-provider-bar--switchable:focus-visible { .ai-provider-bar--switchable:focus-visible {
outline: 1.5px solid var(--df-accent, #4a9eff); outline: 1.5px solid var(--df-accent);
outline-offset: 2px; outline-offset: 2px;
border-radius: 2px; border-radius: var(--df-radius-md);
} }
/* provider 连通状态点:灰=未测/绿=最近成功/红=最近失败(基于最后 assistant 消息 isError) */ /* provider 连通状态点:灰=未测/绿=最近成功/红=最近失败(基于最后 assistant 消息 isError);
.provider-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--df-text-dim); flex-shrink: 0; transition: background .2s; } 尺寸/圆角走全局 .df-dot,此处只管色 */
.provider-dot { flex-shrink: 0; transition: background .2s; background: var(--df-text-dim); }
.provider-dot--ok { background: var(--df-success); } .provider-dot--ok { background: var(--df-success); }
.provider-dot--error { background: var(--df-danger); } .provider-dot--error { background: var(--df-danger); }
.provider-name { .provider-name {
font-size: 11px; font-size: 12px;
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
color: var(--df-text-dim); color: var(--df-text-secondary);
} }
.ai-provider-empty { .ai-provider-empty {
background: var(--df-danger-bg); background: var(--df-danger-bg);
@@ -1265,7 +1283,7 @@ onBeforeUnmount(() => {
appearance: none; appearance: none;
} }
.ai-tool-badge:focus-visible { .ai-tool-badge:focus-visible {
outline: 1.5px solid var(--df-accent, #4a9eff); outline: 1.5px solid var(--df-accent);
outline-offset: 1px; outline-offset: 1px;
} }
.ai-tool-badge svg { vertical-align: middle; } /* 图标在行高内垂直居中(与数字同基线)*/ .ai-tool-badge svg { vertical-align: middle; } /* 图标在行高内垂直居中(与数字同基线)*/
@@ -1291,11 +1309,17 @@ onBeforeUnmount(() => {
align-items: center; align-items: center;
gap: 4px; gap: 4px;
} }
/* wave2:后台会话徽章迁 .df-badge--info(透明彩底 info 系);scoped 需显式覆写压过 .ai-tool-badge 灰底 */
.ai-running-tasks-badge.df-badge--info {
background: var(--df-info-bg);
color: var(--df-info);
border-color: color-mix(in srgb, var(--df-info) 30%, transparent);
}
.ai-running-tasks-pulse { .ai-running-tasks-pulse {
width: 6px; width: 6px;
height: 6px; height: 6px;
border-radius: 50%; border-radius: 50%;
background: var(--df-success, #34c77b); background: var(--df-success);
animation: ai-running-pulse 2s ease-in-out infinite; animation: ai-running-pulse 2s ease-in-out infinite;
} }
@keyframes ai-running-pulse { @keyframes ai-running-pulse {
@@ -1311,9 +1335,9 @@ onBeforeUnmount(() => {
max-width: 400px; max-width: 400px;
max-height: 300px; max-height: 300px;
overflow-y: auto; overflow-y: auto;
background: var(--df-bg); background: var(--df-bg-raised);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius);
box-shadow: 0 2px 8px rgba(0,0,0,0.1); box-shadow: 0 2px 8px rgba(0,0,0,0.1);
padding: 4px 0; padding: 4px 0;
} }
@@ -1331,14 +1355,14 @@ onBeforeUnmount(() => {
color: var(--df-text); color: var(--df-text);
} }
.ai-running-task-item:hover { .ai-running-task-item:hover {
background: var(--df-hover, rgba(128,128,128,0.08)); background: var(--df-bg-card-hover);
} }
.ai-running-task-dot { .ai-running-task-dot {
flex-shrink: 0; flex-shrink: 0;
width: 6px; width: 6px;
height: 6px; height: 6px;
border-radius: 50%; border-radius: 50%;
background: var(--df-success, #34c77b); background: var(--df-success);
} }
.ai-running-task-title { .ai-running-task-title {
flex: 1; flex: 1;
@@ -1349,7 +1373,7 @@ onBeforeUnmount(() => {
.ai-running-task-round { .ai-running-task-round {
flex-shrink: 0; flex-shrink: 0;
font-size: 11px; font-size: 11px;
color: var(--df-text-secondary, #888); color: var(--df-text-secondary);
} }
/* V49 可恢复分区:琥珀点+「可恢复」徽标,与进行中(绿)区分 */ /* V49 可恢复分区:琥珀点+「可恢复」徽标,与进行中(绿)区分 */
.ai-running-tasks-sep { .ai-running-tasks-sep {
@@ -1358,7 +1382,7 @@ onBeforeUnmount(() => {
background: var(--df-border); background: var(--df-border);
} }
.ai-running-task-dot--parked { .ai-running-task-dot--parked {
background: var(--df-warning, #e6a23c); background: var(--df-warning);
} }
/* B4 parked 行改双钮布局(切回 | 恢复),恢复钮琥珀描边醒目 */ /* B4 parked 行改双钮布局(切回 | 恢复),恢复钮琥珀描边醒目 */
.ai-running-task-item--parked { .ai-running-task-item--parked {
@@ -1385,21 +1409,21 @@ onBeforeUnmount(() => {
color: var(--df-text); color: var(--df-text);
} }
.ai-running-task-main:hover { .ai-running-task-main:hover {
background: var(--df-hover, rgba(128,128,128,0.08)); background: var(--df-bg-card-hover);
} }
.ai-running-task-recover { .ai-running-task-recover {
flex-shrink: 0; flex-shrink: 0;
margin-right: 10px; margin-right: 10px;
padding: 2px 8px; padding: 2px 8px;
border: 1px solid var(--df-warning, #e6a23c); border: 1px solid var(--df-warning);
border-radius: 4px; border-radius: var(--df-radius-sm);
background: none; background: none;
cursor: pointer; cursor: pointer;
font-size: 11px; font-size: 11px;
color: var(--df-warning, #e6a23c); color: var(--df-warning);
} }
.ai-running-task-recover:hover { .ai-running-task-recover:hover {
background: var(--df-warning, #e6a23c); background: var(--df-warning);
color: #fff; color: #fff;
} }
.ai-history-inline-list { .ai-history-inline-list {
@@ -1411,9 +1435,9 @@ onBeforeUnmount(() => {
max-width: 400px; max-width: 400px;
max-height: 300px; max-height: 300px;
overflow-y: auto; overflow-y: auto;
background: var(--df-bg); background: var(--df-bg-raised);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius);
box-shadow: 0 2px 8px rgba(0,0,0,0.1); box-shadow: 0 2px 8px rgba(0,0,0,0.1);
padding: 4px 0; padding: 4px 0;
margin-top: 2px; margin-top: 2px;
@@ -1454,6 +1478,13 @@ onBeforeUnmount(() => {
color: var(--df-text-dim); color: var(--df-text-dim);
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
} }
/* F6-1:历史/摘要定位未命中提示(目标消息在折叠段内,引导展开分隔条) */
.ai-locate-miss {
padding: 6px 10px;
font-size: 11px;
line-height: 1.4;
color: var(--df-warning);
}
/* ═══ 上下文摘要(底部) ═══ */ /* ═══ 上下文摘要(底部) ═══ */
.ai-summary-inline { .ai-summary-inline {
@@ -1470,9 +1501,9 @@ onBeforeUnmount(() => {
max-width: 420px; max-width: 420px;
max-height: 360px; max-height: 360px;
overflow-y: auto; overflow-y: auto;
background: var(--df-bg); background: var(--df-bg-raised);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius);
box-shadow: 0 2px 8px rgba(0,0,0,0.1); box-shadow: 0 2px 8px rgba(0,0,0,0.1);
padding: 6px 0; padding: 6px 0;
margin-top: 2px; margin-top: 2px;
@@ -1518,9 +1549,9 @@ onBeforeUnmount(() => {
z-index: 100; z-index: 100;
min-width: 280px; min-width: 280px;
max-width: 420px; max-width: 420px;
background: var(--df-bg); background: var(--df-bg-raised);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius);
box-shadow: 0 2px 8px rgba(0,0,0,0.1); box-shadow: 0 2px 8px rgba(0,0,0,0.1);
margin-top: 2px; margin-top: 2px;
} }
@@ -1571,9 +1602,9 @@ onBeforeUnmount(() => {
z-index: 100; z-index: 100;
min-width: 200px; min-width: 200px;
max-width: 360px; max-width: 360px;
background: var(--df-bg, #fff); background: var(--df-bg-raised);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius);
box-shadow: 0 2px 8px rgba(0,0,0,0.1); box-shadow: 0 2px 8px rgba(0,0,0,0.1);
padding: 4px 0; padding: 4px 0;
margin-top: 2px; margin-top: 2px;
@@ -1601,7 +1632,7 @@ onBeforeUnmount(() => {
.ai-goal-check { color: var(--df-success); font-weight: 500; flex-shrink: 0; } .ai-goal-check { color: var(--df-success); font-weight: 500; flex-shrink: 0; }
.ai-goal-remove { border: none; background: transparent; color: var(--df-text-dim); cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; flex-shrink: 0; } .ai-goal-remove { border: none; background: transparent; color: var(--df-text-dim); cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; flex-shrink: 0; }
.ai-goal-remove:hover { .ai-goal-remove:hover {
color: var(--df-danger, #e5484d); color: var(--df-danger);
} }
.provider-hint { .provider-hint {
font-size: 11px; font-size: 11px;
@@ -0,0 +1,913 @@
<template>
<!-- ═══ 会话列表体(拆自 ConversationSidebar.vue C4a,零行为变更) ═══ -->
<!-- UX-06 §3.1: 搜索态(searchResults 非 null)→ 平铺,活跃+归档全量按 updated_at DESC -->
<template v-if="searchResults">
<div
v-for="conv in searchResults"
:key="'s-' + conv.id"
class="ai-conv-item"
:class="{
'ai-conv-item--active': conv.id === store.state.activeConversationId,
'ai-conv-item--switching': conv.id === pendingSwitchId,
'ai-conv-item--archived': conv.archived,
'ai-conv-item--pinned': conv.pinned,
}"
tabindex="0"
@click="onSelectSearchResult(conv.id)"
@keydown="onItemKeydown($event, conv.id, true)"
>
<div class="ai-conv-item-main">
<!-- wave2 u-agent 范式: 左侧 7px 状态点。字段源 store.isGenerating(conv_state
generating/stopping/compressed) / pendingCountOf(审批挂起) / loop_state='parked',
无 error 字段故不映射;优先级 generating > 待审批 > parked > 灰 -->
<span
class="df-dot ai-conv-status"
:class="store.isGenerating(conv.id) ? 'df-dot--run ai-conv-status--run'
: pendingCountOf(conv.id) > 0 ? 'ai-conv-status--danger'
: conv.loop_state === 'parked' ? 'ai-conv-status--paused'
: 'df-dot--stop'"
:title="store.isGenerating(conv.id) ? t('aiChat.generating') : undefined"
aria-hidden="true"
></span>
<!-- UX走查 P3-1: 搜索态此前无重命名入口(无 startRename 分支),与分组视图降级不一致;
双击入口对齐分组视图,菜单入口供键盘用户(P2-6) -->
<input
v-if="editingConvId === conv.id"
:ref="setEditEl"
v-model="editText"
class="ai-conv-item-edit"
@keydown="onRenameKeydown($event, conv.id)"
@blur="commitRename(conv.id)"
@click.stop
/>
<span
v-else
class="ai-conv-item-title"
:title="conv.title || t('aiChat.doubleClickToRename')"
@dblclick.stop="startRename(conv)"
>
{{ conv.title || t('aiChat.newConversation') }}
<!-- V1: 待审批徽标(橙点计数,复用既有 aiChat.pendingApprovalCount 文案) -->
<span v-if="pendingCountOf(conv.id) > 0" class="ai-conv-approve-badge" :title="t('aiChat.pendingApprovalCount', { n: pendingCountOf(conv.id) })">{{ pendingCountOf(conv.id) }}</span>
<!-- 无人值守边界徽标:该会话已授权任务边界(镜像渐进填充);点击随会话切回显 -->
<span v-if="hasBoundary(conv.id)" class="ai-conv-boundary-badge" :title="t('ai.taskBoundary.badge')">
<svg aria-hidden="true" width="8" height="8" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2 4 5v6c0 5 3.4 9.7 8 11 4.6-1.3 8-6 8-11V5l-8-3z"/></svg>
</span>
</span>
<span class="ai-conv-item-time">{{ formatRelative(conv.updated_at) }}</span>
</div>
<div class="ai-conv-item-actions">
<div class="ai-conv-item-more">
<button class="ai-conv-item-act" @click.stop="toggleActionsMenu(conv.id)" :title="t('aiChat.moreActions')" :aria-label="t('aiChat.moreActions')">
<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/></svg>
</button>
<div v-if="actionsOpenId === conv.id" class="ai-conv-actions-menu">
<button class="ai-conv-actions-opt" @click.stop="startRename(conv); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 3a2.828 2.828 0 114 4L7.5 20.5 2 22l1.5-5.5L17 3z"/></svg>
{{ t('aiChat.renameConversation') }}
</button>
<button class="ai-conv-actions-opt" @click.stop="store.setPinnedConversation(conv.id, !conv.pinned); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" :fill="conv.pinned ? 'currentColor' : 'none'" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 01-1.11 1.79l-1.78.9A2 2 0 005 15.24V16a1 1 0 001 1h12a1 1 0 001-1v-.76a2 2 0 00-1.11-1.79l-1.78-.9A2 2 0 0115 10.76V7a1 1 0 011-1 2 2 0 002-2V3H6v1a2 2 0 002 2 1 1 0 011 1z"/></svg>
{{ conv.pinned ? t('aiChat.unpinConversation') : t('aiChat.pinConversation') }}
</button>
<button class="ai-conv-actions-opt" @click.stop="store.archiveConversation(conv.id, !conv.archived); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="20" height="5" rx="1"/><path d="M4 9v9a2 2 0 002 2h12a2 2 0 002-2V9"/><line x1="10" y1="13" x2="14" y2="13"/></svg>
{{ conv.archived ? t('aiChat.unarchive') : t('aiChat.archive') }}
</button>
<button class="ai-conv-actions-opt ai-conv-actions-opt--danger" @click.stop="emit('confirm-delete', conv.id); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
{{ t('common.delete') }}
</button>
</div>
</div>
</div>
</div>
<div v-if="searchResults.length === 0" class="ai-conv-empty">
{{ t('aiChat.searchEmpty') }}
</div>
</template>
<!-- 非搜索态:原时间分组(活跃) + 归档分组 -->
<template v-else>
<!-- 活跃对话:按 今天/昨天/更早 分组 -->
<template v-for="group in groupedActive" :key="'g-' + group.key">
<div
class="ai-conv-group-title ai-conv-group-title--fold"
role="button"
tabindex="0"
:aria-expanded="!store.state.foldedGroups[group.key]"
@click="store.toggleGroupFold(group.key)"
@keydown.enter.prevent="store.toggleGroupFold(group.key)"
@keydown.space.prevent="store.toggleGroupFold(group.key)"
>
<span class="ai-conv-group-arrow" :class="{ 'is-folded': store.state.foldedGroups[group.key] }">▸</span>
{{ group.label }}
<span class="ai-conv-group-count">({{ group.items.length }})</span>
</div>
<div
v-if="group.key === 'today' && !group.items.length"
v-show="!store.state.foldedGroups[group.key]"
class="ai-conv-group-empty"
>{{ t('aiChat.groupEmpty') }}</div>
<div
v-for="conv in group.items"
v-show="!store.state.foldedGroups[group.key]"
:key="conv.id"
:ref="(el) => setItemEl(conv.id, el)"
class="ai-conv-item"
:class="{ 'ai-conv-item--active': conv.id === store.state.activeConversationId, 'ai-conv-item--switching': conv.id === pendingSwitchId, 'ai-conv-item--pinned': conv.pinned }"
tabindex="0"
@click="beginSwitch(conv.id)"
@keydown="onItemKeydown($event, conv.id, true)"
>
<div class="ai-conv-item-main">
<!-- wave2 u-agent 范式: 左侧 7px 状态点(映射源同搜索态块注) -->
<span
class="df-dot ai-conv-status"
:class="store.isGenerating(conv.id) ? 'df-dot--run ai-conv-status--run'
: pendingCountOf(conv.id) > 0 ? 'ai-conv-status--danger'
: conv.loop_state === 'parked' ? 'ai-conv-status--paused'
: 'df-dot--stop'"
:title="store.isGenerating(conv.id) ? t('aiChat.generating') : undefined"
aria-hidden="true"
></span>
<input
v-if="editingConvId === conv.id"
:ref="setEditEl"
v-model="editText"
class="ai-conv-item-edit"
@keydown="onRenameKeydown($event, conv.id)"
@blur="commitRename(conv.id)"
@click.stop
/>
<span
v-else
class="ai-conv-item-title"
:class="{ 'ai-conv-item-title--flash': titleFlash && conv.id === store.state.activeConversationId }"
@dblclick.stop="startRename(conv)"
:title="conv.title || t('aiChat.doubleClickToRename')"
>
{{ conv.title || t('aiChat.newConversation') }}
<!-- UX-2025-20 §7.4:AI 生成标题标识小图标(标题非空非占位时显示) -->
<svg aria-hidden="true"
v-if="conv.title && titleFlash && conv.id === store.state.activeConversationId"
class="ai-conv-item-title-badge"
width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"
><polyline points="20 6 9 17 4 12"/></svg>
<!-- V1: 待审批徽标(橙点计数,复用既有 aiChat.pendingApprovalCount 文案) -->
<span v-if="pendingCountOf(conv.id) > 0" class="ai-conv-approve-badge" :title="t('aiChat.pendingApprovalCount', { n: pendingCountOf(conv.id) })">{{ pendingCountOf(conv.id) }}</span>
<!-- 无人值守边界徽标:该会话已授权任务边界(镜像渐进填充);点击随会话切回显 -->
<span v-if="hasBoundary(conv.id)" class="ai-conv-boundary-badge" :title="t('ai.taskBoundary.badge')">
<svg aria-hidden="true" width="8" height="8" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2 4 5v6c0 5 3.4 9.7 8 11 4.6-1.3 8-6 8-11V5l-8-3z"/></svg>
</span>
</span>
<span class="ai-conv-item-time">{{ formatRelative(conv.updated_at) }}</span>
</div>
<div class="ai-conv-item-actions">
<div class="ai-conv-item-more">
<button class="ai-conv-item-act" @click.stop="toggleActionsMenu(conv.id)" :title="t('aiChat.moreActions')" :aria-label="t('aiChat.moreActions')">
<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/></svg>
</button>
<div v-if="actionsOpenId === conv.id" class="ai-conv-actions-menu">
<button class="ai-conv-actions-opt" @click.stop="startRename(conv); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 3a2.828 2.828 0 114 4L7.5 20.5 2 22l1.5-5.5L17 3z"/></svg>
{{ t('aiChat.renameConversation') }}
</button>
<button class="ai-conv-actions-opt" @click.stop="store.setPinnedConversation(conv.id, !conv.pinned); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" :fill="conv.pinned ? 'currentColor' : 'none'" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 01-1.11 1.79l-1.78.9A2 2 0 005 15.24V16a1 1 0 001 1h12a1 1 0 001-1v-.76a2 2 0 00-1.11-1.79l-1.78-.9A2 2 0 0115 10.76V7a1 1 0 011-1 2 2 0 002-2V3H6v1a2 2 0 002 2 1 1 0 011 1z"/></svg>
{{ conv.pinned ? t('aiChat.unpinConversation') : t('aiChat.pinConversation') }}
</button>
<button class="ai-conv-actions-opt" @click.stop="store.archiveConversation(conv.id, true); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="20" height="5" rx="1"/><path d="M4 9v9a2 2 0 002 2h12a2 2 0 002-2V9"/><line x1="10" y1="13" x2="14" y2="13"/></svg>
{{ t('aiChat.archive') }}
</button>
<button class="ai-conv-actions-opt ai-conv-actions-opt--danger" @click.stop="emit('confirm-delete', conv.id); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
{{ t('common.delete') }}
</button>
</div>
</div>
</div>
</div>
</template>
<!-- G5 可恢复分组(loop_state='parked',断点续跑闭环读侧;置于活跃分组后、归档前) -->
<template v-if="recoverable.length">
<div class="ai-conv-group-title">
<span class="ai-conv-recover-dot" aria-hidden="true"></span>
{{ t('aiChat.recoverableCount', { n: recoverable.length }) }}
</div>
<div
v-for="conv in recoverable"
:key="'r-' + conv.id"
class="ai-conv-item ai-conv-item--recoverable"
:class="{ 'ai-conv-item--active': conv.id === store.state.activeConversationId }"
tabindex="0"
:title="t('aiChat.recoverableHint')"
@click="onRecover(conv.id)"
@keydown.enter.prevent="onRecover(conv.id)"
@keydown.space.prevent="onRecover(conv.id)"
>
<div class="ai-conv-item-main">
<!-- wave2: 本组数据源 ai_list_recoverable(loop_state='parked' 完备真相),整组恒 parked→静态琥珀点 -->
<span class="df-dot ai-conv-status ai-conv-status--paused" aria-hidden="true"></span>
<span class="ai-conv-item-title">
{{ conv.title || t('aiChat.newConversation') }}
<span class="ai-conv-recover-badge">⏸</span>
</span>
<span class="ai-conv-item-time">{{ formatRelative(conv.updated_at) }}</span>
</div>
</div>
</template>
<!-- 归档分组(可折叠) -->
<template v-if="archivedConvs.length">
<div
class="ai-conv-group-title ai-conv-group-title--fold"
role="button"
tabindex="0"
:aria-expanded="!store.state.archivedCollapsed"
@click="store.toggleArchivedFold()"
@keydown.enter.prevent="store.toggleArchivedFold()"
@keydown.space.prevent="store.toggleArchivedFold()"
>
<span class="ai-conv-group-arrow" :class="{ 'is-folded': store.state.archivedCollapsed }">▸</span>
{{ t('aiChat.archivedCount', { n: archivedConvs.length }) }}
</div>
<div
v-for="conv in archivedConvs"
v-show="!store.state.archivedCollapsed"
:key="'a-' + conv.id"
:ref="(el) => setItemEl(conv.id, el)"
class="ai-conv-item ai-conv-item--archived"
:class="{ 'ai-conv-item--active': conv.id === store.state.activeConversationId, 'ai-conv-item--switching': conv.id === pendingSwitchId, 'ai-conv-item--pinned': conv.pinned }"
tabindex="0"
@click="beginSwitch(conv.id)"
@keydown="onItemKeydown($event, conv.id)"
>
<div class="ai-conv-item-main">
<!-- wave2 u-agent 范式: 归档项同款状态点(归档为静息态,默认落灰) -->
<span
class="df-dot ai-conv-status"
:class="store.isGenerating(conv.id) ? 'df-dot--run ai-conv-status--run'
: pendingCountOf(conv.id) > 0 ? 'ai-conv-status--danger'
: conv.loop_state === 'parked' ? 'ai-conv-status--paused'
: 'df-dot--stop'"
:title="store.isGenerating(conv.id) ? t('aiChat.generating') : undefined"
aria-hidden="true"
></span>
<span class="ai-conv-item-title" :title="conv.title || ''">
{{ conv.title || t('aiChat.newConversation') }}
<!-- V1: 待审批徽标(橙点计数,复用既有 aiChat.pendingApprovalCount 文案) -->
<span v-if="pendingCountOf(conv.id) > 0" class="ai-conv-approve-badge" :title="t('aiChat.pendingApprovalCount', { n: pendingCountOf(conv.id) })">{{ pendingCountOf(conv.id) }}</span>
<!-- 无人值守边界徽标:该会话已授权任务边界(镜像渐进填充);点击随会话切回显 -->
<span v-if="hasBoundary(conv.id)" class="ai-conv-boundary-badge" :title="t('ai.taskBoundary.badge')">
<svg aria-hidden="true" width="8" height="8" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2 4 5v6c0 5 3.4 9.7 8 11 4.6-1.3 8-6 8-11V5l-8-3z"/></svg>
</span>
</span>
<span class="ai-conv-item-time">{{ formatRelative(conv.updated_at) }}</span>
</div>
<div class="ai-conv-item-actions">
<div class="ai-conv-item-more">
<button class="ai-conv-item-act" @click.stop="toggleActionsMenu(conv.id)" :title="t('aiChat.moreActions')" :aria-label="t('aiChat.moreActions')">
<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/></svg>
</button>
<div v-if="actionsOpenId === conv.id" class="ai-conv-actions-menu">
<button class="ai-conv-actions-opt" @click.stop="store.setPinnedConversation(conv.id, !conv.pinned); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" :fill="conv.pinned ? 'currentColor' : 'none'" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 01-1.11 1.79l-1.78.9A2 2 0 005 15.24V16a1 1 0 001 1h12a1 1 0 001-1v-.76a2 2 0 00-1.11-1.79l-1.78-.9A2 2 0 0115 10.76V7a1 1 0 011-1 2 2 0 002-2V3H6v1a2 2 0 002 2 1 1 0 011 1z"/></svg>
{{ conv.pinned ? t('aiChat.unpinConversation') : t('aiChat.pinConversation') }}
</button>
<button class="ai-conv-actions-opt" @click.stop="store.archiveConversation(conv.id, false); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="20" height="5" rx="1"/><path d="M4 9v9a2 2 0 002 2h12a2 2 0 002-2V9"/><line x1="12" y1="13" x2="12" y2="17"/><polyline points="10 15 12 13 14 15"/></svg>
{{ t('aiChat.unarchive') }}
</button>
<button class="ai-conv-actions-opt ai-conv-actions-opt--danger" @click.stop="emit('confirm-delete', conv.id); closeActionsMenu()">
<svg aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
{{ t('common.delete') }}
</button>
</div>
</div>
</div>
</div>
</template>
<!-- F4-1: 会话列表分页——底部「加载更多」续拉下一页(首屏 50/组,归档组同口径放开) -->
<div
v-if="convListPaging.hasMore"
class="ai-conv-load-more"
role="button"
tabindex="0"
@click="onLoadMore"
@keydown.enter.prevent="onLoadMore"
@keydown.space.prevent="onLoadMore"
>{{ convListPaging.loading ? t('common.loading') : t('gitChanges.loadMore') }}</div>
<div v-if="store.state.conversations.length === 0" class="ai-conv-empty">
{{ t('aiChat.emptyConversation') }}
</div>
</template>
</template>
<script setup lang="ts">
/**
* 会话列表体 — 拆自 ConversationSidebar.vue(C4a 大文件拆分,零行为变更)。
*
* 职责:侧栏列表两态渲染(搜索态平铺 / 时间分组+可恢复+归档)及项级自治状态:
* 重命名(editingConvId/editText)、更多操作菜单(actionsOpenId + document 级外部点击/Esc 关闭)、
* 切换过渡(pendingSwitchId)、项 DOM ref 收集(M3 展开折叠组后 scrollIntoView)、
* 标题生成淡入(titleFlash)、时间分组归桶(groupedActive/archivedConvs)。
*
* 跨文件依赖(策略同侧栏第一批:store 共享走 useAiStore,不 props 传 store):
* - props.pendingCountOf:V1 待审批计数(主文件 computed + 2.5s 轮询兜底锚定,函数透传保响应式);
* - props.recoverable:G5 可恢复清单(主文件 onMounted 拉取,侧栏开合不重复 IPC),恢复动作 emit('recover');
* - emit('confirm-delete'):删除需父级 ConfirmDialog,侧栏主文件继续上抛 AiChat。
* 边界徽标只读消费 getConvBoundary(reactive Map,模板内读取可追踪),直接 import 同源 composable。
*/
import { ref, computed, nextTick, watch, onMounted, onBeforeUnmount, type ComponentPublicInstance } from 'vue'
import { useI18n } from 'vue-i18n'
import { useAiStore } from '../../../stores/ai'
import { getConvBoundary } from '../../../composables/ai/useTaskBoundary'
import { convListPaging, loadMoreConversations } from '../../../composables/ai/useAiConversations'
import { formatRelative } from '../../../utils/time'
import type { AiConversationSummary } from '../../../api/types'
/** G5 可恢复会话条目(主文件数据源透传,字段口径同 aiApi.listRecoverable) */
interface RecoverableConv { id: string; title: string | null; model: string | null; updated_at: string }
defineProps<{
/** V1 跨会话待审批计数(主文件 computed:三响应式源锚定 + 轮询兜底;函数透传,模板调用可追踪) */
pendingCountOf: (convId: string) => number
/** G5 可恢复分组数据(主文件拉取与防重,本组件纯渲染 + emit 恢复动作) */
recoverable: RecoverableConv[]
}>()
const emit = defineEmits<{
/** 删除对话(需二次确认),上抛侧栏主文件继续交 AiChat 弹 ConfirmDialog */
(e: 'confirm-delete', id: string): void
/** G5 恢复 parked 会话,主文件持 recoveringId 防重 + toast 反馈 */
(e: 'recover', id: string): void
}>()
const { t } = useI18n()
const store = useAiStore()
// ── 标题生成淡入(UX-2025-20 §7.4):监听当前对话标题从空→非空触发 ──
const titleFlash = ref(false)
let _titleFlashTimer: ReturnType<typeof setTimeout> | null = null
const activeConv = computed(() =>
store.state.conversations.find(c => c.id === store.state.activeConversationId) || null,
)
watch(
() => activeConv.value?.title,
(newTitle, oldTitle) => {
// 标题从空→非空才触发淡入,其他变化不闪
if (!newTitle || oldTitle) return
titleFlash.value = true
if (_titleFlashTimer) clearTimeout(_titleFlashTimer)
_titleFlashTimer = setTimeout(() => { titleFlash.value = false }, 320)
},
)
// ── 对话项 inline 重命名 ──
const editingConvId = ref<string | null>(null)
const editText = ref('')
let editEl: HTMLInputElement | null = null
function setEditEl(el: Element | { $el?: Element } | null): void {
editEl = (el as HTMLInputElement) || null
}
function startRename(conv: { id: string; title: string | null }) {
editingConvId.value = conv.id
editText.value = conv.title || ''
nextTick(() => {
editEl?.focus()
editEl?.select()
})
}
async function commitRename(id: string) {
const title = editText.value.trim()
if (title && editingConvId.value === id) {
await store.renameConversation(id, title)
}
editingConvId.value = null
}
function cancelRename() {
editingConvId.value = null
}
/** P1-1 重命名框键盘处理:输入法组词中(isComposing/229)的 Enter/Esc 属 IME 选词/取消组词,
* 不当重命名提交/取消处理,防标题被半截拼音覆盖。原 keyup.enter/.esc 改 keydown 统一挂守卫:
* 组词上屏的回车到 keyup 阶段 isComposing 已复位守不住,keydown 才拦得到。 */
function onRenameKeydown(e: KeyboardEvent, convId: string) {
if (e.isComposing || e.keyCode === 229) return
if (e.key === 'Enter') {
e.preventDefault()
commitRename(convId)
} else if (e.key === 'Escape') {
e.preventDefault()
cancelRename()
}
}
// UX走查 P2-6: 会话项键盘可达(tabindex=0)。Enter/Space 等价点击选中;仅焦点落在本项 div
// 自身时处理——焦点在内部按钮/重命名输入框时 target≠currentTarget,避免与控件自身语义双触发。
// renamable=true 的会话项(搜索结果/时间分组,即双击标题可重命名的项)额外支持 F2 键盘重命名,
// 作为 .ai-conv-item-title 双击入口的键盘等价(文件管理器惯例;归档项不支持重命名故不传该标志)。
function onItemKeydown(e: KeyboardEvent, convId: string, renamable = false) {
if (e.isComposing || e.keyCode === 229) return
if (e.target !== e.currentTarget) return
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
beginSwitch(convId)
} else if (renamable && e.key === 'F2') {
e.preventDefault()
const conv = store.state.conversations.find(c => c.id === convId)
if (conv) startRename(conv)
}
}
// ── 会话项「更多」操作菜单(置顶/归档/删除)──
const actionsOpenId = ref<string | null>(null)
function toggleActionsMenu(id: string) {
actionsOpenId.value = actionsOpenId.value === id ? null : id
}
function closeActionsMenu() {
actionsOpenId.value = null
}
// 点击外部关闭更多操作菜单
function onActionsOutsideClick(e: MouseEvent) {
if (!actionsOpenId.value) return
const target = e.target as HTMLElement | null
if (target?.closest('.ai-conv-item-more')) return
actionsOpenId.value = null
}
// UX走查 P2-6: 操作菜单原仅外部点击可关,键盘用户开菜单后无 Esc 逃逸;IME 守卫防组词取消误关
function onActionsEscClose(e: KeyboardEvent) {
if (!actionsOpenId.value) return
if (e.isComposing || e.keyCode === 229) return
if (e.key === 'Escape') actionsOpenId.value = null
}
// ── 会话切换过渡态(UX走查 2026-10-03 P1):点击即预高亮目标项(乐观),IPC 返回后随
// activeConversationId 落定接管高亮;失败/过期时 finally 清 pending,高亮自动回滚到原活跃项。
// 治:大历史会话 IPC 数百 ms 期间点击项不高亮、原高亮不动、无任何进行时反馈,快速连点像失灵。
const pendingSwitchId = ref<string | null>(null)
function beginSwitch(id: string) {
// 已活跃会话:switchConversation 内部同判短路,无过渡期,不挂 pending
if (id === store.state.activeConversationId) {
void store.switchConversation(id)
return
}
pendingSwitchId.value = id
void store.switchConversation(id).finally(() => {
// 仅当 pending 仍是本次点击的 id 才清:快速连点 B 覆盖 A 后,A 的迟到返回不得清掉 B 的过渡态
if (pendingSwitchId.value === id) pendingSwitchId.value = null
})
}
/**
* 搜索结果点击切对话后清空 searchQuery,退出搜索模式回原时间分组视图。
* M3:命中项可能在折叠的时间分组或折叠的归档分组内,选中态不可见。切回分组视图后展开所在分组
* 并 scrollIntoView,确保选中项立即可见(原仅切 searchQuery,选中项落在折叠组里看不到高亮)。
*/
function onSelectSearchResult(id: string) {
// 走 beginSwitch 挂切换过渡态(乐观预高亮),与分组视图点击口径一致
beginSwitch(id)
store.state.searchQuery = ''
// nextTick 后视图已切回分组态;ensureVisible 展开所在组 + 滚动定位
void nextTick(() => ensureActiveVisible())
}
// ── M3:活跃会话项 DOM ref 收集(id → el),用于展开折叠组后 scrollIntoView ──
// Vue 3 函数 ref:每项 :ref="(el) => setItemEl(id, el)"。卸载时 el 为 null,删 key 防 Map 泄漏。
const itemEls = new Map<string, Element>()
function setItemEl(id: string, el: Element | ComponentPublicInstance | null): void {
if (!el) {
itemEls.delete(id)
return
}
// 组件实例取 $el,但本项是普通 div(el 即 Element)
itemEls.set(id, el as Element)
}
/**
* M3:确保当前活跃会话在分组视图可见。若它落在折叠的时间分组(今天/昨天/更早)或折叠的归档分组,
* 展开该组让 v-show 渲染出来,再 scrollIntoView。用于搜索点选、切对话后选中态不被折叠吞掉。
*/
function ensureActiveVisible(): void {
const id = store.state.activeConversationId
if (!id) return
const conv = store.state.conversations.find(c => c.id === id)
if (!conv) return
// 先按归档态/时间桶决定应展开哪个组折叠态
if (conv.archived) {
if (store.state.archivedCollapsed) store.state.archivedCollapsed = false
} else {
const bucket = timeBucket(conv.updated_at)
if (store.state.foldedGroups[bucket]) store.state.foldedGroups[bucket] = false
}
// 折叠态翻转后 v-show 需一帧才渲染,再 nextTick 取 el 滚动
void nextTick(() => {
const el = itemEls.get(id)
if (el) {
;(el as HTMLElement).scrollIntoView({ block: 'nearest', behavior: 'smooth' })
}
})
}
/** 该会话是否已授权无人值守边界(徽标显隐)。直接读 reactive Map,渲染效应自动追踪增删 */
function hasBoundary(convId: string): boolean {
return getConvBoundary(convId) !== null
}
// ── 对话分组:今天 / 昨天 / 更早 ──
const bucketLabels = computed<Record<string, string>>(() => ({
today: t('aiChat.today'),
yesterday: t('aiChat.yesterday'),
earlier: t('aiChat.earlier'),
}))
function timeBucket(ts: string): 'today' | 'yesterday' | 'earlier' {
const t = parseInt(ts, 10)
if (!Number.isFinite(t)) return 'earlier'
const d = new Date(t)
const now = new Date()
const sameDay = d.getFullYear() === now.getFullYear()
&& d.getMonth() === now.getMonth()
&& d.getDate() === now.getDate()
if (sameDay) return 'today'
const yest = new Date(now)
yest.setDate(now.getDate() - 1)
if (d.getFullYear() === yest.getFullYear()
&& d.getMonth() === yest.getMonth()
&& d.getDate() === yest.getDate()) return 'yesterday'
return 'earlier'
}
const groupedActive = computed(() => {
const map = new Map<string, AiConversationSummary[]>()
for (const c of store.state.conversations) {
if (c.archived) continue
const b = timeBucket(c.updated_at)
if (!map.has(b)) map.set(b, [])
map.get(b)!.push(c)
}
for (const items of map.values()) {
items.sort((a, b) => Number(b.pinned ? 1 : 0) - Number(a.pinned ? 1 : 0)
|| Number(b.updated_at) - Number(a.updated_at))
}
const groups: { key: string; label: string; items: AiConversationSummary[] }[] = []
for (const key of ['today', 'yesterday', 'earlier']) {
const items = map.get(key) || []
if (key === 'today' || items.length) groups.push({ key, label: bucketLabels.value[key], items })
}
return groups
})
const archivedConvs = computed(() =>
store.state.conversations
.filter(c => c.archived)
.sort((a, b) => Number(b.pinned ? 1 : 0) - Number(a.pinned ? 1 : 0)
|| Number(b.updated_at) - Number(a.updated_at)),
)
const searchResults = computed<AiConversationSummary[] | null>(
() => store.filteredConversations.value,
)
// ── F4-1: 会话列表分页(加载更多按钮 + 搜索全量兜底) ──
/** 「加载更多」:续拉下一页(失败/无新增静默,按钮 loading 态由 convListPaging 驱动) */
function onLoadMore(): void {
void loadMoreConversations()
}
/** G5 恢复动作透传主文件(主文件持 recoveringId 防重与 toast 反馈),模板零改动 */
function onRecover(id: string) {
emit('recover', id)
}
onMounted(() => {
// 点击外部关闭更多操作菜单
document.addEventListener('click', onActionsOutsideClick)
// 操作菜单 Esc 关闭(P2-6,与外部点击同生命周期)
document.addEventListener('keydown', onActionsEscClose)
})
onBeforeUnmount(() => {
document.removeEventListener('click', onActionsOutsideClick)
document.removeEventListener('keydown', onActionsEscClose)
// 释放标题淡入计时器
if (_titleFlashTimer) { clearTimeout(_titleFlashTimer); _titleFlashTimer = null }
})
</script>
<!-- ═══ 会话列表体 scoped 样式(拆自 ConversationSidebar.vue,零视觉变更;列表滚动容器
.ai-conv-sidebar/.ai-conv-list 等壳层样式留主文件,本组件只持项/分组/菜单/徽标层) ═══ -->
<style scoped>
/* wave2 u-agent 范式: 分组头 10px uppercase + letter-spacing 1px + dim */
.ai-conv-group-title {
padding: 10px 8px 4px;
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
color: var(--df-text-dim);
user-select: none;
}
.ai-conv-group-title--fold {
cursor: pointer;
display: flex;
align-items: center;
gap: 3px;
}
.ai-conv-group-title--fold:hover {
color: var(--df-text);
}
.ai-conv-group-arrow {
display: inline-block;
transition: transform 0.15s;
font-size: 9px;
}
.ai-conv-group-arrow.is-folded {
transform: rotate(0deg);
}
.ai-conv-group-arrow:not(.is-folded) {
transform: rotate(90deg);
}
.ai-conv-group-count {
margin-left: 2px;
font-weight: 400;
font-family: var(--df-font-mono); /* mono 计数(df-mono 范式),upper/lsp 回退保证数字不散 */
font-size: 10px;
letter-spacing: 0;
opacity: 0.9;
}
.ai-conv-group-empty {
padding: 2px 8px 4px 20px;
font-size: 10px;
color: var(--df-text-dim);
font-style: italic;
}
/* wave2 u-agent .cv 范式: 单行条目,8px 级密度;hover/active 同走灰阶卡底(GitHub 两级同底、
active 由左 2px accent 实线区分),深浅主题同 token 自动适配 */
.ai-conv-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px;
border-radius: var(--df-radius);
cursor: pointer;
transition: background 0.15s;
gap: 6px;
}
.ai-conv-item:hover {
background: var(--df-bg-card-hover);
}
.ai-conv-item--active {
background: var(--df-bg-card-hover);
box-shadow: inset 2px 0 0 var(--df-accent);
}
/* 切换进行时(UX走查 P1):与活跃项同底色示"已选中"(乐观预高亮),降不透明度示"加载中";
IPC 返回后 activeConversationId 落定、本类移除,视觉无缝衔接;失败回滚高亮回原活跃项 */
.ai-conv-item--switching {
background: var(--df-bg-card-hover);
opacity: 0.7;
}
.ai-conv-item--archived .ai-conv-item-title {
opacity: 0.6;
}
/* wave2: 行内布局对齐 .cv-top([状态点][标题省略][时间]) */
.ai-conv-item-main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: row;
align-items: center;
gap: 6px;
}
.ai-conv-item-title {
flex: 1;
min-width: 0;
font-size: 12px;
font-weight: 500;
color: var(--df-text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 3px;
}
/* UX-2025-20 §7.4: AI 生成标题淡入(0.3s opacity + transform 过渡) */
.ai-conv-item-title--flash {
animation: ai-title-flash 0.3s var(--df-ease);
}
.ai-conv-item-title-badge {
flex-shrink: 0;
color: var(--df-success);
}
@keyframes ai-title-flash {
from { opacity: 0; transform: translateX(-3px); }
to { opacity: 1; transform: translateX(0); }
}
.ai-conv-item-edit {
flex: 1 1 0; /* wave2: main 已行化,输入框按 flex 填充(min-width:0 防 input 固有宽撑破窄侧栏) */
min-width: 0;
width: auto;
font-size: 11px;
color: var(--df-text);
height: 18px;
padding: 0 4px;
border: 1px solid var(--df-accent);
border-radius: var(--df-radius-sm);
background: var(--df-bg);
outline: none;
box-sizing: border-box;
}
/* 聚焦可见环:边框恒为 accent 聚焦无变化,且 scoped 选择器特异性高于全局 :focus-visible 兜底,须就地补环,仅键盘聚焦显示 */
.ai-conv-item-edit:focus-visible { outline: 2px solid var(--df-accent); outline-offset: 1px; }
/* wave2 u-agent 范式: 时间/计数元数据 mono 10px dim(.df-mono 同款视觉) */
.ai-conv-item-time {
flex: none;
font-family: var(--df-font-mono);
font-size: 10px;
color: var(--df-text-dim);
}
/* wave2 u-agent .st 状态点变体: 公共 .df-dot/.df-dot--run/.df-dot--stop 管造型与绿/灰底,
此处只补动效与缺位色(全 token): run 绿+glow+脉冲(global df-pulse)、danger 待审批红、paused 停靠琥珀 */
.ai-conv-status--run { box-shadow: 0 0 6px var(--df-success); animation: df-pulse 1.5s infinite; }
.ai-conv-status--danger { background: var(--df-danger); }
.ai-conv-status--paused { background: var(--df-warning); }
@keyframes ai-conv-gen-pulse {
/* 供 .ai-conv-recover-dot 分组级脉冲用(原行内 gen-dot 已由状态点接管) */
0%, 100% { opacity: 0.35; transform: scale(0.85); }
50% { opacity: 1; transform: scale(1.15); }
}
/* G5 可恢复分组(parked 会话,amber 系提示「需注意/可继续」语义;⏸ 徽标+分组标题小圆点) */
.ai-conv-recover-dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
margin-right: 5px;
background: var(--df-warning);
animation: ai-conv-gen-pulse 2s ease-in-out infinite;
}
.ai-conv-item--recoverable {
cursor: pointer;
}
.ai-conv-recover-badge {
flex-shrink: 0;
margin-left: 2px;
font-size: 10px;
line-height: 1;
color: var(--df-warning);
cursor: help;
}
/* V1: 跨会话待审批徽标(橙点计数,warning 色系与待审批语义一致;固定尺寸不挤标题换行) */
.ai-conv-approve-badge { flex-shrink: 0;
min-width: 12px;
height: 12px;
padding: 0 3px;
border-radius: 6px;
background: var(--df-warning);
color: #000;
font-size: 9px;
font-weight: 600;
line-height: 12px;
text-align: center;
cursor: help;
}
/* 无人值守边界徽标(盾形,accent 色系与「已授权」语义一致;纯标记不计数) */
.ai-conv-boundary-badge {
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
width: 12px;
height: 12px;
border-radius: 6px;
background: color-mix(in srgb, var(--df-accent) 18%, transparent);
color: var(--df-accent);
cursor: help;
}
.ai-conv-item-actions {
display: none;
align-items: center;
gap: 2px;
flex-shrink: 0;
}
.ai-conv-item:hover .ai-conv-item-actions {
display: flex;
}
/* UX走查 P2-6: 键盘 Tab 进会话项(项自身 tabindex=0,或焦点在项内按钮/输入框)时同样浮出
操作按钮——原仅 :hover 渲染,键盘用户永远够不到「...」菜单触发点 */
.ai-conv-item:focus-within .ai-conv-item-actions {
display: flex;
}
/* 菜单展开时强制 actions 可见(鼠标移到菜单上 item 不再 hover,防菜单消失) */
.ai-conv-item:has(.ai-conv-actions-menu) .ai-conv-item-actions {
display: flex;
}
.ai-conv-item-act {
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
border: none;
border-radius: var(--df-radius-sm);
background: transparent;
color: var(--df-text-dim);
cursor: pointer;
flex-shrink: 0;
}
.ai-conv-item-act:hover {
background: var(--df-sidebar-hover);
color: var(--df-text);
}
/* 已置顶对话视觉强调(左边线,不依赖菜单展开,一眼识别)。
pinned 类挂在 .ai-conv-item 上(操作收进更多菜单后,按钮不再常驻,改 item 级类)。
wave2: 选中态同占左缘,置顶线降为 45% 透明 accent 让位,选中实线优先 */
.ai-conv-item--pinned {
box-shadow: inset 2px 0 0 color-mix(in srgb, var(--df-accent) 45%, transparent);
}
.ai-conv-item--active.ai-conv-item--pinned {
box-shadow: inset 2px 0 0 var(--df-accent);
}
/* ── 「更多」操作菜单(置顶/归档/删除)──
「...」按钮 hover 时随 actions 浮出(同原 4 按钮交互),点击展开下拉。
菜单绝对定位浮于 item 下方右侧,窄侧栏避免溢出。 */
.ai-conv-item-more {
position: relative;
display: flex;
align-items: center;
flex-shrink: 0;
}
.ai-conv-actions-menu {
position: absolute;
top: 100%;
right: 0;
margin-top: 2px;
z-index: 20;
min-width: 104px;
padding: 2px;
display: flex;
flex-direction: column;
gap: 1px;
background: var(--df-bg);
border: 1px solid var(--df-border);
border-radius: var(--df-radius-sm);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.ai-conv-actions-opt {
display: flex;
align-items: center;
gap: 6px;
border: none;
background: transparent;
text-align: left;
padding: 5px 8px;
font-size: 11px;
color: var(--df-text);
cursor: pointer;
border-radius: var(--df-radius-sm);
white-space: nowrap;
}
.ai-conv-actions-opt:hover {
background: var(--df-sidebar-hover);
}
.ai-conv-actions-opt--danger:hover {
background: var(--df-danger-bg);
color: var(--df-danger);
}
.ai-conv-empty {
padding: 16px 8px;
text-align: center;
font-size: 11px;
color: var(--df-text-dim);
}
/* F4-1: 列表底部「加载更多」(轻量文字行,hover 同列表项灰阶卡底范式) */
.ai-conv-load-more {
margin: 4px 2px;
padding: 6px 8px;
border-radius: var(--df-radius);
font-size: 11px;
color: var(--df-text-dim);
text-align: center;
cursor: pointer;
user-select: none;
}
.ai-conv-load-more:hover {
background: var(--df-bg-card-hover);
color: var(--df-text);
}
</style>
+50 -62
View File
@@ -114,7 +114,7 @@
</div> </div>
</div> </div>
<div v-else class="eval-report eval-report--muted"> <div v-else class="eval-report eval-report--muted">
<button class="btn-evaluate" :disabled="evaluating" @click="$emit('evaluate')"> <button class="btn btn-primary" :disabled="evaluating" @click="$emit('evaluate')">
{{ evaluating ? $t('ideas.evaluating') : $t('ideas.startEval') }} {{ evaluating ? $t('ideas.evaluating') : $t('ideas.startEval') }}
</button> </button>
<!-- P1-⑥ 重试样式:错误提示分两行,重试用 ghost btn-sm(替代突兀的内联 accent 按钮) --> <!-- P1-⑥ 重试样式:错误提示分两行,重试用 ghost btn-sm(替代突兀的内联 accent 按钮) -->
@@ -690,7 +690,7 @@ watch(() => props.idea.id, loadHistory)
gap: 12px; gap: 12px;
margin-bottom: var(--df-gap-head); margin-bottom: var(--df-gap-head);
} }
.detail-title { font-size: 20px; font-weight: 500; color: var(--df-text); flex: 1; min-width: 0; } .detail-title { font-size: var(--df-fs-title); font-weight: 500; color: var(--df-text); flex: 1; min-width: 0; }
/* P0-② 标题行右侧操作组:立项按钮 + 状态 badge 一行排布 */ /* P0-② 标题行右侧操作组:立项按钮 + 状态 badge 一行排布 */
.detail-header-actions { .detail-header-actions {
display: flex; display: flex;
@@ -752,7 +752,7 @@ watch(() => props.idea.id, loadHistory)
padding: 14px 16px; padding: 14px 16px;
background: var(--df-accent-bg); background: var(--df-accent-bg);
border-left: 3px solid var(--df-accent); border-left: 3px solid var(--df-accent);
border-radius: 0 8px 8px 0; border-radius: 0 var(--df-radius-md) var(--df-radius-md) 0;
} }
/* 弱化态(空数据/加载中占位,原 inline opacity:0.5 统一为 class) */ /* 弱化态(空数据/加载中占位,原 inline opacity:0.5 统一为 class) */
.eval-report--muted { opacity: 0.5; } .eval-report--muted { opacity: 0.5; }
@@ -764,47 +764,48 @@ watch(() => props.idea.id, loadHistory)
background: var(--df-bg-raised); background: var(--df-bg-raised);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius); border-radius: var(--df-radius);
padding: 1rem; padding: 13px;
margin-bottom: 1rem; margin-bottom: 13px;
} }
.debate-container { .debate-container {
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
gap: 1rem; gap: 13px;
margin-bottom: 1.5rem; margin-bottom: 20px;
} }
.debate-column { .debate-column {
padding: 1rem; padding: 13px;
border-radius: var(--df-radius); border-radius: var(--df-radius);
position: relative; position: relative;
} }
/* 正反方论据栏底/边走语义 token(双主题自适应) */
.debate-column.positive { .debate-column.positive {
background: rgba(61, 219, 160, 0.08); background: var(--df-success-bg);
border: 0.5px solid rgba(61, 219, 160, 0.2); border: 0.5px solid var(--df-success-bd);
} }
.debate-column.negative { .debate-column.negative {
background: rgba(240, 101, 101, 0.08); background: var(--df-danger-bg);
border: 0.5px solid rgba(240, 101, 101, 0.2); border: 0.5px solid var(--df-danger-bd);
} }
.debate-column h4 { .debate-column h4 {
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
margin: 0 0 0.5rem; margin: 0 0 7px;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 7px;
} }
.confidence-bar { .confidence-bar {
height: 4px; height: 4px;
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
margin-bottom: 0.25rem; margin-bottom: 3px;
overflow: hidden; overflow: hidden;
} }
@@ -820,13 +821,13 @@ watch(() => props.idea.id, loadHistory)
.confidence-text { .confidence-text {
font-size: 11px; font-size: 11px;
color: var(--df-text-dim); color: var(--df-text-dim);
margin-bottom: 0.5rem; margin-bottom: 7px;
} }
.debate-column .thesis { .debate-column .thesis {
font-size: 12px; font-size: 12px;
color: var(--df-text); color: var(--df-text);
margin-bottom: 0.5rem; margin-bottom: 7px;
font-weight: 500; font-weight: 500;
} }
@@ -839,16 +840,16 @@ watch(() => props.idea.id, loadHistory)
.debate-column li { .debate-column li {
font-size: 11px; font-size: 11px;
color: var(--df-text-secondary); color: var(--df-text-secondary);
margin-bottom: 0.25rem; margin-bottom: 3px;
padding-left: 0.5rem; padding-left: 7px;
} }
.analyst-conclusion { .analyst-conclusion {
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius); border-radius: var(--df-radius);
padding: 1rem; padding: 13px;
margin-bottom: 1rem; margin-bottom: 13px;
} }
/* assessment-badge 系列已提取到 styles/components.css 全局 */ /* assessment-badge 系列已提取到 styles/components.css 全局 */
@@ -857,39 +858,39 @@ watch(() => props.idea.id, loadHistory)
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
color: var(--df-text); color: var(--df-text);
margin: 0.5rem 0; margin: 7px 0;
} }
.net-sentiment { .net-sentiment {
font-size: 12px; font-size: var(--df-fs-ctrl);
padding: 4px 8px; padding: var(--df-pad-badge);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
display: inline-block; display: inline-block;
margin: 0.5rem 0; margin: 7px 0;
} }
.net-sentiment.positive { background: rgba(61, 219, 160, 0.15); color: var(--df-success); } .net-sentiment.positive { background: var(--df-success-bg); color: var(--df-success); }
.net-sentiment.negative { background: rgba(240, 101, 101, 0.15); color: var(--df-danger); } .net-sentiment.negative { background: var(--df-danger-bg); color: var(--df-danger); }
.net-sentiment.neutral { background: var(--df-bg-raised); color: var(--df-text-secondary); } .net-sentiment.neutral { background: var(--df-bg-raised); color: var(--df-text-secondary); }
.summary { .summary {
font-size: 12px; font-size: 12px;
color: var(--df-text-secondary); color: var(--df-text-secondary);
line-height: 1.5; line-height: 1.5;
margin: 0.5rem 0; margin: 7px 0;
} }
.action-recommendations { .action-recommendations {
background: var(--df-bg-raised); background: var(--df-bg-raised);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius); border-radius: var(--df-radius);
padding: 1rem; padding: 13px;
} }
.action-recommendations h4 { .action-recommendations h4 {
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
margin: 0 0 0.5rem; margin: 0 0 7px;
} }
.action-recommendations ul { .action-recommendations ul {
@@ -901,12 +902,12 @@ watch(() => props.idea.id, loadHistory)
.action-recommendations li { .action-recommendations li {
font-size: 12px; font-size: 12px;
color: var(--df-text-secondary); color: var(--df-text-secondary);
margin-bottom: 0.25rem; margin-bottom: 3px;
padding-left: 0.5rem; padding-left: 7px;
} }
/* P0-① 详细论据折叠切换条 */ /* P0-① 详细论据折叠切换条 */
.debate-toggle-row { margin-bottom: 0.75rem; } .debate-toggle-row { margin-bottom: 10px; }
.debate-toggle-btn { .debate-toggle-btn {
background: transparent; background: transparent;
border: none; border: none;
@@ -924,23 +925,10 @@ watch(() => props.idea.id, loadHistory)
transition: transform 0.15s; transition: transform 0.15s;
} }
.debate-toggle-arrow.is-open { transform: rotate(180deg); } .debate-toggle-arrow.is-open { transform: rotate(180deg); }
.debate-detail { margin-top: 0.5rem; } .debate-detail { margin-top: 7px; }
.debate-detail .debate-container { margin-bottom: 0.75rem; } .debate-detail .debate-container { margin-bottom: 10px; }
.btn-evaluate { /* 「开始评估」按钮并轨全局 .btn .btn-primary(30px 主档),本地副本删除 */
background: var(--df-accent);
color: #fff;
border: none;
padding: 8px 16px;
border-radius: var(--df-radius);
font-size: 13px;
cursor: pointer;
transition: background 0.15s, color 0.15s;
}
.btn-evaluate:hover {
background: var(--df-accent-hover);
}
/* P1-⑥ 重试样式:错误提示与重试按钮分行,重试用 ghost btn-sm(替代突兀的内联 accent 按钮) */ /* P1-⑥ 重试样式:错误提示与重试按钮分行,重试用 ghost btn-sm(替代突兀的内联 accent 按钮) */
.eval-error { .eval-error {
@@ -952,11 +940,11 @@ watch(() => props.idea.id, loadHistory)
.btn-retry { margin-top: 4px; } .btn-retry { margin-top: 4px; }
.eval-mode-tag { .eval-mode-tag {
font-size: 11px; font-size: var(--df-fs-aux);
font-weight: 400; font-weight: 400;
padding: 1px 8px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
background: rgba(255, 217, 61, 0.15); background: var(--df-warning-bg);
color: var(--df-warning); color: var(--df-warning);
margin-left: 6px; margin-left: 6px;
vertical-align: middle; vertical-align: middle;
@@ -991,26 +979,26 @@ watch(() => props.idea.id, loadHistory)
font-size: 12px; font-size: 12px;
} }
.version-badge { .version-badge {
font-size: 11px; font-size: var(--df-fs-aux);
font-weight: 500; font-weight: 500;
padding: 2px 8px; padding: var(--df-pad-badge);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
background: var(--df-accent-soft); background: var(--df-accent-soft);
color: var(--df-accent); color: var(--df-accent);
} }
.latest-tag { .latest-tag {
font-size: 10px; font-size: var(--df-fs-meta);
font-weight: 500; font-weight: 500;
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
background: rgba(100, 255, 218, 0.15); background: var(--df-success-bg);
color: var(--df-success); color: var(--df-success);
} }
.history-eval-mode { .history-eval-mode {
font-size: 11px; font-size: var(--df-fs-aux);
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
background: rgba(255, 217, 61, 0.12); background: var(--df-warning-bg);
color: var(--df-warning); color: var(--df-warning);
} }
.history-score { .history-score {
@@ -1046,7 +1034,7 @@ watch(() => props.idea.id, loadHistory)
/* ===== 标签 ===== */ /* ===== 标签 ===== */
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; } .tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { .tag {
font-size: 12px; padding: 4px 10px; font-size: var(--df-fs-ctrl); padding: var(--df-pad-badge);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
background: var(--df-accent-bg); background: var(--df-accent-bg);
color: var(--df-accent); color: var(--df-accent);
@@ -1055,7 +1043,7 @@ watch(() => props.idea.id, loadHistory)
/* ===== 关联灵感 ===== */ /* ===== 关联灵感 ===== */
.related-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; } .related-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.related-chip { .related-chip {
font-size: 12px; padding: 4px 10px; font-size: var(--df-fs-ctrl); padding: var(--df-pad-badge);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
background: var(--df-accent-bg); background: var(--df-accent-bg);
color: var(--df-accent); color: var(--df-accent);
+9 -8
View File
@@ -400,13 +400,14 @@ watch(renderedContent, () => {
/* 状态徽章 / 置信度 */ /* 状态徽章 / 置信度 */
.kn-card-status { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--df-radius-xs); white-space: nowrap; } .kn-card-status { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--df-radius-xs); white-space: nowrap; }
.st-candidate { background: rgba(255,217,61,0.15); color: var(--df-warning); } /* 状态/置信度徽章底统一走语义 token(双主题自适应,与 Knowledge.vue 同规) */
.st-pending_review { background: rgba(108,159,255,0.15); color: var(--df-info); } .st-candidate { background: var(--df-warning-bg); color: var(--df-warning); }
.st-published { background: rgba(100,255,218,0.15); color: var(--df-success); } .st-pending_review { background: var(--df-info-bg); color: var(--df-info); }
.st-archived { background: rgba(90,99,128,0.2); color: var(--df-text-dim); } .st-published { background: var(--df-success-bg); color: var(--df-success); }
.conf-high { background: rgba(100,255,218,0.15); color: var(--df-success); padding: 1px 6px; border-radius: var(--df-radius-xs); } .st-archived { background: var(--df-neutral-bg); color: var(--df-text-dim); }
.conf-medium { background: rgba(255,217,61,0.15); color: var(--df-warning); padding: 1px 6px; border-radius: var(--df-radius-xs); } .conf-high { background: var(--df-success-bg); color: var(--df-success); padding: 1px 6px; border-radius: var(--df-radius-xs); }
.conf-low { background: rgba(255,107,107,0.15); color: var(--df-danger); padding: 1px 6px; border-radius: var(--df-radius-xs); } .conf-medium { background: var(--df-warning-bg); color: var(--df-warning); padding: 1px 6px; border-radius: var(--df-radius-xs); }
.conf-low { background: var(--df-danger-bg); color: var(--df-danger); padding: 1px 6px; border-radius: var(--df-radius-xs); }
/* 溯源 */ /* 溯源 */
.section-title { font-size: 13px; font-weight: 500; color: var(--df-text); margin-bottom: 10px; } .section-title { font-size: 13px; font-weight: 500; color: var(--df-text); margin-bottom: 10px; }
@@ -439,7 +440,7 @@ watch(renderedContent, () => {
} }
.detail-content.content-collapsed::after { .detail-content.content-collapsed::after {
content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 28px; content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 28px;
background: linear-gradient(to bottom, transparent, var(--df-bg-panel, var(--df-bg-card))); background: linear-gradient(to bottom, transparent, var(--df-bg-card));
pointer-events: none; pointer-events: none;
} }
.detail-content { position: relative; } .detail-content { position: relative; }
+8 -8
View File
@@ -94,7 +94,7 @@ const knowledgeStore = useKnowledgeStore()
const appSettings = useAppSettingsStore() const appSettings = useAppSettingsStore()
// ── 侧边栏收缩状态(持久化到 appSettings,小窗口自动收缩) ── // ── 侧边栏收缩状态(持久化到 appSettings,小窗口自动收缩) ──
// 展开 192px(文字+图标) / 收缩 56px(仅图标,hover tooltip 显示文字) // 展开 220px(文字+图标) / 收缩 56px(仅图标,hover tooltip 显示文字)
// 优先级:用户手动设置 > 小窗口自动收缩(≤768px) // 优先级:用户手动设置 > 小窗口自动收缩(≤768px)
const COLLAPSE_THRESHOLD = 768 const COLLAPSE_THRESHOLD = 768
// useSetting 响应式读(loadAll 异步填充缓存后 watch 自动同步刷新)—— // useSetting 响应式读(loadAll 异步填充缓存后 watch 自动同步刷新)——
@@ -172,8 +172,8 @@ const secondaryNav = [
<style scoped> <style scoped>
.df-sidebar { .df-sidebar {
width: 192px; width: 220px;
min-width: 192px; min-width: 220px;
background: var(--df-sidebar-bg); background: var(--df-sidebar-bg);
border-right: 0.5px solid var(--df-border); border-right: 0.5px solid var(--df-border);
display: flex; display: flex;
@@ -219,8 +219,8 @@ const secondaryNav = [
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 10px; font-size: 10px;
color: var(--df-text-dim); color: var(--df-text-dim);
background: rgba(255,255,255,0.04); background: var(--df-hover);
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
} }
@@ -323,7 +323,7 @@ const secondaryNav = [
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 10px; font-size: 10px;
font-weight: 500; font-weight: 500;
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: var(--df-radius); border-radius: var(--df-radius);
min-width: 18px; min-width: 18px;
text-align: center; text-align: center;
@@ -360,8 +360,8 @@ const secondaryNav = [
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 9px; font-size: 9px;
color: var(--df-text-dim); color: var(--df-text-dim);
background: rgba(255,255,255,0.04); background: var(--df-hover);
padding: 1px 5px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
} }
+7 -6
View File
@@ -167,7 +167,7 @@ async function onInstall() {
color: var(--df-accent); color: var(--df-accent);
font-size: 12px; font-size: 12px;
cursor: pointer; cursor: pointer;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); box-shadow: var(--df-shadow-sm);
transition: filter 0.15s; transition: filter 0.15s;
} }
.update-badge-btn:hover { .update-badge-btn:hover {
@@ -193,7 +193,7 @@ async function onInstall() {
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-lg); border-radius: var(--df-radius-lg);
background: var(--df-bg-card); background: var(--df-bg-card);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); box-shadow: var(--df-shadow-sm);
} }
.update-pop-head { .update-pop-head {
font-size: 13px; font-size: 13px;
@@ -213,11 +213,12 @@ async function onInstall() {
.update-pop-progress { .update-pop-progress {
margin-bottom: 12px; margin-bottom: 12px;
} }
/* 进度条轨道:原 --df-bg-hover 为未定义幽灵 token(靠回退侥幸渲染),改中性底 */
.update-pop-bar { .update-pop-bar {
width: 100%; width: 100%;
height: 6px; height: 6px;
border-radius: 3px; border-radius: 3px;
background: var(--df-bg-hover, rgba(128, 128, 128, 0.2)); background: var(--df-neutral-bg);
overflow: hidden; overflow: hidden;
} }
.update-pop-fill { .update-pop-fill {
@@ -234,10 +235,10 @@ async function onInstall() {
.update-pop-error { .update-pop-error {
margin-bottom: 12px; margin-bottom: 12px;
padding: 8px 10px; padding: 8px 10px;
border-radius: var(--df-radius-md, 6px); border-radius: var(--df-radius-md);
background: rgba(220, 53, 69, 0.12); background: var(--df-danger-bg);
font-size: 12px; font-size: 12px;
color: var(--df-danger, #dc3545); color: var(--df-danger);
line-height: 1.5; line-height: 1.5;
word-break: break-all; word-break: break-all;
} }
+4 -16
View File
@@ -64,7 +64,7 @@
</div> </div>
<!-- M31: 审批失败反馈(store approveHumanApproval 内部 catch 吞错,失败时 pendingApproval 不清空) <!-- M31: 审批失败反馈(store approveHumanApproval 内部 catch 吞错,失败时 pendingApproval 不清空)
对话框保持开启,用户可看到错误并重试 --> 对话框保持开启,用户可看到错误并重试 -->
<div v-if="toast.visible" class="ad-toast" :class="'ad-toast-' + toast.type">{{ toast.msg }}</div> <div v-if="toast.visible" class="df-toast df-toast--bottom" :class="toast.type === 'error' ? 'df-toast--danger' : 'df-toast--' + toast.type">{{ toast.msg }}</div>
</div> </div>
</template> </template>
@@ -162,19 +162,7 @@ watch(() => pendingApproval.value, (newApproval) => {
</script> </script>
<style scoped> <style scoped>
/* M31: 审批失败 toast(scoped 自治,不引入全局样式;沿用 Projects.vue .toast 视觉规范) */ /* M31: 审批失败 toast(样式走全局 .df-toast 族+--bottom 底部变体;
.ad-toast { scoped 仅保留 z-index 覆写——本组件浮在弹层(z≈10000)之上,toast 须更高) */
position: fixed; .df-toast { z-index: 10001; }
bottom: 24px;
left: 50%;
transform: translateX(-50%);
z-index: 10001;
padding: 10px 18px;
border-radius: var(--df-radius-md);
font-size: 13px;
font-weight: 500;
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
pointer-events: none;
}
.ad-toast-error { background: var(--df-danger); color: #fff; }
</style> </style>
+5 -4
View File
@@ -442,7 +442,7 @@ function bindEdgeDeleteButtons() {
graph.on('edge:mouseleave', onEdgeLeave) graph.on('edge:mouseleave', onEdgeLeave)
} }
/** 依赖类型 → 边颜色 */ /** 依赖类型 → 边颜色(X6 画布演示色板·品牌/演示豁免,不入 token) */
function depTypeColor(depType: string): string { function depTypeColor(depType: string): string {
switch (depType) { switch (depType) {
case 'api': return '#5378e8' case 'api': return '#5378e8'
@@ -490,7 +490,7 @@ onBeforeUnmount(() => {
height: 100%; height: 100%;
background: var(--df-bg); background: var(--df-bg);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-lg, 8px); border-radius: var(--df-radius-lg);
overflow: hidden; overflow: hidden;
position: relative; position: relative;
} }
@@ -593,11 +593,12 @@ onBeforeUnmount(() => {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 200; z-index: 200;
box-shadow: 0 2px 6px rgba(0,0,0,0.4); box-shadow: var(--df-shadow-md);
transition: background 0.15s; transition: background 0.15s;
pointer-events: auto; pointer-events: auto;
} }
/* hover 由 danger 派生加深,替换孤色 */
.dep-edge-delete-btn:hover { .dep-edge-delete-btn:hover {
background: #c24040; background: color-mix(in srgb, var(--df-danger) 75%, #000);
} }
</style> </style>
+13 -30
View File
@@ -488,11 +488,8 @@ onUnmounted(() => { _unlistenDataChanged?.() })
async function onScanSubmodules() { async function onScanSubmodules() {
moduleDropdownOpen.value = false moduleDropdownOpen.value = false
try { try {
const n = await moduleApi.scanProjectModules(props.projectId) await moduleApi.scanProjectModules(props.projectId)
await loadModules() await loadModules()
if (n > 0) {
console.log('[FileExplorer] 扫描到新工程:', n)
}
} catch (e) { } catch (e) {
Message.error(t('common.unknownError')) Message.error(t('common.unknownError'))
console.error('[FileExplorer] 扫描子仓库失败:', e) console.error('[FileExplorer] 扫描子仓库失败:', e)
@@ -594,7 +591,7 @@ async function onRemoveModule() {
max-height: 100%; max-height: 100%;
background: var(--df-bg); background: var(--df-bg);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-lg, 8px); border-radius: var(--df-radius-lg);
overflow: hidden; overflow: hidden;
} }
@@ -625,7 +622,7 @@ async function onRemoveModule() {
padding: 5px 10px; padding: 5px 10px;
background: var(--df-bg); background: var(--df-bg);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm);
color: var(--df-text); color: var(--df-text);
font-size: 12px; font-size: 12px;
cursor: pointer; cursor: pointer;
@@ -651,12 +648,11 @@ async function onRemoveModule() {
max-width: 320px; max-width: 320px;
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm);
box-shadow: 0 6px 16px rgba(0,0,0,0.25); box-shadow: var(--df-shadow-sm);
z-index: 20; z-index: 20;
max-height: 280px; max-height: 280px;
overflow-y: auto; overflow-y: auto;
scrollbar-width: thin;
} }
.module-dropdown-item { .module-dropdown-item {
@@ -665,10 +661,10 @@ async function onRemoveModule() {
gap: 2px; gap: 2px;
padding: 8px 12px; padding: 8px 12px;
cursor: pointer; cursor: pointer;
border-bottom: 0.5px solid rgba(255,255,255,0.04); border-bottom: 0.5px solid var(--df-hover);
} }
.module-dropdown-item:last-child { border-bottom: none; } .module-dropdown-item:last-child { border-bottom: none; }
.module-dropdown-item:hover { background: rgba(255,255,255,0.04); } .module-dropdown-item:hover { background: var(--df-hover); }
.module-dropdown-item.active { .module-dropdown-item.active {
background: rgba(255,255,255,0.06); background: rgba(255,255,255,0.06);
border-left: 2px solid var(--df-accent); border-left: 2px solid var(--df-accent);
@@ -778,7 +774,7 @@ async function onRemoveModule() {
.view-tab:hover { .view-tab:hover {
color: var(--df-text); color: var(--df-text);
background: rgba(255,255,255,0.03); background: var(--df-hover);
} }
.view-tab.active { .view-tab.active {
@@ -819,13 +815,6 @@ async function onRemoveModule() {
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
min-height: 0; min-height: 0;
scrollbar-width: thin;
}
.explorer-changes .gc-body {
overflow-y: auto;
overflow-x: hidden;
scrollbar-width: thin;
} }
.tree-loading { .tree-loading {
@@ -867,8 +856,8 @@ async function onRemoveModule() {
.tree-loading .spinner { .tree-loading .spinner {
width: 20px; width: 20px;
height: 20px; height: 20px;
border: 2px solid var(--df-border, #444); border: 2px solid var(--df-border);
border-top-color: var(--df-accent, #3a8); border-top-color: var(--df-accent);
border-radius: 50%; border-radius: 50%;
animation: df-spin 0.8s linear infinite; animation: df-spin 0.8s linear infinite;
} }
@@ -913,20 +902,14 @@ async function onRemoveModule() {
} }
} }
/* spinner(刷新按钮内) */ /* spinner(刷新按钮内);df-spin keyframes 消费 global.css 全局定义(原本地重复定义已删) */
.spinner { .spinner {
width: 10px; width: 10px;
height: 10px; height: 10px;
border: 1.5px solid var(--df-border, #444); border: 1.5px solid var(--df-border);
border-top-color: var(--df-accent, #3a8); border-top-color: var(--df-accent);
border-radius: 50%; border-radius: 50%;
animation: df-spin 0.8s linear infinite; animation: df-spin 0.8s linear infinite;
display: inline-block; display: inline-block;
} }
@keyframes df-spin {
to {
transform: rotate(360deg);
}
}
</style> </style>
+24 -36
View File
@@ -171,7 +171,7 @@
import { ref, watch, computed, onUnmounted, nextTick } from 'vue' import { ref, watch, computed, onUnmounted, nextTick } from 'vue'
import { moduleApi, type OutlineSymbol } from '@/api/module' import { moduleApi, type OutlineSymbol } from '@/api/module'
import hljs from 'highlight.js/lib/common' import hljs from 'highlight.js/lib/common'
import { useMarkdown, useRendered } from '@/composables/useMarkdown' import { useRendered } from '@/composables/useMarkdown'
import { escapeHtml } from '@/utils/html' import { escapeHtml } from '@/utils/html'
const props = defineProps<{ const props = defineProps<{
@@ -184,7 +184,6 @@ const props = defineProps<{
externalDiff?: string externalDiff?: string
}>() }>()
const { } = useMarkdown()
const content = ref('') const content = ref('')
const htmlContent = ref('') const htmlContent = ref('')
const loading = ref(false) const loading = ref(false)
@@ -469,12 +468,12 @@ const outlineGroups = computed(() => {
.map((g) => ({ key: g, labelKey: GROUP_LABEL_KEY[g], items: buckets.get(g)! })) .map((g) => ({ key: g, labelKey: GROUP_LABEL_KEY[g], items: buckets.get(g)! }))
}) })
/** 点击符号滚动到对应行:偏移 = 代码区 padding-top 14px + (line-1) × 行高(12.5px × 1.55)。 */ /** 点击符号滚动到对应行:偏移 = 代码区 padding-top 14px + (line-1) × 行高(12px × 1.55)。 */
function gotoOutlineLine(line: number) { function gotoOutlineLine(line: number) {
activeOutlineLine.value = line activeOutlineLine.value = line
const el = codeScrollRef.value const el = codeScrollRef.value
if (!el) return if (!el) return
const lineHeight = 12.5 * 1.55 const lineHeight = 12 * 1.55
const topPad = 14 // 对齐 .preview-code / .preview-line-numbers 的 padding-top const topPad = 14 // 对齐 .preview-code / .preview-line-numbers 的 padding-top
el.scrollTo({ top: Math.max(0, topPad + (line - 1) * lineHeight), behavior: 'smooth' }) el.scrollTo({ top: Math.max(0, topPad + (line - 1) * lineHeight), behavior: 'smooth' })
} }
@@ -732,11 +731,6 @@ onUnmounted(() => {
padding: 24px; padding: 24px;
} }
.binary-icon {
font-size: 40px;
opacity: 0.8;
}
.binary-title { .binary-title {
font-size: 15px; font-size: 15px;
font-weight: 600; font-weight: 600;
@@ -748,7 +742,7 @@ onUnmounted(() => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 6px; gap: 6px;
background: rgba(255, 255, 255, 0.04); background: var(--df-hover);
border-radius: 8px; border-radius: 8px;
padding: 12px 16px; padding: 12px 16px;
min-width: 280px; min-width: 280px;
@@ -771,7 +765,7 @@ onUnmounted(() => {
.binary-meta-value { .binary-meta-value {
color: var(--df-text-secondary); color: var(--df-text-secondary);
font-family: var(--df-font-mono, Consolas, monospace); font-family: var(--df-font-mono, Consolas, monospace);
font-size: 12.5px; font-size: 12px;
word-break: break-all; word-break: break-all;
} }
@@ -785,7 +779,7 @@ onUnmounted(() => {
} }
.preview-error { color: var(--df-danger); } .preview-error { color: var(--df-danger); }
.binary-icon { font-size: 32px; opacity: 0.5; } .binary-icon { font-size: 32px; opacity: 0.5; } /* 2026-10-18 合并重复定义:40px/0.8 旧版被本行完全覆盖,已删 */
.preview-image { .preview-image {
display: flex; display: flex;
@@ -799,7 +793,7 @@ onUnmounted(() => {
.preview-image img { .preview-image img {
max-width: 100%; max-width: 100%;
height: auto; height: auto;
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm);
} }
/* Markdown 视图:独立滚动容器(preview-body 是 overflow:hidden,不设 overflow 会被裁剪无法滚) */ /* Markdown 视图:独立滚动容器(preview-body 是 overflow:hidden,不设 overflow 会被裁剪无法滚) */
@@ -814,7 +808,7 @@ onUnmounted(() => {
margin: 0; margin: 0;
padding: 14px 16px; padding: 14px 16px;
font-family: var(--df-font-mono, 'Cascadia Code', Consolas, 'Courier New', monospace); font-family: var(--df-font-mono, 'Cascadia Code', Consolas, 'Courier New', monospace);
font-size: 12.5px; font-size: 12px;
line-height: 1.55; line-height: 1.55;
white-space: pre; white-space: pre;
overflow: visible; overflow: visible;
@@ -838,7 +832,7 @@ onUnmounted(() => {
padding: 14px 0; padding: 14px 0;
min-width: 44px; min-width: 44px;
text-align: right; text-align: right;
background: rgba(255, 255, 255, 0.03); background: var(--df-hover);
border-right: 0.5px solid var(--df-border); border-right: 0.5px solid var(--df-border);
user-select: none; user-select: none;
position: sticky; position: sticky;
@@ -850,7 +844,7 @@ onUnmounted(() => {
.preview-line-num { .preview-line-num {
padding: 0 10px 0 8px; padding: 0 10px 0 8px;
font-family: var(--df-font-mono, 'Cascadia Code', Consolas, monospace); font-family: var(--df-font-mono, 'Cascadia Code', Consolas, monospace);
font-size: 12.5px; font-size: 12px;
line-height: 1.55; line-height: 1.55;
color: var(--df-text-dim); color: var(--df-text-dim);
opacity: 0.5; opacity: 0.5;
@@ -859,24 +853,25 @@ onUnmounted(() => {
.preview-line-num.is-active { .preview-line-num.is-active {
color: var(--df-accent); color: var(--df-accent);
opacity: 1; opacity: 1;
background: rgba(255, 255, 255, 0.05); background: var(--df-hover);
} }
/* Diff 视图 — 在自身区域滚动,不溢出到父级 */ /* Diff 视图 — 在自身区域滚动,不溢出到父级(2026-10-18 合并文末重复定义) */
.preview-diff { .preview-diff {
font-family: var(--df-font-mono, 'Cascadia Code', Consolas, monospace); font-family: var(--df-font-mono, 'Cascadia Code', Consolas, monospace);
font-size: 12px; font-size: 12px;
line-height: 1.55; line-height: 1.55;
overflow: auto; overflow: auto;
min-height: 0; min-height: 0;
height: 100%;
flex: 1; flex: 1;
} }
.spinner { .spinner {
width: 16px; width: 16px;
height: 16px; height: 16px;
border: 2px solid var(--df-border, #444); border: 2px solid var(--df-border);
border-top-color: var(--df-accent, #3a8); border-top-color: var(--df-accent);
border-radius: 50%; border-radius: 50%;
animation: df-spin 0.8s linear infinite; animation: df-spin 0.8s linear infinite;
display: inline-block; display: inline-block;
@@ -890,7 +885,7 @@ onUnmounted(() => {
padding: 4px 10px; padding: 4px 10px;
font-size: 11px; font-size: 11px;
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm);
background: transparent; background: transparent;
color: var(--df-text-secondary); color: var(--df-text-secondary);
cursor: pointer; cursor: pointer;
@@ -927,7 +922,7 @@ onUnmounted(() => {
padding: 4px 9px; padding: 4px 9px;
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: 8px; border-radius: 8px;
background: rgba(255, 255, 255, 0.04); background: var(--df-hover);
color: var(--df-text-secondary); color: var(--df-text-secondary);
font-size: 12px; font-size: 12px;
cursor: pointer; cursor: pointer;
@@ -958,7 +953,7 @@ onUnmounted(() => {
background: rgba(20, 22, 34, 0.95); background: rgba(20, 22, 34, 0.95);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: 10px; border-radius: 10px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); box-shadow: var(--df-shadow-md);
overflow: hidden; overflow: hidden;
} }
@@ -1031,7 +1026,7 @@ onUnmounted(() => {
gap: 6px; gap: 6px;
padding: 2px 6px; padding: 2px 6px;
border-radius: 6px; border-radius: 6px;
font-size: 11.5px; font-size: 11px;
cursor: pointer; cursor: pointer;
white-space: nowrap; white-space: nowrap;
color: var(--df-text-secondary); color: var(--df-text-secondary);
@@ -1039,7 +1034,7 @@ onUnmounted(() => {
transition: background 0.15s; transition: background 0.15s;
} }
.outline-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--df-text); } .outline-item:hover { background: var(--df-hover); color: var(--df-text); }
.outline-item.is-active { .outline-item.is-active {
background: rgba(255, 255, 255, 0.09); background: rgba(255, 255, 255, 0.09);
@@ -1047,7 +1042,7 @@ onUnmounted(() => {
box-shadow: inset 2px 0 0 var(--df-accent); box-shadow: inset 2px 0 0 var(--df-accent);
} }
/* 分组徽章配色:类型蓝 / 函数绿 / 变量橙 / 模块紫 */ /* 分组徽章配色:类型蓝 / 函数绿 / 变量橙 / 模块紫(语法色板·演示豁免,不入 token) */
.outline-item.grp-type .outline-kind { color: #4FC3F7; } .outline-item.grp-type .outline-kind { color: #4FC3F7; }
.outline-item.grp-fn .outline-kind { color: #81C784; } .outline-item.grp-fn .outline-kind { color: #81C784; }
.outline-item.grp-var .outline-kind { color: #FFB74D; } .outline-item.grp-var .outline-kind { color: #FFB74D; }
@@ -1066,6 +1061,7 @@ onUnmounted(() => {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap;
} }
.outline-line { .outline-line {
@@ -1076,15 +1072,6 @@ onUnmounted(() => {
opacity: 0.5; opacity: 0.5;
} }
/* Diff 视图 */
.preview-diff {
font-family: var(--df-font-mono, 'Cascadia Code', Consolas, monospace);
font-size: 12px;
line-height: 1.55;
overflow: auto;
height: 100%;
}
.diff-line { .diff-line {
display: flex; display: flex;
padding: 0 8px; padding: 0 8px;
@@ -1115,6 +1102,7 @@ onUnmounted(() => {
overflow: hidden; overflow: hidden;
} }
/* Diff 行底(差异色·演示豁免,与 git 语义 token 并行的语法高亮族) */
.diff-add { .diff-add {
background: rgba(40, 160, 70, 0.12); background: rgba(40, 160, 70, 0.12);
} }
@@ -1137,7 +1125,7 @@ onUnmounted(() => {
color: var(--df-text); color: var(--df-text);
} }
@keyframes df-spin { to { transform: rotate(360deg); } } /* df-spin keyframes 消费 global.css 全局定义(原本地同名重复定义已删,2026-10-18 整洁波) */
</style> </style>
<!-- highlight.js github-dark 主题(全局,非 scoped) --> <!-- highlight.js github-dark 主题(全局,非 scoped) -->
+8 -13
View File
@@ -384,16 +384,16 @@ watch(
gap: 6px; gap: 6px;
padding: 3px 8px; padding: 3px 8px;
cursor: pointer; cursor: pointer;
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm);
transition: background 0.12s; transition: background 0.12s;
} }
.tree-row:hover { .tree-row:hover {
background: var(--df-bg-card, rgba(255, 255, 255, 0.04)); background: var(--df-bg-card);
} }
.tree-row-file.is-selected { .tree-row-file.is-selected {
background: var(--df-accent, #3a8); background: var(--df-accent);
color: #fff; color: #fff;
} }
@@ -415,8 +415,8 @@ watch(
display: inline-block; display: inline-block;
width: 9px; width: 9px;
height: 9px; height: 9px;
border: 1.5px solid var(--df-border, #444); border: 1.5px solid var(--df-border);
border-top-color: var(--df-accent, #3a8); border-top-color: var(--df-accent);
border-radius: 50%; border-radius: 50%;
animation: df-spin 0.8s linear infinite; animation: df-spin 0.8s linear infinite;
vertical-align: middle; vertical-align: middle;
@@ -544,19 +544,14 @@ watch(
color: #e05050; color: #e05050;
} }
/* spinner;df-spin keyframes 消费 global.css 全局定义(原本地重复定义已删,2026-10-18 整洁波) */
.spinner { .spinner {
width: 12px; width: 12px;
height: 12px; height: 12px;
border: 1.5px solid var(--df-border, #444); border: 1.5px solid var(--df-border);
border-top-color: var(--df-accent, #3a8); border-top-color: var(--df-accent);
border-radius: 50%; border-radius: 50%;
animation: df-spin 0.8s linear infinite; animation: df-spin 0.8s linear infinite;
display: inline-block; display: inline-block;
} }
@keyframes df-spin {
to {
transform: rotate(360deg);
}
}
</style> </style>
+17 -43
View File
@@ -422,7 +422,6 @@ async function loadStatus() {
const showBranchPicker = ref(false) const showBranchPicker = ref(false)
const branchList = ref<{ name: string; is_current: boolean }[]>([]) const branchList = ref<{ name: string; is_current: boolean }[]>([])
const branchLoading = ref(false) const branchLoading = ref(false)
const currentBranch = ref('')
async function onSwitchBranch() { async function onSwitchBranch() {
if (showBranchPicker.value) { if (showBranchPicker.value) {
@@ -435,7 +434,6 @@ async function onSwitchBranch() {
try { try {
const res = await moduleApi.listBranches(props.moduleId) const res = await moduleApi.listBranches(props.moduleId)
branchList.value = res.branches branchList.value = res.branches
currentBranch.value = res.current
} catch (e) { } catch (e) {
branchList.value = [] branchList.value = []
actionError.value = String(e) actionError.value = String(e)
@@ -607,7 +605,7 @@ watch(() => props.refreshKey, () => {
} }
.branch-switch-btn:hover { .branch-switch-btn:hover {
color: var(--df-text); color: var(--df-text);
background: rgba(255,255,255,0.05); background: var(--df-hover);
} }
/* Tabs */ /* Tabs */
@@ -620,14 +618,14 @@ watch(() => props.refreshKey, () => {
.gc-tab.active { color: var(--df-text); border-bottom-color: var(--df-accent); } .gc-tab.active { color: var(--df-text); border-bottom-color: var(--df-accent); }
.gc-tab:hover { color: var(--df-text); } .gc-tab:hover { color: var(--df-text); }
.gc-body { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; scrollbar-width: thin; } .gc-body { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.gc-changes { min-height: 0; } .gc-changes { min-height: 0; }
/* 分组 */ /* 分组 */
.gc-group-header { .gc-group-header {
padding: 6px 14px; font-size: 11px; font-weight: 600; padding: 6px 14px; font-size: 11px; font-weight: 600;
color: var(--df-text-dim); text-transform: uppercase; letter-spacing: 0.5px; color: var(--df-text-dim); text-transform: uppercase; letter-spacing: 0.5px;
background: rgba(255,255,255,0.02); border-bottom: 0.5px solid var(--df-border); background: var(--df-hover); border-bottom: 0.5px solid var(--df-border);
position: sticky; top: 0; z-index: 1; position: sticky; top: 0; z-index: 1;
} }
@@ -645,8 +643,8 @@ watch(() => props.refreshKey, () => {
.gc-search-icon { color: var(--df-text-dim); flex-shrink: 0; } .gc-search-icon { color: var(--df-text-dim); flex-shrink: 0; }
.gc-search-input { .gc-search-input {
flex: 1; min-width: 0; flex: 1; min-width: 0;
background: rgba(255,255,255,0.04); border: 0.5px solid var(--df-border); background: var(--df-hover); border: 0.5px solid var(--df-border);
border-radius: 4px; padding: 4px 8px; border-radius: 4px; height: var(--df-h-input); padding: 0 8px;
color: var(--df-text); font-size: 12px; outline: none; color: var(--df-text); font-size: 12px; outline: none;
} }
.gc-search-input:focus { border-color: var(--df-accent); } .gc-search-input:focus { border-color: var(--df-accent); }
@@ -658,13 +656,13 @@ watch(() => props.refreshKey, () => {
.gc-search-clear:hover { color: var(--df-text); } .gc-search-clear:hover { color: var(--df-text); }
/* 提交列表 */ /* 提交列表 */
.gc-history-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; } .gc-history-list { flex: 1; min-height: 0; overflow-y: auto; }
.gc-commit-row { .gc-commit-row {
display: flex; flex-direction: column; gap: 2px; display: flex; flex-direction: column; gap: 2px;
padding: 6px 14px; border-bottom: 0.5px solid rgba(255,255,255,0.03); padding: 6px 14px; border-bottom: 0.5px solid var(--df-hover);
cursor: pointer; transition: background 0.1s; cursor: pointer; transition: background 0.1s;
} }
.gc-commit-row:hover { background: rgba(255,255,255,0.04); } .gc-commit-row:hover { background: var(--df-hover); }
.gc-commit-row.selected { background: rgba(255,255,255,0.06); } .gc-commit-row.selected { background: rgba(255,255,255,0.06); }
.gc-commit-line1 { .gc-commit-line1 {
display: flex; align-items: center; gap: 8px; display: flex; align-items: center; gap: 8px;
@@ -696,7 +694,7 @@ watch(() => props.refreshKey, () => {
} }
.gc-commit-detail-header { .gc-commit-detail-header {
display: flex; align-items: center; gap: 10px; flex-wrap: wrap; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
padding: 8px 14px; background: rgba(255,255,255,0.03); padding: 8px 14px; background: var(--df-hover);
border-bottom: 0.5px solid var(--df-border); border-bottom: 0.5px solid var(--df-border);
} }
.gc-commit-detail-hash { .gc-commit-detail-hash {
@@ -720,14 +718,14 @@ watch(() => props.refreshKey, () => {
/* 提交的文件列表 */ /* 提交的文件列表 */
.gc-commit-files { .gc-commit-files {
border-bottom: 0.5px solid var(--df-border); border-bottom: 0.5px solid var(--df-border);
overflow-y: auto; max-height: 140px; scrollbar-width: thin; flex-shrink: 0; overflow-y: auto; max-height: 140px; flex-shrink: 0;
} }
.gc-commit-file-row { .gc-commit-file-row {
display: flex; align-items: center; gap: 8px; display: flex; align-items: center; gap: 8px;
padding: 5px 14px 5px 28px; cursor: pointer; transition: background 0.1s; padding: 5px 14px 5px 28px; cursor: pointer; transition: background 0.1s;
border-bottom: 0.5px solid rgba(255,255,255,0.02); border-bottom: 0.5px solid var(--df-hover);
} }
.gc-commit-file-row:hover { background: rgba(255,255,255,0.04); } .gc-commit-file-row:hover { background: var(--df-hover); }
.gc-commit-file-row.active { background: rgba(255,255,255,0.06); } .gc-commit-file-row.active { background: rgba(255,255,255,0.06); }
/* 滑出动画 */ /* 滑出动画 */
@@ -757,7 +755,7 @@ watch(() => props.refreshKey, () => {
display: flex; align-items: center; gap: 8px; display: flex; align-items: center; gap: 8px;
cursor: pointer; transition: background 0.1s; cursor: pointer; transition: background 0.1s;
} }
.gc-file-row:hover { background: rgba(255,255,255,0.04); } .gc-file-row:hover { background: var(--df-hover); }
.gc-file-row.selected { background: rgba(255,255,255,0.06); } .gc-file-row.selected { background: rgba(255,255,255,0.06); }
/* 加载更多 */ /* 加载更多 */
@@ -766,7 +764,7 @@ watch(() => props.refreshKey, () => {
color: var(--df-accent); font-size: 12px; color: var(--df-accent); font-size: 12px;
transition: background 0.1s; flex-shrink: 0; transition: background 0.1s; flex-shrink: 0;
} }
.gc-load-more:hover { background: rgba(255,255,255,0.04); } .gc-load-more:hover { background: var(--df-hover); }
/* 分支列表弹窗 */ /* 分支列表弹窗 */
.gc-branch-picker { .gc-branch-picker {
@@ -790,7 +788,6 @@ watch(() => props.refreshKey, () => {
.gc-branch-list { .gc-branch-list {
max-height: 200px; max-height: 200px;
overflow-y: auto; overflow-y: auto;
scrollbar-width: thin;
} }
.gc-branch-item { .gc-branch-item {
display: flex; display: flex;
@@ -827,13 +824,9 @@ watch(() => props.refreshKey, () => {
.gc-skeleton-row { .gc-skeleton-row {
height: 24px; height: 24px;
border-radius: 4px; border-radius: 4px;
background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%); background: linear-gradient(90deg, var(--df-hover) 0%, rgba(255,255,255,0.08) 50%, var(--df-hover) 100%);
background-size: 200% 100%; background-size: 200% 100%;
animation: gc-shimmer 1.5s infinite linear; animation: df-shimmer 1.5s infinite linear; /* 消费 global.css df-shimmer(原本地 gc-shimmer 重复定义已删) */
}
@keyframes gc-shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
} }
/* 通用 */ /* 通用 */
@@ -853,24 +846,5 @@ watch(() => props.refreshKey, () => {
border: 2px solid var(--df-border); border-top-color: var(--df-accent); border: 2px solid var(--df-border); border-top-color: var(--df-accent);
border-radius: 50%; animation: df-spin 0.8s linear infinite; display: inline-block; border-radius: 50%; animation: df-spin 0.8s linear infinite; display: inline-block;
} }
@keyframes df-spin { to { transform: rotate(360deg); } } /* df-spin keyframes 消费 global.css 全局定义(原本地同名重复定义已删,2026-10-18 整洁波) */
/* 滚动条对齐全局(变更/历史提交列表与全局统一样式) */
.git-changes ::-webkit-scrollbar {
width: 5px;
height: 5px;
}
.git-changes ::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.08);
border-radius: var(--df-radius-xs);
}
.git-changes ::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.14);
}
.git-changes ::-webkit-scrollbar-track {
background: transparent;
}
</style> </style>
+2 -6
View File
@@ -242,13 +242,9 @@ onBeforeUnmount(() => window.removeEventListener('resize', onWinResize))
width: 18px; width: 18px;
height: 12px; height: 12px;
border-radius: 3px; border-radius: 3px;
background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%); background: linear-gradient(90deg, var(--df-hover) 0%, rgba(255,255,255,0.08) 50%, var(--df-hover) 100%);
background-size: 200% 100%; background-size: 200% 100%;
animation: pc-shimmer 1.5s infinite linear; animation: df-shimmer 1.5s infinite linear; /* 消费 global.css df-shimmer(原本地 pc-shimmer 重复定义已删) */
}
@keyframes pc-shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
} }
.card-top-actions { display: flex; align-items: center; gap: 8px; } .card-top-actions { display: flex; align-items: center; gap: 8px; }
+5 -9
View File
@@ -91,8 +91,8 @@
<div class="update-progress-text">{{ progressText }}</div> <div class="update-progress-text">{{ progressText }}</div>
</div> </div>
<!-- 错误提示 --> <!-- 错误提示:视觉走全局 .df-note--danger -->
<div v-if="installError" class="update-error">{{ installError }}</div> <div v-if="installError" class="df-note df-note--danger update-error">{{ installError }}</div>
<div class="update-card-actions"> <div class="update-card-actions">
<button <button
@@ -373,11 +373,12 @@ async function onIntervalChange() {
.update-progress { .update-progress {
margin-bottom: 12px; margin-bottom: 12px;
} }
/* 进度条轨道:原 --df-bg-hover 为未定义幽灵 token(靠回退侥幸渲染),改中性底 */
.update-progress-bar { .update-progress-bar {
width: 100%; width: 100%;
height: 6px; height: 6px;
border-radius: 3px; border-radius: 3px;
background: var(--df-bg-hover, rgba(128, 128, 128, 0.2)); background: var(--df-neutral-bg);
overflow: hidden; overflow: hidden;
} }
.update-progress-fill { .update-progress-fill {
@@ -391,14 +392,9 @@ async function onIntervalChange() {
font-family: var(--df-font-mono, monospace); font-family: var(--df-font-mono, monospace);
color: var(--df-text-dim); color: var(--df-text-dim);
} }
/* 安装错误提示 */ /* 安装错误提示:底色/边/圆角/字号走全局 .df-note--danger(token 直引无回退),此处仅留排版 */
.update-error { .update-error {
margin-bottom: 12px; margin-bottom: 12px;
padding: 8px 10px;
border-radius: var(--df-radius-md, 6px);
background: rgba(220, 53, 69, 0.12);
font-size: 12px;
color: var(--df-danger, #dc3545);
line-height: 1.5; line-height: 1.5;
word-break: break-all; word-break: break-all;
} }
+7 -12
View File
@@ -86,11 +86,12 @@
</div> </div>
<!-- all 二次确认弹层(独立,不与 Settings 壳层共用:壳层按钮写死「删除」不适合「确认接管」) --> <!-- all 二次确认弹层(独立,不与 Settings 壳层共用:壳层按钮写死「删除」不适合「确认接管」) -->
<Transition name="confirm"> <!-- 按钮行/过渡消费 global.css .df-confirm-actions + df-confirm(2026-10-18 整洁波并轨) -->
<Transition name="df-confirm">
<div v-if="confirmState.visible" class="confirm-mask" @click.self="answerConfirm(false)"> <div v-if="confirmState.visible" class="confirm-mask" @click.self="answerConfirm(false)">
<div class="confirm-box"> <div class="confirm-box">
<div class="confirm-msg">{{ confirmState.msg }}</div> <div class="confirm-msg">{{ confirmState.msg }}</div>
<div class="confirm-actions"> <div class="df-confirm-actions">
<button class="btn btn-ghost btn-sm" @click="answerConfirm(false)">{{ $t('common.cancel') }}</button> <button class="btn btn-ghost btn-sm" @click="answerConfirm(false)">{{ $t('common.cancel') }}</button>
<button class="btn btn-danger btn-sm" @click="answerConfirm(true)">{{ confirmState.dangerLabel || $t('common.confirm') }}</button> <button class="btn btn-danger btn-sm" @click="answerConfirm(true)">{{ confirmState.dangerLabel || $t('common.confirm') }}</button>
</div> </div>
@@ -252,8 +253,9 @@ function onApprovalTimeoutChange() {
.setting-select/.setting-textarea + SettingRow(封装 .setting-row/.setting-info/.setting-label/ .setting-select/.setting-textarea + SettingRow(封装 .setting-row/.setting-info/.setting-label/
.setting-desc/.setting-control)。本 Section 仅保留 all 二次确认弹层特有 scoped 样式。 .setting-desc/.setting-control)。本 Section 仅保留 all 二次确认弹层特有 scoped 样式。
F-#97 all 二次确认弹层:复用 Settings.vue 壳层 confirm 弹层同款样式(mask/box/msg/ F-#97 all 二次确认弹层:mask/box/msg 本地特有样式;actions 按钮行与过渡已并轨
actions/transition),此处独立持有 useConfirm 状态(不与壳层共用,壳层按钮写死「删除」)。 */ global.css .df-confirm-actions + df-confirm 过渡(2026-10-18 整洁波双轨合一)。
此处独立持有 useConfirm 状态(不与壳层共用,壳层按钮写死「删除」)。 */
.data-dir-path { .data-dir-path {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
@@ -284,8 +286,6 @@ function onApprovalTimeoutChange() {
flex-direction: column; flex-direction: column;
align-items: stretch; align-items: stretch;
} }
.prompt-row .setting-info { align-items: flex-start; }
.prompt-row .setting-control { align-items: flex-start; }
/* select 类设置行(自定义布局,不复用 SettingRow):label 与 select 同一行靠左顶对齐, /* select 类设置行(自定义布局,不复用 SettingRow):label 与 select 同一行靠左顶对齐,
desc 换行到整行下方。 desc 换行到整行下方。
┌───────────────────────────────┐ ┌───────────────────────────────┐
@@ -326,12 +326,7 @@ function onApprovalTimeoutChange() {
padding: 20px; padding: 20px;
min-width: 280px; min-width: 280px;
max-width: 420px; max-width: 420px;
box-shadow: 0 8px 32px rgba(0,0,0,0.4); box-shadow: var(--df-shadow-md);
} }
.confirm-msg { font-size: 13px; color: var(--df-text); line-height: 1.5; margin-bottom: 16px; white-space: pre-line; } .confirm-msg { font-size: 13px; color: var(--df-text); line-height: 1.5; margin-bottom: 16px; white-space: pre-line; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-danger { background: var(--df-danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.confirm-enter-active, .confirm-leave-active { transition: opacity 0.15s; }
.confirm-enter-from, .confirm-leave-to { opacity: 0; }
</style> </style>
+8 -10
View File
@@ -87,12 +87,13 @@
</section> </section>
<!-- 「信任所有目录」二次确认弹层(同 AdvancedSection 的 all 接管确认:自渲染独立弹层, <!-- 「信任所有目录」二次确认弹层(同 AdvancedSection 的 all 接管确认:自渲染独立弹层,
msg 拼标题+正文,confirm-msg 用 pre-line 保留换行) --> msg 拼标题+正文,confirm-msg 用 pre-line 保留换行;
<Transition name="confirm"> 按钮行/过渡消费 global.css .df-confirm-actions + df-confirm,2026-10-18 整洁波并轨) -->
<Transition name="df-confirm">
<div v-if="confirmState.visible" class="confirm-mask" @click.self="answerConfirm(false)"> <div v-if="confirmState.visible" class="confirm-mask" @click.self="answerConfirm(false)">
<div class="confirm-box"> <div class="confirm-box">
<div class="confirm-msg">{{ confirmState.msg }}</div> <div class="confirm-msg">{{ confirmState.msg }}</div>
<div class="confirm-actions"> <div class="df-confirm-actions">
<button class="btn btn-ghost btn-sm" @click="answerConfirm(false)">{{ $t('common.cancel') }}</button> <button class="btn btn-ghost btn-sm" @click="answerConfirm(false)">{{ $t('common.cancel') }}</button>
<button class="btn btn-danger btn-sm" @click="answerConfirm(true)">{{ confirmState.dangerLabel || $t('common.confirm') }}</button> <button class="btn btn-danger btn-sm" @click="answerConfirm(true)">{{ confirmState.dangerLabel || $t('common.confirm') }}</button>
</div> </div>
@@ -296,8 +297,10 @@ onMounted(load)
.script-safety-desc { .script-safety-desc {
font-size: 12px; color: var(--df-text-dim); margin: 0 0 4px; line-height: 1.5; font-size: 12px; color: var(--df-text-dim); margin: 0 0 4px; line-height: 1.5;
} }
/* 名单输入定宽 280px + max-width 窄窗收缩(原 min-width:280px 在窄列不可收缩致横向溢出) */
.script-safety-input { .script-safety-input {
min-width: 280px; width: 280px;
max-width: 100%;
font-family: var(--df-font-mono, monospace); font-family: var(--df-font-mono, monospace);
} }
.script-safety-note { .script-safety-note {
@@ -321,12 +324,7 @@ onMounted(load)
padding: 20px; padding: 20px;
min-width: 280px; min-width: 280px;
max-width: 420px; max-width: 420px;
box-shadow: 0 8px 32px rgba(0,0,0,0.4); box-shadow: var(--df-shadow-md);
} }
.confirm-msg { font-size: 13px; color: var(--df-text); line-height: 1.5; margin-bottom: 16px; white-space: pre-line; } .confirm-msg { font-size: 13px; color: var(--df-text); line-height: 1.5; margin-bottom: 16px; white-space: pre-line; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-danger { background: var(--df-danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.confirm-enter-active, .confirm-leave-active { transition: opacity 0.15s; }
.confirm-enter-from, .confirm-leave-to { opacity: 0; }
</style> </style>
+7 -10
View File
@@ -263,13 +263,10 @@ onMounted(loadConnections)
<style scoped> <style scoped>
/* 阶段1/3 UX 重构:panel/panel-header/empty-hint/btn 系列/setting-select/setting-input /* 阶段1/3 UX 重构:panel/panel-header/empty-hint/btn 系列/setting-select/setting-input
已迁移到 settings.css 全局。 已迁移到 settings.css 全局。
本 scoped 仅保留 ConnectionPanel 特有样式:connection-card/conn 系列/type 系列/form 系列/ 本 scoped 仅保留 ConnectionPanel 特有样式:connection-card/conn 系列/type 系列/form 系列
btn-link 及 form-field 内输入控件布局覆盖等。 */ 及 form-field 内输入控件布局覆盖等。 */
/* ===== 链接按钮(本面板特有,未进全局) ===== */ /* 链接按钮 .btn-link/.btn-link-danger 已并轨 global.css(样式大重构去重) */
.btn-link { background: none; border: none; color: var(--df-accent); font-size: 12px; cursor: pointer; padding: 2px 6px; }
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--df-danger); }
/* ===== 标题组(panel-header 内 标题+badge 一组,与右侧按钮 space-between) ===== */ /* ===== 标题组(panel-header 内 标题+badge 一组,与右侧按钮 space-between) ===== */
.panel-title-group { display: flex; align-items: center; gap: 8px; } .panel-title-group { display: flex; align-items: center; gap: 8px; }
@@ -307,10 +304,10 @@ onMounted(loadConnections)
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
font-weight: 500; font-weight: 500;
} }
.type-mysql { background: rgba(100,181,246,0.15); color: var(--df-info); } .type-mysql { background: var(--df-info-bg); color: var(--df-info); }
.type-ssh { background: var(--df-accent-soft); color: var(--df-accent); } .type-ssh { background: var(--df-accent-soft); color: var(--df-accent); }
.type-redis { background: rgba(255,107,107,0.15); color: var(--df-danger); } .type-redis { background: var(--df-danger-bg); color: var(--df-danger); }
.type-mongo { background: rgba(100,255,218,0.15); color: var(--df-success); } .type-mongo { background: var(--df-success-bg); color: var(--df-success); }
.conn-host, .conn-user { .conn-host, .conn-user {
font-size: 12px; font-size: 12px;
@@ -318,7 +315,7 @@ onMounted(loadConnections)
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
} }
.conn-user { .conn-user {
background: rgba(90,99,128,0.2); background: var(--df-neutral-bg);
padding: 1px 6px; padding: 1px 6px;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
} }
+4 -2
View File
@@ -142,9 +142,11 @@ async function save() {
<style scoped> <style scoped>
/* panel/panel-header/btn 系列/setting-input 均在 settings.css 全局,此处仅本面板特有样式 */ /* panel/panel-header/btn 系列/setting-input 均在 settings.css 全局,此处仅本面板特有样式 */
.feishu-settings { display: flex; flex-direction: column; gap: 4px; } .feishu-settings { display: flex; flex-direction: column; gap: 4px; }
.feishu-input { width: 280px; } /* 定宽输入补 max-width,窄窗收缩防横向溢出 */
.feishu-input { width: 280px; max-width: 100%; }
.feishu-whitelist { .feishu-whitelist {
width: 320px; width: 320px;
max-width: 100%;
min-height: 64px; min-height: 64px;
resize: vertical; resize: vertical;
font-family: var(--df-font-mono, monospace); font-family: var(--df-font-mono, monospace);
@@ -153,7 +155,7 @@ async function save() {
margin: 0 0 4px; margin: 0 0 4px;
font-size: 12px; font-size: 12px;
line-height: 1.5; line-height: 1.5;
color: var(--df-text-tertiary, #888); color: var(--df-text-dim);
} }
.actions { display: flex; gap: 8px; margin-top: 8px; } .actions { display: flex; gap: 8px; margin-top: 8px; }
</style> </style>
+1 -1
View File
@@ -38,7 +38,7 @@
</select> </select>
</SettingRow> </SettingRow>
<SettingRow v-if="knowledgeConfig.vector_enabled" ref="rowEmbeddingModel" :label="$t('settings.labelEmbeddingModel')" :desc="$t('settings.descEmbeddingModel')"> <SettingRow v-if="knowledgeConfig.vector_enabled" ref="rowEmbeddingModel" :label="$t('settings.labelEmbeddingModel')" :desc="$t('settings.descEmbeddingModel')">
<input type="text" :value="knowledgeConfig.embedding_model ?? ''" @input="knowledgeConfig.embedding_model = ($event.target as HTMLInputElement).value || null" @change="markSaved('embeddingModel')" class="setting-input" :placeholder="$t('settings.phEmbeddingModel')" style="width:220px" /> <input type="text" :value="knowledgeConfig.embedding_model ?? ''" @input="knowledgeConfig.embedding_model = ($event.target as HTMLInputElement).value || null" @change="markSaved('embeddingModel')" class="setting-input" :placeholder="$t('settings.phEmbeddingModel')" style="width:220px; max-width:100%" />
</SettingRow> </SettingRow>
</div> </div>
</section> </section>
+35 -409
View File
@@ -5,55 +5,9 @@
<h2>{{ $t('settings.panelAiProvider') }}</h2> <h2>{{ $t('settings.panelAiProvider') }}</h2>
<button class="btn btn-ghost btn-sm" @click="openProviderForm()">{{ $t('settings.addProvider') }}</button> <button class="btn btn-ghost btn-sm" @click="openProviderForm()">{{ $t('settings.addProvider') }}</button>
</div> </div>
<div class="provider-list" v-if="aiProviders.length > 0"> <!-- 卡片列表 + 负载均衡池控件拆至 provider-panel/provider-list.vue(C4c) -->
<div class="provider-card" :class="{ 'provider-card--default': p.is_default, 'provider-card--disabled': p.enabled === false }" v-for="p in aiProviders" :key="p.id"> <ProviderList v-if="aiProviders.length > 0" ref="providerListRef" :providers="aiProviders"
<div class="provider-top"> @edit="openProviderForm" @delete="deleteProvider" @set-default="setDefaultProvider" @toast="relayToast" />
<div class="provider-info">
<span class="provider-name">{{ p.name }}</span>
<span v-if="p.is_default" class="default-badge">{{ $t('settings.badgeDefault') }}</span>
<span v-if="p.enabled === false" class="pool-badge">{{ $t('settings.badgePoolDisabled') }}</span>
</div>
<div class="provider-actions">
<button class="btn-link" @click="setDefaultProvider(p.id)" v-if="!p.is_default">{{ $t('settings.actionSetDefault') }}</button>
<button class="btn-link" @click="openProviderForm(p)">{{ $t('common.edit') }}</button>
<button class="btn-link btn-link-danger" @click="deleteProvider(p.id)">{{ $t('common.delete') }}</button>
</div>
</div>
<div class="provider-detail">
<div class="detail-row">
<span class="detail-label">{{ $t('settings.detailBaseUrl') }}</span>
<span class="detail-value">{{ p.base_url }}</span>
</div>
<div class="detail-row">
<span class="detail-label">{{ $t('settings.detailModel') }}</span>
<span class="detail-value">{{ p.default_model }}</span>
</div>
<div class="detail-row">
<span class="detail-label">{{ $t('settings.detailApiKey') }}</span>
<span class="detail-value mask">{{ maskKey(p.api_key) }}</span>
</div>
<!-- F-260614-04c 负载均衡池:enabled toggle + weight 即时调 IPC,落库即重建 caps -->
<div class="detail-row detail-row--pool">
<span class="detail-label" :title="$t('settings.descPoolEnabled')">{{ $t('settings.detailPoolEnabled') }}</span>
<div class="detail-value detail-value--control">
<label class="toggle toggle--sm" :title="$t('settings.descPoolEnabled')">
<input type="checkbox" :checked="p.enabled !== false" @change="onPoolToggle(p, ($event.target as HTMLInputElement).checked)" />
<span class="toggle-slider"></span>
</label>
</div>
</div>
<div class="detail-row detail-row--pool" v-if="p.enabled !== false">
<span class="detail-label" :title="$t('settings.descPoolWeight')">{{ $t('settings.detailPoolWeight') }}</span>
<div class="detail-value detail-value--control">
<input type="number" class="setting-input setting-input--sm" min="0" max="100"
:value="p.weight ?? 50"
@change="onPoolWeightChange(p, ($event.target as HTMLInputElement).valueAsNumber)" />
<span class="pool-weight-hint">0-100</span>
</div>
</div>
</div>
</div>
</div>
<div class="empty-hint" v-else>{{ $t('settings.emptyProvider') }}</div> <div class="empty-hint" v-else>{{ $t('settings.emptyProvider') }}</div>
</section> </section>
@@ -127,8 +81,8 @@
</div> </div>
<!-- P0-2: 保存失败持久错误横幅(常驻表单内,非自隐 toast)。 <!-- P0-2: 保存失败持久错误横幅(常驻表单内,非自隐 toast)。
含分类建议:keyring/迁移失败 → 查系统钥匙串权限;其它 → 通用重试。 含分类建议:keyring/迁移失败 → 查系统钥匙串权限;其它 → 通用重试。
用户看到错误同时表单保持编辑态,改完点保存即可重试。 --> 用户看到错误同时表单保持编辑态,改完点保存即可重试。视觉走全局 .df-note--danger。 -->
<div v-if="providerForm.saveError" class="save-error-banner"> <div v-if="providerForm.saveError" class="df-note df-note--danger">
<pre class="save-error-msg">{{ providerForm.saveError }}</pre> <pre class="save-error-msg">{{ providerForm.saveError }}</pre>
</div> </div>
<div class="form-actions"> <div class="form-actions">
@@ -140,59 +94,10 @@
</button> </button>
</div> </div>
<!-- ═══ 拉取到的模型列表(F-01 阶段6)═══ --> <!-- ═══ 拉取到的模型列表(F-01 阶段6;表格+标签标注拆至 provider-panel/model-table.vue)═══ -->
<div class="form-field form-field--full" v-if="providerForm.models.length > 0"> <div class="form-field form-field--full" v-if="providerForm.models.length > 0">
<label class="form-label">{{ $t('settings.modelListTitle', { count: providerForm.models.length }) }}</label> <label class="form-label">{{ $t('settings.modelListTitle', { count: providerForm.models.length }) }}</label>
<table class="model-table"> <ModelTable :models="providerForm.models" />
<thead>
<tr>
<th class="col-enabled">{{ $t('settings.colEnabled') }}</th>
<th class="col-model">{{ $t('settings.colModel') }}</th>
<th class="col-ability">{{ $t('settings.colAbility') }}</th>
<th class="col-weight">{{ $t('settings.labelWeight') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="m in providerForm.models" :key="m.model_id">
<td class="col-enabled">
<label class="toggle toggle--sm">
<input type="checkbox" v-model="m.enabled" />
<span class="toggle-slider"></span>
</label>
</td>
<td class="col-model">
<span class="model-id">{{ m.model_id }}</span>
</td>
<td class="col-ability">
<!-- 能力/模态标签(可编辑:点 × 删除;点 + 添加;手动改后标为「手动」) -->
<div class="model-tags">
<span v-for="md in m.modalities" v-show="!redundantTags.modalities.has(md)" :key="'md-' + md"
class="tag tag-modality" :title="$t('settings.tagTooltipModality')">
{{ $t('settings.tagModality.' + md) }}<span class="tag-remove" role="button" tabindex="0" :aria-label="$t('common.delete')" @click.stop="removeModality(m, md)" @keydown.enter.prevent="removeModality(m, md)" @keydown.space.prevent="removeModality(m, md)">×</span>
</span>
<span v-for="cap in m.capabilities" v-show="!redundantTags.capabilities.has(cap)" :key="'cap-' + cap"
class="tag tag-capability" :title="$t('settings.tagTooltipCapability')">
{{ $t('settings.tagCapability.' + cap) }}<span class="tag-remove" role="button" tabindex="0" :aria-label="$t('common.delete')" @click.stop="removeCapability(m, cap)" @keydown.enter.prevent="removeCapability(m, cap)" @keydown.space.prevent="removeCapability(m, cap)">×</span>
</span>
<span v-if="m.probe_source && m.probe_source !== 'user_set'" v-show="!redundantTags.sources.has(m.probe_source)"
class="tag tag-source" :title="$t('settings.tagTooltipSource')">{{ $t('settings.tagSource.' + m.probe_source) }}</span>
<span v-if="m.probe_source === 'user_set'" class="tag tag-source" :title="$t('settings.tagTooltipSource')">{{ $t('settings.tagSource.user_set') }}</span>
<span class="tag-add" role="button" tabindex="0" :title="$t('settings.addTagTitle')" :aria-label="$t('settings.addTagTitle')" @click.stop="startAddTag(m)" @keydown.enter.prevent="startAddTag(m)" @keydown.space.prevent="startAddTag(m)">+</span>
</div>
<!-- 添加能力内联菜单(点+展开;选未有的能力/模态即添加) -->
<div v-if="addingTagModel === m.model_id" class="add-tag-menu">
<span v-for="opt in addableTags(m)" :key="opt.kind + '-' + opt.key"
class="tag" :class="opt.kind === 'modality' ? 'tag-modality' : 'tag-capability'"
@click.stop="addTag(m, opt.key, opt.kind)">{{ opt.label }}</span>
<span v-if="addableTags(m).length === 0" class="add-tag-empty">{{ $t('settings.addTagNone') }}</span>
</div>
</td>
<td class="col-weight">
<input type="number" class="setting-input setting-input--sm" min="0" max="100" v-model.number="m.weight" />
</td>
</tr>
</tbody>
</table>
<div class="model-list-hint">{{ $t('settings.modelListHint') }}</div> <div class="model-list-hint">{{ $t('settings.modelListHint') }}</div>
<!-- M32: 模型列表 enabled/weight 改了未保存时显提示(关闭/切走将丢弃) --> <!-- M32: 模型列表 enabled/weight 改了未保存时显提示(关闭/切走将丢弃) -->
<div v-if="isFormDirty" class="model-list-unsaved-hint">{{ $t('settings.modelListUnsavedHint') }}</div> <div v-if="isFormDirty" class="model-list-unsaved-hint">{{ $t('settings.modelListUnsavedHint') }}</div>
@@ -205,11 +110,17 @@
import { reactive, ref, computed, onMounted, useTemplateRef } from 'vue' import { reactive, ref, computed, onMounted, useTemplateRef } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { aiApi } from '@/api' import { aiApi } from '@/api'
import type { AiProviderConfig, ModelConfig, Modality, Capability, ProbeSource } from '@/api/types' import type { AiProviderConfig, ModelConfig } from '@/api/types'
import { PROVIDER_PRESETS, CUSTOM_PRESET_ID, findPreset } from './providerPresets' import { PROVIDER_PRESETS, CUSTOM_PRESET_ID, findPreset } from './providerPresets'
import ProviderList from './provider-panel/provider-list.vue'
import ModelTable from './provider-panel/model-table.vue'
// ============================================================ // ============================================================
// AI 提供商域 — 真实后端 CRUD + c 负载均衡池(enabled / weight) // AI 提供商域 — 真实后端 CRUD + c 负载均衡池(enabled / weight)
// C4c 拆分:卡片列表+池控件 → provider-panel/provider-list.vue;
// 模型表格+能力标签标注 → provider-panel/model-table.vue。
// 本件保留:表单状态机(校验红框/温度与权重钳制/快照脏判)、保存/测试连接/预设回填、
// 列表 CRUD 与 loadProviders 闭环、对壳 defineExpose 契约。
// ============================================================ // ============================================================
const { t } = useI18n() const { t } = useI18n()
@@ -286,37 +197,7 @@ const providerForm = reactive({
savedSnapshot: '' as string, savedSnapshot: '' as string,
}) })
/** // (冗余标签判定 redundantTags 随模型表格拆至 provider-panel/model-table.vue)
* 冗余标签判定:全模型共有的 modality/capability/probe_source 无区分度,
* 每行都渲染会刷屏(如全部命中预设表 → 全是「预设」;对话模型默认 ToolUse → 全是「工具调用」)。
* 计算「所有模型都含」的值集合,模板渲染时跳过 → 只显示有区分度的标签。
*/
const redundantTags = computed(() => {
const models = providerForm.models
// SA-6: 去冗余的前提是「模型间对比」——仅 1 个模型时它的所有标签都满足「全模型共有」,
// 无脑隐藏会把唯一模型的能力标签全抹掉(行内空白,用户看不到该模型能力)。
// 故 ≥2 个模型起才去冗余;0/1 个一律全显(sources 分支本就 <2 直接放行,此处对齐)。
if (models.length < 2) return { modalities: new Set<string>(), capabilities: new Set<string>(), sources: new Set<string>() }
const common = (pick: (m: ModelConfig) => string[]) => {
const sets = models.map(m => new Set(pick(m)))
const first = sets[0]
const result = new Set<string>()
for (const v of first) {
if (sets.every(s => s.has(v))) result.add(v)
}
return result
}
return {
modalities: common(m => m.modalities),
capabilities: common(m => m.capabilities),
// 探测来源:全模型相同的值也冗余(如全 PresetTable)
sources: (() => {
const vals = models.map(m => m.probe_source).filter((v): v is ProbeSource => !!v)
if (vals.length < 2) return new Set<string>()
return new Set([...new Set(vals)].filter(v => vals.every(x => x === v)))
})(),
}
})
/** /**
* L19/M32: 表单脏判定——当前表单状态与已落库快照不一致即脏。 * L19/M32: 表单脏判定——当前表单状态与已落库快照不一致即脏。
@@ -349,59 +230,7 @@ function formBusinessSnapshot(): string {
}) })
} }
// ============================================================ // (模型能力手动标注 tag 编辑块随模型表格拆至 provider-panel/model-table.vue)
// 模型能力手动标注(表格内编辑 tags;改动即标 UserSet,手动优先)
// ============================================================
/** 当前展开「添加能力」菜单的模型名;null=无展开 */
const addingTagModel = ref<string | null>(null)
/** 可添加的模态(与 tagModality 对齐;text 是对话基础模态,允许删但一般不主动加) */
const ADDABLE_MODALITIES: Modality[] = ['text', 'vision', 'audio', 'video']
/** 可添加的能力 */
const ADDABLE_CAPABILITIES: Capability[] = ['tool_use', 'embedding', 'code_gen']
/** 某模型可添加的可选 tag(模态 + 能力,排除已选的) */
function addableTags(m: ModelConfig): { key: string; kind: 'modality' | 'capability'; label: string }[] {
const mods = ADDABLE_MODALITIES
.filter(x => !m.modalities.includes(x))
.map(x => ({ key: x, kind: 'modality' as const, label: t('settings.tagModality.' + x) }))
const caps = ADDABLE_CAPABILITIES
.filter(x => !m.capabilities.includes(x))
.map(x => ({ key: x, kind: 'capability' as const, label: t('settings.tagCapability.' + x) }))
return [...mods, ...caps]
}
/** 标记模型为「手动标注」(probe_source=user_set),下次探测不覆盖 */
function markManual(m: ModelConfig) {
m.probe_source = 'user_set'
addingTagModel.value = null
}
function removeModality(m: ModelConfig, md: Modality) {
m.modalities = m.modalities.filter(x => x !== md)
markManual(m)
}
function removeCapability(m: ModelConfig, cap: Capability) {
m.capabilities = m.capabilities.filter(x => x !== cap)
markManual(m)
}
function addTag(m: ModelConfig, key: string, kind: 'modality' | 'capability') {
if (kind === 'modality') {
const md = key as Modality
if (!m.modalities.includes(md)) m.modalities = [...m.modalities, md]
} else {
const cap = key as Capability
if (!m.capabilities.includes(cap)) m.capabilities = [...m.capabilities, cap]
}
markManual(m)
}
function startAddTag(m: ModelConfig) {
addingTagModel.value = addingTagModel.value === m.model_id ? null : m.model_id
}
/** /**
* L19: 关闭表单入口——脏表单二次确认,清表单后关闭。 * L19: 关闭表单入口——脏表单二次确认,清表单后关闭。
@@ -677,64 +506,15 @@ async function setDefaultProvider(id: string) {
} }
} }
// ============================================================ // (负载均衡池 enabled/weight 即时 IPC 块随卡片列表拆至 provider-panel/provider-list.vue)
// c: 负载均衡池可编辑层(enabled / weight)
// 卡片即时调 IPC(对齐 syncConcurrencyConfig 模式);落库后后端 reload_provider_caps
// 重建 per_provider caps,下条消息即按新配置 acquire。
// 不走 saveProvider(全量 INSERT OR REPLACE 会触发 R-PD-1 密钥迁移分支,与 c 轻量 UPDATE 路径冲突)。
// ============================================================
// 计时器按 provider id 分键:单例计时器下 300ms 内先后改两家权重,B 的变更会清掉
// A 尚未落库的保存,先改的一方静默丢失(走查 P2-8)。
const _poolTimers = new Map<string, ReturnType<typeof setTimeout>>()
/** /** 子件 toast 上抛中继(池控件 IPC 结果反馈) */
* toggle 即时生效(开关语义=立即入/出池,无 debounce 必要;但失败需回滚视图)。 function relayToast(msg: string, type: 'error' | 'warning' | 'info' | 'success') {
* 乐观更新本地数组,失败 revert + toast。 emit('toast', msg, type)
*/
async function onPoolToggle(p: AiProviderConfig, enabled: boolean) {
const prev = p.enabled
p.enabled = enabled
try {
// 防御钳制:p.weight 理论上已被 onPoolWeightChange 钳过,此处兜底防脏数据直传 IPC
const w = Math.min(100, Math.max(0, p.weight ?? 50))
await aiApi.updateProviderPool(p.id, enabled, w)
emit('toast', t('settings.toastPoolUpdateOk'), 'info')
} catch (e) {
p.enabled = prev // revert
console.error(t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), e)
emit('toast', t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), 'error')
}
} }
/** /** 卡片列表子件引用(池 debounce 计时器下沉子件,卸载清理经此委托) */
* weight 变更 debounce 300ms(防快速连续输入触发频繁 IPC),clamp [0,100] 对齐后端。 const providerListRef = useTemplateRef<InstanceType<typeof ProviderList>>('providerListRef')
* 双 clamp:前端 clamp 视觉输入 + 后端 command 再 clamp(防御性)。
*/
function onPoolWeightChange(p: AiProviderConfig, raw: number) {
// NaN 兜底(清空输入):回退 50,防 IPC 传 NaN 后端 serde u32 失败
const clamped = Math.min(100, Math.max(0, Number.isFinite(raw) ? Math.trunc(raw) : 50))
const prev = p.weight
p.weight = clamped
// 仅重置同一 provider 的待发计时;跨 provider 互不干扰
const prevTimer = _poolTimers.get(p.id)
if (prevTimer) clearTimeout(prevTimer)
_poolTimers.set(p.id, setTimeout(async () => {
_poolTimers.delete(p.id)
try {
await aiApi.updateProviderPool(p.id, p.enabled !== false, clamped)
emit('toast', t('settings.toastPoolUpdateOk'), 'info')
} catch (e) {
p.weight = prev // revert
console.error(t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), e)
emit('toast', t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), 'error')
}
}, 300))
}
function maskKey(key: string): string {
if (!key || key.length < 8) return '••••••••'
return key.slice(0, 4) + '••••••••' + key.slice(-4)
}
/** 暴露给 shell:loadProviders 供外部主动刷新 / Knowledge 读 aiProviders / 卸载清 timer。 /** 暴露给 shell:loadProviders 供外部主动刷新 / Knowledge 读 aiProviders / 卸载清 timer。
* L19: isFormDirty + closeProviderForm 暴露,供外部(如导航切走前)查询/触发拦截。 * L19: isFormDirty + closeProviderForm 暴露,供外部(如导航切走前)查询/触发拦截。
@@ -744,7 +524,7 @@ defineExpose({
loadProviders, loadProviders,
isFormDirty, isFormDirty,
closeProviderForm, closeProviderForm,
clearPoolTimer() { for (const t of _poolTimers.values()) clearTimeout(t); _poolTimers.clear() }, clearPoolTimer() { providerListRef.value?.clearPoolTimer() },
}) })
// 阶段3 UX 重构:本面板改为 ai-model 类懒挂载,不再由 Settings.vue onMounted 调用, // 阶段3 UX 重构:本面板改为 ai-model 类懒挂载,不再由 Settings.vue onMounted 调用,
@@ -754,92 +534,24 @@ onMounted(loadProviders)
<style scoped> <style scoped>
/* 阶段1/3 UX 重构:panel/panel-header/empty-hint/btn 系列/setting-select/ /* 阶段1/3 UX 重构:panel/panel-header/empty-hint/btn 系列/setting-select/
setting-input/toggle/toggle-slider 已迁移到 settings.css 全局。 setting-input/toggle/toggle-slider 已迁移到 settings.css 全局,btn-link 已并轨 global.css。
本 scoped 仅保留 ProviderPanel 特有样式:provider-card/default-badge/ C4c 拆分:provider 卡片/池控件样式随 provider-list.vue、模型表格/标签样式随
pool-badge/detail 系列/form 系列/btn-link/toggle--sm 及输入控件布局覆盖等。 model-table.vue 下沉子件;本 scoped 仅保留表单区样式(form 系列/红框/错误横幅/
模型列表区容器与提示行)。.setting-input--sm/.toggle--sm 为两子件共用,各持一份。
注:注释列举类名时勿写星斜杠序列(会提前闭合 CSS 注释)。 */ 注:注释列举类名时勿写星斜杠序列(会提前闭合 CSS 注释)。 */
/* ===== 链接按钮(本面板特有,未进全局) ===== */ /* 表单(本面板特有输入控件样式;.setting-select 走全局)。
.btn-link { background: none; border: none; color: var(--df-accent); font-size: 12px; cursor: pointer; padding: 2px 6px; } --form-label-w 为标签列宽单一来源:hint 缩进用 calc(label 列宽+行 gap) 对齐 input 位,
.btn-link:hover { text-decoration: underline; } 免手算魔法数。 */
.btn-link-danger { color: var(--df-danger); } .form-grid { --form-label-w: 72px; display: flex; flex-direction: column; gap: 14px; }
/* ===== Provider 卡片 ===== */
.provider-list { display: flex; flex-direction: column; gap: 12px; }
.provider-card {
background: var(--df-bg);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius);
padding: 14px 16px;
}
.provider-card--default {
border-color: var(--df-accent);
box-shadow: inset 3px 0 0 var(--df-accent);
}
.provider-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.provider-info { display: flex; align-items: center; gap: 8px; }
.provider-name { font-size: 14px; font-weight: 500; color: var(--df-text); }
.default-badge {
font-size: 10px;
padding: 1px 6px;
border-radius: var(--df-radius-xs);
background: rgba(100,255,218,0.15);
color: var(--df-success);
font-weight: 500;
}
.provider-actions { display: flex; gap: 4px; }
.provider-detail { display: flex; flex-direction: column; gap: 6px; }
.detail-row { display: flex; align-items: flex-start; gap: 12px; }
.detail-label {
font-size: 12px;
color: var(--df-text-dim);
min-width: 60px;
}
.detail-value {
font-size: 12px;
color: var(--df-text-secondary);
font-family: var(--df-font-mono);
}
.detail-value.mask { color: var(--df-text-dim); letter-spacing: 1px; }
/* Provider 卡片 disabled 态(c:enabled=false 视觉弱化) */
.provider-card--disabled { opacity: 0.6; }
.pool-badge {
font-size: 10px;
padding: 1px 6px;
border-radius: var(--df-radius-xs);
background: rgba(255,107,107,0.15);
color: var(--df-danger);
font-weight: 500;
}
/* 负载均衡池行(toggle / weight 控件) */
.detail-row--pool { align-items: center; }
.detail-value--control { display: flex; align-items: center; gap: 8px; font-family: var(--df-font-mono); }
.pool-weight-hint { font-size: 11px; color: var(--df-text-dim); }
/* 表单(本面板特有输入控件样式;.setting-select 走全局) */
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-field { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; } .form-field { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.form-label { flex: 0 0 72px; font-size: 12px; font-weight: 500; color: var(--df-text-secondary); text-align: right; } .form-label { flex: 0 0 var(--form-label-w); font-size: 12px; font-weight: 500; color: var(--df-text-secondary); text-align: right; }
/* 字段级辅助说明(默认模型提示等):弱化色 + 小字,与 label/input 区分层级。 /* 字段级辅助说明(默认模型提示等):弱化色 + 小字,与 label/input 区分层级。
横向布局下占满整行换到 label+input 下方。 */ 横向布局下占满整行换到 label+input 下方,缩进与 input 左缘结构对齐。 */
.form-field-hint { flex-basis: 100%; margin-left: 82px; font-size: 11px; color: var(--df-text-dim); line-height: 1.5; } .form-field-hint { flex-basis: 100%; margin-left: calc(var(--form-label-w) + 10px); font-size: 11px; color: var(--df-text-dim); line-height: 1.5; }
.form-actions { display: flex; justify-content: flex-end; padding-top: 4px; } .form-actions { display: flex; justify-content: flex-end; padding-top: 4px; }
/* 保存失败持久错误横幅(常驻 form-actions 上方,醒目于自隐 toast) */ /* 保存失败持久错误横幅:视觉(底色/边/圆角/内距)走全局 .df-note--danger,此处仅留内部排版 */
.save-error-banner {
background: var(--df-danger-bg);
border: 0.5px solid var(--df-danger);
border-radius: var(--df-radius-sm);
padding: 10px 12px;
}
.save-error-msg { .save-error-msg {
margin: 0; margin: 0;
font-family: var(--df-font-sans); font-family: var(--df-font-sans);
@@ -860,12 +572,6 @@ onMounted(loadProviders)
/* 走查 P3-10:校验缺失字段红框(@input 即清,用户开始修正就不再红) */ /* 走查 P3-10:校验缺失字段红框(@input 即清,用户开始修正就不再红) */
.setting-input--invalid { border-color: var(--df-danger) !important; } .setting-input--invalid { border-color: var(--df-danger) !important; }
.setting-input--invalid:focus { border-color: var(--df-danger) !important; box-shadow: 0 0 0 1px var(--df-danger); } .setting-input--invalid:focus { border-color: var(--df-danger) !important; box-shadow: 0 0 0 1px var(--df-danger); }
.setting-input--sm { flex: 0 0 auto; min-width: 0; width: 70px; padding: 4px 8px; font-size: 12px; }
/* Toggle 小号变体(本面板负载均衡池用;.toggle 基础走全局) */
.toggle--sm { width: 32px; height: 18px; }
.toggle--sm .toggle-slider::before { width: 12px; height: 12px; left: 3px; bottom: 3px; }
.toggle--sm input:checked + .toggle-slider::before { transform: translateX(14px); }
/* M32: 模型列表有未保存调整时的提示(弱 warning 色,贴合 model-list-hint 之下) */ /* M32: 模型列表有未保存调整时的提示(弱 warning 色,贴合 model-list-hint 之下) */
.model-list-unsaved-hint { .model-list-unsaved-hint {
@@ -874,86 +580,6 @@ onMounted(loadProviders)
line-height: 1.5; line-height: 1.5;
color: var(--df-warning); color: var(--df-warning);
} }
/* ===== 模型列表(表格形式:表头 + 数据行) =====
原 model-list/model-row 等无任何样式定义(裸渲染),本批补齐并改为表格。
风格对齐 provider-card(浅底 / 圆角 / 0.5px 边框)。 */
.model-table {
width: 100%;
border-collapse: collapse;
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius);
overflow: hidden;
font-size: 12px;
}
.model-table th,
.model-table td {
padding: 8px 12px;
text-align: left;
vertical-align: middle;
}
.model-table thead th {
background: var(--df-bg);
font-weight: 500;
color: var(--df-text-dim);
font-size: 11px;
border-bottom: 0.5px solid var(--df-border);
white-space: nowrap;
}
.model-table tbody tr { border-bottom: 0.5px solid var(--df-border); }
.model-table tbody tr:last-child { border-bottom: none; }
.model-table tbody tr:hover { background: var(--df-accent-bg); }
/* 列宽:启用窄、模型/能力弹性、权重窄 */
.model-table .col-enabled { width: 56px; text-align: center; }
.model-table .col-weight { width: 110px; }
.model-table .col-model { min-width: 140px; }
.col-enabled .toggle--sm { display: inline-block; }
.model-id {
font-size: 13px;
font-family: var(--df-font-mono);
color: var(--df-text);
font-weight: 500;
word-break: break-all;
}
/* 标签列:小圆角 chip,三类语义色区分 */
.model-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
font-size: 10px;
padding: 1px 6px;
border-radius: var(--df-radius-xs);
font-weight: 500;
white-space: nowrap;
}
.tag-modality { background: rgba(100,181,246,0.15); color: var(--df-info); }
.tag-capability { background: rgba(108,99,255,0.15); color: var(--df-accent); }
.tag-source { background: rgba(90,99,128,0.2); color: var(--df-text-dim); }
/* 可编辑 tag:×删除按钮(悬停显红)+ 添加按钮 */
.tag-remove { margin-left: 3px; cursor: pointer; opacity: 0.6; font-weight: 700; }
.tag-remove:hover { opacity: 1; color: var(--df-danger); }
.tag-add {
cursor: pointer;
background: transparent;
border: 1px dashed var(--df-border);
color: var(--df-text-dim);
font-weight: 700;
}
.tag-add:hover { border-color: var(--df-accent); color: var(--df-accent); }
/* 添加能力内联菜单(点+展开):浅底容器包可选 tag */
.add-tag-menu {
margin-top: 4px;
padding: 4px;
display: flex;
flex-wrap: wrap;
gap: 4px;
background: var(--df-bg);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm);
}
.add-tag-menu .tag { cursor: pointer; }
.add-tag-menu .tag:hover { filter: brightness(1.2); }
.add-tag-empty { font-size: 10px; color: var(--df-text-dim); padding: 2px 4px; }
/* 权重输入框:表格内固定窄宽 */
.model-table .setting-input--sm { width: 64px; }
.model-list-hint { .model-list-hint {
margin-top: 8px; margin-top: 8px;
font-size: 11px; font-size: 11px;
+4 -2
View File
@@ -115,10 +115,12 @@ async function save() {
<style scoped> <style scoped>
/* panel/panel-header/btn 系列/setting-input 均在 settings.css 全局,此处仅本面板特有样式 */ /* panel/panel-header/btn 系列/setting-input 均在 settings.css 全局,此处仅本面板特有样式 */
.uclaw-settings { display: flex; flex-direction: column; gap: 4px; } .uclaw-settings { display: flex; flex-direction: column; gap: 4px; }
.uclaw-input { width: 320px; font-family: var(--df-font-mono, monospace); } /* 定宽输入补 max-width,窄窗收缩防横向溢出 */
.uclaw-input { width: 320px; max-width: 100%; font-family: var(--df-font-mono, monospace); }
/* 原 var(--df-text-tertiary) 为幽灵 token(全 styles 未定义,渲染成继承色),改用已定义的弱化色 */
.uclaw-hint { .uclaw-hint {
font-size: 11px; font-size: 11px;
color: var(--df-text-tertiary); color: var(--df-text-dim);
line-height: 1.6; line-height: 1.6;
margin-top: 4px; margin-top: 4px;
white-space: pre-line; white-space: pre-line;
+2 -1
View File
@@ -145,7 +145,8 @@ function onPollSecsChange(raw: string) {
<style scoped> <style scoped>
/* panel/panel-header/toggle/setting-input 均在 settings.css 全局,此处仅本面板特有样式 */ /* panel/panel-header/toggle/setting-input 均在 settings.css 全局,此处仅本面板特有样式 */
.unattended-settings { display: flex; flex-direction: column; gap: 4px; } .unattended-settings { display: flex; flex-direction: column; gap: 4px; }
.unattended-input { width: 280px; } /* 定宽输入补 max-width,窄窗收缩防横向溢出(--num 变体继承同款收缩) */
.unattended-input { width: 280px; max-width: 100%; }
.unattended-input--num { width: 110px; } .unattended-input--num { width: 110px; }
.unattended-radios { display: flex; gap: 16px; flex-wrap: wrap; } .unattended-radios { display: flex; gap: 16px; flex-wrap: wrap; }
.unattended-radio { .unattended-radio {
@@ -0,0 +1,249 @@
<template>
<!-- 拉取到的模型列表表格(F-01 阶段6)。自 ProviderPanel 拆出(C4c 纯搬迁):
表格渲染 + 能力/模态标签手动标注(改动即标 UserSet)自治在本件。
models 为主文件 providerForm.models 的引用,行内 v-model/标签增删直接改
item 字段(共享响应式对象),脏态由主文件 isFormDirty 统一比对。 -->
<table class="model-table">
<thead>
<tr>
<th class="col-enabled">{{ $t('settings.colEnabled') }}</th>
<th class="col-model">{{ $t('settings.colModel') }}</th>
<th class="col-ability">{{ $t('settings.colAbility') }}</th>
<th class="col-weight">{{ $t('settings.labelWeight') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="m in models" :key="m.model_id">
<td class="col-enabled">
<label class="toggle toggle--sm">
<input type="checkbox" v-model="m.enabled" />
<span class="toggle-slider"></span>
</label>
</td>
<td class="col-model">
<span class="model-id">{{ m.model_id }}</span>
</td>
<td class="col-ability">
<!-- 能力/模态标签(可编辑:点 × 删除;点 + 添加;手动改后标为「手动」) -->
<div class="model-tags">
<span v-for="md in m.modalities" v-show="!redundantTags.modalities.has(md)" :key="'md-' + md"
class="tag tag-modality" :title="$t('settings.tagTooltipModality')">
{{ $t('settings.tagModality.' + md) }}<span class="tag-remove" role="button" tabindex="0" :aria-label="$t('common.delete')" @click.stop="removeModality(m, md)" @keydown.enter.prevent="removeModality(m, md)" @keydown.space.prevent="removeModality(m, md)">×</span>
</span>
<span v-for="cap in m.capabilities" v-show="!redundantTags.capabilities.has(cap)" :key="'cap-' + cap"
class="tag tag-capability" :title="$t('settings.tagTooltipCapability')">
{{ $t('settings.tagCapability.' + cap) }}<span class="tag-remove" role="button" tabindex="0" :aria-label="$t('common.delete')" @click.stop="removeCapability(m, cap)" @keydown.enter.prevent="removeCapability(m, cap)" @keydown.space.prevent="removeCapability(m, cap)">×</span>
</span>
<span v-if="m.probe_source && m.probe_source !== 'user_set'" v-show="!redundantTags.sources.has(m.probe_source)"
class="tag tag-source" :title="$t('settings.tagTooltipSource')">{{ $t('settings.tagSource.' + m.probe_source) }}</span>
<span v-if="m.probe_source === 'user_set'" class="tag tag-source" :title="$t('settings.tagTooltipSource')">{{ $t('settings.tagSource.user_set') }}</span>
<span class="tag-add" role="button" tabindex="0" :title="$t('settings.addTagTitle')" :aria-label="$t('settings.addTagTitle')" @click.stop="startAddTag(m)" @keydown.enter.prevent="startAddTag(m)" @keydown.space.prevent="startAddTag(m)">+</span>
</div>
<!-- 添加能力内联菜单(点+展开;选未有的能力/模态即添加) -->
<div v-if="addingTagModel === m.model_id" class="add-tag-menu">
<span v-for="opt in addableTags(m)" :key="opt.kind + '-' + opt.key"
class="tag" :class="opt.kind === 'modality' ? 'tag-modality' : 'tag-capability'"
@click.stop="addTag(m, opt.key, opt.kind)">{{ opt.label }}</span>
<span v-if="addableTags(m).length === 0" class="add-tag-empty">{{ $t('settings.addTagNone') }}</span>
</div>
</td>
<td class="col-weight">
<input type="number" class="setting-input setting-input--sm" min="0" max="100" v-model.number="m.weight" />
</td>
</tr>
</tbody>
</table>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { useI18n } from 'vue-i18n'
import type { ModelConfig, Modality, Capability, ProbeSource } from '@/api/types'
// ============================================================
// 模型能力手动标注(表格内编辑 tags;改动即标 UserSet,手动优先)
// —— 原 ProviderPanel 整块搬迁(C4c 纯搬迁,共享函数不新造)。
// ============================================================
const { t } = useI18n()
const props = defineProps<{
/** 主文件 providerForm.models 引用(行内直改 item 字段,保存闭环留主文件 saveProvider) */
models: ModelConfig[]
}>()
/**
* 冗余标签判定:全模型共有的 modality/capability/probe_source 无区分度,
* 每行都渲染会刷屏(如全部命中预设表 → 全是「预设」;对话模型默认 ToolUse → 全是「工具调用」)。
* 计算「所有模型都含」的值集合,模板渲染时跳过 → 只显示有区分度的标签。
*/
const redundantTags = computed(() => {
const models = props.models
// SA-6: 去冗余的前提是「模型间对比」——仅 1 个模型时它的所有标签都满足「全模型共有」,
// 无脑隐藏会把唯一模型的能力标签全抹掉(行内空白,用户看不到该模型能力)。
// 故 ≥2 个模型起才去冗余;0/1 个一律全显(sources 分支本就 <2 直接放行,此处对齐)。
if (models.length < 2) return { modalities: new Set<string>(), capabilities: new Set<string>(), sources: new Set<string>() }
const common = (pick: (m: ModelConfig) => string[]) => {
const sets = models.map(m => new Set(pick(m)))
const first = sets[0]
const result = new Set<string>()
for (const v of first) {
if (sets.every(s => s.has(v))) result.add(v)
}
return result
}
return {
modalities: common(m => m.modalities),
capabilities: common(m => m.capabilities),
// 探测来源:全模型相同的值也冗余(如全 PresetTable)
sources: (() => {
const vals = models.map(m => m.probe_source).filter((v): v is ProbeSource => !!v)
if (vals.length < 2) return new Set<string>()
return new Set([...new Set(vals)].filter(v => vals.every(x => x === v)))
})(),
}
})
/** 当前展开「添加能力」菜单的模型名;null=无展开 */
const addingTagModel = ref<string | null>(null)
/** 可添加的模态(与 tagModality 对齐;text 是对话基础模态,允许删但一般不主动加) */
const ADDABLE_MODALITIES: Modality[] = ['text', 'vision', 'audio', 'video']
/** 可添加的能力 */
const ADDABLE_CAPABILITIES: Capability[] = ['tool_use', 'embedding', 'code_gen']
/** 某模型可添加的可选 tag(模态 + 能力,排除已选的) */
function addableTags(m: ModelConfig): { key: string; kind: 'modality' | 'capability'; label: string }[] {
const mods = ADDABLE_MODALITIES
.filter(x => !m.modalities.includes(x))
.map(x => ({ key: x, kind: 'modality' as const, label: t('settings.tagModality.' + x) }))
const caps = ADDABLE_CAPABILITIES
.filter(x => !m.capabilities.includes(x))
.map(x => ({ key: x, kind: 'capability' as const, label: t('settings.tagCapability.' + x) }))
return [...mods, ...caps]
}
/** 标记模型为「手动标注」(probe_source=user_set),下次探测不覆盖 */
function markManual(m: ModelConfig) {
m.probe_source = 'user_set'
addingTagModel.value = null
}
function removeModality(m: ModelConfig, md: Modality) {
m.modalities = m.modalities.filter(x => x !== md)
markManual(m)
}
function removeCapability(m: ModelConfig, cap: Capability) {
m.capabilities = m.capabilities.filter(x => x !== cap)
markManual(m)
}
function addTag(m: ModelConfig, key: string, kind: 'modality' | 'capability') {
if (kind === 'modality') {
const md = key as Modality
if (!m.modalities.includes(md)) m.modalities = [...m.modalities, md]
} else {
const cap = key as Capability
if (!m.capabilities.includes(cap)) m.capabilities = [...m.capabilities, cap]
}
markManual(m)
}
function startAddTag(m: ModelConfig) {
addingTagModel.value = addingTagModel.value === m.model_id ? null : m.model_id
}
</script>
<style scoped>
/* 自 ProviderPanel scoped 拆出(C4c 纯搬迁):模型表格/标签样式随区块走;
.setting-input--sm 与 .toggle--sm 为本件与 provider-list 子件共用,两处各持一份
(scoped 不跨组件,全局化去重留待后续统一处理)。 */
/* ===== 模型列表(表格形式:表头 + 数据行) =====
原 model-list/model-row 等无任何样式定义(裸渲染),本批补齐并改为表格。
风格对齐 provider-card(浅底 / 圆角 / 0.5px 边框)。 */
.model-table {
width: 100%;
border-collapse: collapse;
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius);
overflow: hidden;
font-size: 12px;
}
.model-table th,
.model-table td {
padding: 8px 12px;
text-align: left;
vertical-align: middle;
}
.model-table thead th {
background: var(--df-bg);
font-weight: 500;
color: var(--df-text-dim);
font-size: 11px;
border-bottom: 0.5px solid var(--df-border);
white-space: nowrap;
}
.model-table tbody tr { border-bottom: 0.5px solid var(--df-border); }
.model-table tbody tr:last-child { border-bottom: none; }
.model-table tbody tr:hover { background: var(--df-accent-bg); }
/* 列宽:启用窄、模型/能力弹性、权重窄 */
.model-table .col-enabled { width: 56px; text-align: center; }
.model-table .col-weight { width: 110px; }
.model-table .col-model { min-width: 140px; }
.col-enabled .toggle--sm { display: inline-block; }
.model-id {
font-size: 13px;
font-family: var(--df-font-mono);
color: var(--df-text);
font-weight: 500;
word-break: break-all;
}
/* 标签列:小圆角 chip,三类语义色区分 */
.model-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
font-size: 10px;
padding: 1px 6px;
border-radius: var(--df-radius-xs);
font-weight: 500;
white-space: nowrap;
}
.tag-modality { background: var(--df-info-bg); color: var(--df-info); }
.tag-capability { background: var(--df-accent-soft); color: var(--df-accent); }
.tag-source { background: var(--df-neutral-bg); color: var(--df-text-dim); }
/* 可编辑 tag:×删除按钮(悬停显红)+ 添加按钮 */
.tag-remove { margin-left: 3px; cursor: pointer; opacity: 0.6; font-weight: 700; }
.tag-remove:hover { opacity: 1; color: var(--df-danger); }
.tag-add {
cursor: pointer;
background: transparent;
border: 1px dashed var(--df-border);
color: var(--df-text-dim);
font-weight: 700;
}
.tag-add:hover { border-color: var(--df-accent); color: var(--df-accent); }
/* 添加能力内联菜单(点+展开):浅底容器包可选 tag */
.add-tag-menu {
margin-top: 4px;
padding: 4px;
display: flex;
flex-wrap: wrap;
gap: 4px;
background: var(--df-bg);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm);
}
.add-tag-menu .tag { cursor: pointer; }
.add-tag-menu .tag:hover { filter: brightness(1.2); }
.add-tag-empty { font-size: 10px; color: var(--df-text-dim); padding: 2px 4px; }
/* 权重输入框:表格内固定窄宽 */
.model-table .setting-input--sm { width: 64px; }
/* 行内窄输入(权重等):定高 26px 档(--df-h-input),与 .setting-input 主体高度齐平 */
.setting-input--sm { flex: 0 0 auto; min-width: 0; width: 70px; height: var(--df-h-input); padding: 4px 8px; font-size: 12px; }
/* Toggle 小号变体(表格启用开关用;.toggle 基础走全局) */
.toggle--sm { width: 32px; height: 18px; }
.toggle--sm .toggle-slider::before { width: 12px; height: 12px; left: 3px; bottom: 3px; }
.toggle--sm input:checked + .toggle-slider::before { transform: translateX(14px); }
</style>
@@ -0,0 +1,213 @@
<template>
<!-- provider 卡片列表。自 ProviderPanel 拆出(C4c 纯搬迁):
卡片渲染 + 负载均衡池控件(enabled/weight 即时 IPC)自治在本件,
增删改/设默认经 emit 上抛主文件(共享 loadProviders 闭环)。 -->
<div class="provider-list">
<div class="provider-card" :class="{ 'provider-card--default': p.is_default, 'provider-card--disabled': p.enabled === false }" v-for="p in providers" :key="p.id">
<div class="provider-top">
<div class="provider-info">
<span class="provider-name">{{ p.name }}</span>
<span v-if="p.is_default" class="default-badge">{{ $t('settings.badgeDefault') }}</span>
<span v-if="p.enabled === false" class="pool-badge">{{ $t('settings.badgePoolDisabled') }}</span>
</div>
<div class="provider-actions">
<button class="btn-link" @click="emit('set-default', p.id)" v-if="!p.is_default">{{ $t('settings.actionSetDefault') }}</button>
<button class="btn-link" @click="emit('edit', p)">{{ $t('common.edit') }}</button>
<button class="btn-link btn-link-danger" @click="emit('delete', p.id)">{{ $t('common.delete') }}</button>
</div>
</div>
<div class="provider-detail">
<div class="detail-row">
<span class="detail-label">{{ $t('settings.detailBaseUrl') }}</span>
<span class="detail-value">{{ p.base_url }}</span>
</div>
<div class="detail-row">
<span class="detail-label">{{ $t('settings.detailModel') }}</span>
<span class="detail-value">{{ p.default_model }}</span>
</div>
<div class="detail-row">
<span class="detail-label">{{ $t('settings.detailApiKey') }}</span>
<span class="detail-value mask">{{ maskKey(p.api_key) }}</span>
</div>
<!-- F-260614-04c 负载均衡池:enabled toggle + weight 即时调 IPC,落库即重建 caps -->
<div class="detail-row detail-row--pool">
<span class="detail-label" :title="$t('settings.descPoolEnabled')">{{ $t('settings.detailPoolEnabled') }}</span>
<div class="detail-value detail-value--control">
<label class="toggle toggle--sm" :title="$t('settings.descPoolEnabled')">
<input type="checkbox" :checked="p.enabled !== false" @change="onPoolToggle(p, ($event.target as HTMLInputElement).checked)" />
<span class="toggle-slider"></span>
</label>
</div>
</div>
<div class="detail-row detail-row--pool" v-if="p.enabled !== false">
<span class="detail-label" :title="$t('settings.descPoolWeight')">{{ $t('settings.detailPoolWeight') }}</span>
<div class="detail-value detail-value--control">
<input type="number" class="setting-input setting-input--sm" min="0" max="100"
:value="p.weight ?? 50"
@change="onPoolWeightChange(p, ($event.target as HTMLInputElement).valueAsNumber)" />
<span class="pool-weight-hint">0-100</span>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { aiApi } from '@/api'
import type { AiProviderConfig } from '@/api/types'
// ============================================================
// c: 负载均衡池可编辑层(enabled / weight)——原 ProviderPanel 整块搬迁
// 卡片即时调 IPC(对齐 syncConcurrencyConfig 模式);落库后后端 reload_provider_caps
// 重建 per_provider caps,下条消息即按新配置 acquire。
// 不走 saveProvider(全量 INSERT OR REPLACE 会触发 R-PD-1 密钥迁移分支,与 c 轻量 UPDATE 路径冲突)。
// ============================================================
const { t } = useI18n()
defineProps<{
/** 主文件 aiProviders 引用;池控件直接改 item 字段(共享响应式对象,乐观更新),列表整体替换仍由主文件驱动 */
providers: AiProviderConfig[]
}>()
const emit = defineEmits<{
(e: 'edit', p: AiProviderConfig): void
(e: 'delete', id: string): void
(e: 'set-default', id: string): void
(e: 'toast', msg: string, type: 'error' | 'warning' | 'info' | 'success'): void
}>()
function errMsg(e: unknown): string { return e instanceof Error ? e.message : String(e) }
// 计时器按 provider id 分键:单例计时器下 300ms 内先后改两家权重,B 的变更会清掉
// A 尚未落库的保存,先改的一方静默丢失(走查 P2-8)。
const _poolTimers = new Map<string, ReturnType<typeof setTimeout>>()
/**
* toggle 即时生效(开关语义=立即入/出池,无 debounce 必要;但失败需回滚视图)。
* 乐观更新本地数组,失败 revert + toast。
*/
async function onPoolToggle(p: AiProviderConfig, enabled: boolean) {
const prev = p.enabled
p.enabled = enabled
try {
// 防御钳制:p.weight 理论上已被 onPoolWeightChange 钳过,此处兜底防脏数据直传 IPC
const w = Math.min(100, Math.max(0, p.weight ?? 50))
await aiApi.updateProviderPool(p.id, enabled, w)
emit('toast', t('settings.toastPoolUpdateOk'), 'info')
} catch (e) {
p.enabled = prev // revert
console.error(t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), e)
emit('toast', t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), 'error')
}
}
/**
* weight 变更 debounce 300ms(防快速连续输入触发频繁 IPC),clamp [0,100] 对齐后端。
* 双 clamp:前端 clamp 视觉输入 + 后端 command 再 clamp(防御性)。
*/
function onPoolWeightChange(p: AiProviderConfig, raw: number) {
// NaN 兜底(清空输入):回退 50,防 IPC 传 NaN 后端 serde u32 失败
const clamped = Math.min(100, Math.max(0, Number.isFinite(raw) ? Math.trunc(raw) : 50))
const prev = p.weight
p.weight = clamped
// 仅重置同一 provider 的待发计时;跨 provider 互不干扰
const prevTimer = _poolTimers.get(p.id)
if (prevTimer) clearTimeout(prevTimer)
_poolTimers.set(p.id, setTimeout(async () => {
_poolTimers.delete(p.id)
try {
await aiApi.updateProviderPool(p.id, p.enabled !== false, clamped)
emit('toast', t('settings.toastPoolUpdateOk'), 'info')
} catch (e) {
p.weight = prev // revert
console.error(t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), e)
emit('toast', t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), 'error')
}
}, 300))
}
function maskKey(key: string): string {
if (!key || key.length < 8) return '••••••••'
return key.slice(0, 4) + '••••••••' + key.slice(-4)
}
/** 主文件 defineExpose.clearPoolTimer 委托到此处(壳卸载清 timer 的对外契约不变)。 */
defineExpose({
clearPoolTimer() { for (const t of _poolTimers.values()) clearTimeout(t); _poolTimers.clear() },
})
</script>
<style scoped>
/* 自 ProviderPanel scoped 拆出(C4c 纯搬迁):provider 卡片/池控件样式随区块走;
.setting-input--sm 与 .toggle--sm 为本件与 model-table 子件共用,两处各持一份
(scoped 不跨组件,全局化去重留待后续统一处理)。 */
/* ===== Provider 卡片 ===== */
.provider-list { display: flex; flex-direction: column; gap: 12px; }
.provider-card {
background: var(--df-bg);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius);
padding: 14px 16px;
}
.provider-card--default {
border-color: var(--df-accent);
box-shadow: inset 3px 0 0 var(--df-accent);
}
.provider-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.provider-info { display: flex; align-items: center; gap: 8px; }
.provider-name { font-size: 14px; font-weight: 500; color: var(--df-text); }
.default-badge {
font-size: 10px;
padding: 1px 6px;
border-radius: var(--df-radius-xs);
background: var(--df-success-bg);
color: var(--df-success);
font-weight: 500;
}
.provider-actions { display: flex; gap: 4px; }
.provider-detail { display: flex; flex-direction: column; gap: 6px; }
.detail-row { display: flex; align-items: flex-start; gap: 12px; }
.detail-label {
font-size: 12px;
color: var(--df-text-dim);
min-width: 60px;
}
.detail-value {
font-size: 12px;
color: var(--df-text-secondary);
font-family: var(--df-font-mono);
}
.detail-value.mask { color: var(--df-text-dim); letter-spacing: 1px; }
/* Provider 卡片 disabled 态(c:enabled=false 视觉弱化) */
.provider-card--disabled { opacity: 0.6; }
.pool-badge {
font-size: 10px;
padding: 1px 6px;
border-radius: var(--df-radius-xs);
background: var(--df-danger-bg);
color: var(--df-danger);
font-weight: 500;
}
/* 负载均衡池行(toggle / weight 控件) */
.detail-row--pool { align-items: center; }
.detail-value--control { display: flex; align-items: center; gap: 8px; font-family: var(--df-font-mono); }
.pool-weight-hint { font-size: 11px; color: var(--df-text-dim); }
/* 行内窄输入(权重等):定高 26px 档(--df-h-input),与 .setting-input 主体高度齐平 */
.setting-input--sm { flex: 0 0 auto; min-width: 0; width: 70px; height: var(--df-h-input); padding: 4px 8px; font-size: 12px; }
/* Toggle 小号变体(本面板负载均衡池用;.toggle 基础走全局) */
.toggle--sm { width: 32px; height: 18px; }
.toggle--sm .toggle-slider::before { width: 12px; height: 12px; left: 3px; bottom: 3px; }
.toggle--sm input:checked + .toggle-slider::before { transform: translateX(14px); }
</style>
+2 -9
View File
@@ -120,15 +120,8 @@
.toggle input:checked + .toggle-slider { background: var(--df-accent); } .toggle input:checked + .toggle-slider { background: var(--df-accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: #fff; } .toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: #fff; }
/* ===== 按钮(原 Settings.vue,列表型 Panel 共用) ===== */ /* ===== 按钮 =====
.btn { padding: 8px 16px; border: none; border-radius: var(--df-radius-sm); font-size: 13px; cursor: pointer; transition: background 0.15s, color 0.15s; } 样式大重构 R0(2026-10-18):.btn 族副本已删除,并轨 global.css 唯一基类(高度档 --df-h-btn)。 */
.btn-primary { background: var(--df-accent); color: #fff; }
.btn-primary:hover { background: var(--df-accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--df-text-secondary); border: 0.5px solid var(--df-border); }
.btn-ghost:hover { background: var(--df-bg-card); color: var(--df-text); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
/* ===== 空提示(列表型 Panel 共用) ===== */ /* ===== 空提示(列表型 Panel 共用) ===== */
.empty-hint { color: var(--df-text-dim); font-size: 13px; padding: 16px 0; text-align: center; } .empty-hint { color: var(--df-text-dim); font-size: 13px; padding: 16px 0; text-align: center; }
+23 -22
View File
@@ -214,50 +214,50 @@ function cancelEdit() {
<style scoped> <style scoped>
.wf-dag { .wf-dag {
margin-top: 8px; padding: 8px 12px; margin-top: 8px; padding: 8px 12px;
background: var(--df-bg-card, #fafafa); background: var(--df-bg-card);
border-radius: var(--df-radius-sm, 4px); font-size: 12px; border-radius: var(--df-radius-sm, 4px); font-size: 12px;
} }
.wf-dag--empty { color: var(--df-text-dim, #888); } .wf-dag--empty { color: var(--df-text-dim); }
.wf-dag-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; } .wf-dag-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.wf-dag-layers { display: flex; flex-direction: column; align-items: center; gap: 2px; } .wf-dag-layers { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wf-dag-layer { display: flex; flex-direction: column; align-items: center; gap: 4px; } .wf-dag-layer { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wf-dag-layer-label { font-size: 10px; color: var(--df-text-dim, #888); align-self: flex-start; } .wf-dag-layer-label { font-size: 10px; color: var(--df-text-dim); align-self: flex-start; }
.wf-dag-layer-nodes { .wf-dag-layer-nodes {
display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
} }
.wf-dag-layer-arrow { font-size: 16px; color: var(--df-text-dim, #888); line-height: 1; } .wf-dag-layer-arrow { font-size: 16px; color: var(--df-text-dim); line-height: 1; }
.wf-dag-node { .wf-dag-node {
display: inline-flex; align-items: center; gap: 4px; display: inline-flex; align-items: center; gap: 4px;
padding: 4px 10px; padding: 4px 10px;
background: var(--df-bg, #fff); background: var(--df-bg);
border: 1px solid var(--df-border, #ddd); border: 1px solid var(--df-border);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm, 4px);
transition: border-color 0.3s, background 0.3s; transition: border-color 0.3s, background 0.3s;
} }
.wf-dag-node-name { font-weight: 500; white-space: nowrap; } .wf-dag-node-name { font-weight: 500; white-space: nowrap; }
.wf-dag-node-type { .wf-dag-node-type {
font-size: 10px; color: var(--df-text-dim, #888); font-size: 10px; color: var(--df-text-dim);
background: var(--df-bg-card, #f0f0f0); padding: 0 4px; border-radius: 4px; background: var(--df-bg-card); padding: 0 4px; border-radius: 4px;
} }
.wf-dag-node-status { font-size: 11px; } .wf-dag-node-status { font-size: 11px; }
.wf-dag-node-status-dot { .wf-dag-node-status-dot {
width: 6px; height: 6px; border-radius: 50%; width: 6px; height: 6px; border-radius: 50%;
background: var(--df-text-dim, #ccc); background: var(--df-text-dim);
} }
.wf-dag-node--running { .wf-dag-node--running {
border-color: var(--df-info, #4a90e2); border-color: var(--df-info);
background: rgba(74,144,226,0.05); background: var(--df-info-bg);
} }
.wf-dag-node--running .wf-dag-node-status-dot { .wf-dag-node--running .wf-dag-node-status-dot {
background: var(--df-info, #4a90e2); background: var(--df-info);
animation: pulse 1s ease-in-out infinite; animation: pulse 1s ease-in-out infinite;
} }
.wf-dag-node--completed { border-color: var(--df-success, #3ddba0); } .wf-dag-node--completed { border-color: var(--df-success); }
.wf-dag-node--completed .wf-dag-node-status-dot { background: var(--df-success, #3ddba0); } .wf-dag-node--completed .wf-dag-node-status-dot { background: var(--df-success); }
.wf-dag-node--failed { border-color: var(--df-danger, #e5484d); background: rgba(229,72,77,0.05); } .wf-dag-node--failed { border-color: var(--df-danger); background: var(--df-danger-bg); }
.wf-dag-node--failed .wf-dag-node-status-dot { background: var(--df-danger, #e5484d); } .wf-dag-node--failed .wf-dag-node-status-dot { background: var(--df-danger); }
.wf-dag-node--skipped { opacity: 0.5; } .wf-dag-node--skipped { opacity: 0.5; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } } @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@@ -270,28 +270,29 @@ function cancelEdit() {
.wf-dag-outedge { .wf-dag-outedge {
display: inline-flex; align-items: center; gap: 4px; font-size: 10px; display: inline-flex; align-items: center; gap: 4px; font-size: 10px;
} }
.wf-dag-outedge-arrow { color: var(--df-text-primary); white-space: nowrap; } /* 箭头色:原 --df-text-primary 为未定义幽灵 token(声明失效),改主文字色 */
.wf-dag-outedge-arrow { color: var(--df-text); white-space: nowrap; }
/* 条件标签(共享:出边展示 + 编辑列表) */ /* 条件标签(共享:出边展示 + 编辑列表) */
.wf-dag-cond-label { .wf-dag-cond-label {
font-family: var(--df-font-mono); font-size: 10px; padding: 0 4px; font-family: var(--df-font-mono); font-size: 10px; padding: 0 4px;
background: rgba(74,144,226,0.08); border-radius: 2px; color: var(--df-info, #4a90e2); background: var(--df-info-bg); border-radius: 2px; color: var(--df-info);
max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
} }
.wf-dag-cond-label--uncond { background: transparent; color: var(--df-text-dim, #aaa); } .wf-dag-cond-label--uncond { background: transparent; color: var(--df-text-dim); }
.wf-dag-cond-label--editable { .wf-dag-cond-label--editable {
cursor: pointer; font-size: 11px; padding: 1px 6px; border-radius: 4px; cursor: pointer; font-size: 11px; padding: 1px 6px; border-radius: 4px;
transition: background 0.15s; transition: background 0.15s;
} }
.wf-dag-cond-label--editable:hover { background: rgba(74,144,226,0.18); } .wf-dag-cond-label--editable:hover { background: color-mix(in srgb, var(--df-info) 18%, transparent); }
.wf-dag-cond-label--uncond.wf-dag-cond-label--editable:hover { background: var(--df-bg-card); } .wf-dag-cond-label--uncond.wf-dag-cond-label--editable:hover { background: var(--df-bg-card); }
/* 边条件编辑列表 */ /* 边条件编辑列表 */
.wf-dag-edges-detail { margin-top: 8px; } .wf-dag-edges-detail { margin-top: 8px; }
.wf-dag-edges-summary { cursor: pointer; font-size: 11px; color: var(--df-info, #4a90e2); } .wf-dag-edges-summary { cursor: pointer; font-size: 11px; color: var(--df-info); }
.wf-dag-edges { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; } .wf-dag-edges { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.wf-dag-edge { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 11px; } .wf-dag-edge { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 11px; }
.wf-dag-edge-arrow { color: var(--df-text-primary); white-space: nowrap; } .wf-dag-edge-arrow { color: var(--df-text); white-space: nowrap; }
.wf-dag-edge-input { .wf-dag-edge-input {
flex: 1; min-width: 0; font-family: var(--df-font-mono); font-size: 11px; flex: 1; min-width: 0; font-family: var(--df-font-mono); font-size: 11px;
padding: 2px 6px; border: 0.5px solid var(--df-border); border-radius: 4px; padding: 2px 6px; border: 0.5px solid var(--df-border); border-radius: 4px;
+105 -6
View File
@@ -4,7 +4,8 @@
//! - 多处调 useAiEvents.notifyConversationChanged //! - 多处调 useAiEvents.notifyConversationChanged
//! - newConversation/switchConversation 写 appSettings 持久化活跃会话 id //! - newConversation/switchConversation 写 appSettings 持久化活跃会话 id
import { ref } from 'vue' import { ref, reactive } from 'vue'
import { invoke } from '@tauri-apps/api/core'
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow' import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
import { aiApi } from '@/api' import { aiApi } from '@/api'
import { useAppSettingsStore } from '@/stores/appSettings' import { useAppSettingsStore } from '@/stores/appSettings'
@@ -14,7 +15,7 @@ import { setStreaming } from './streamingGuard'
import { emitDetachedOpenConversation, registerDetachedOpenConvListener } from './useAiWindow' import { emitDetachedOpenConversation, registerDetachedOpenConvListener } from './useAiWindow'
import { nextMsgId, getConvState, clearConvStreamState, clearLastDelta, startApprovalTimer, clearAllApprovalTimers, switchingConvs, getConvStreamState, setConvCurrentText, notifyConversationChanged, setConvPendingApprovals, discardConvPendingApprovals, backfillConvAgentFinished, bumpToolEpoch } from './aiShared' import { nextMsgId, getConvState, clearConvStreamState, clearLastDelta, startApprovalTimer, clearAllApprovalTimers, switchingConvs, getConvStreamState, setConvCurrentText, notifyConversationChanged, setConvPendingApprovals, discardConvPendingApprovals, backfillConvAgentFinished, bumpToolEpoch } from './aiShared'
import { t } from '@/i18n/i18n-helpers' import { t } from '@/i18n/i18n-helpers'
import type { AiConversationDetail, AiMessage, AiToolCallInfo, AiToolCallStatus, ConvId, MessageId } from '@/api/types' import type { AiConversationDetail, AiConversationSummary, AiMessage, AiToolCallInfo, AiToolCallStatus, ConvId, MessageId } from '@/api/types'
// ── V11c(2026-10-05)活跃会话 KV 按窗口域分流 ── // ── V11c(2026-10-05)活跃会话 KV 按窗口域分流 ──
// 主窗与分离窗是独立 JS context,却共用同一 SQLite KV:两窗各自切会话都写 'df-ai-active-conv' // 主窗与分离窗是独立 JS context,却共用同一 SQLite KV:两窗各自切会话都写 'df-ai-active-conv'
@@ -35,17 +36,78 @@ export function activeConvKvKey(): string {
const appSettings = useAppSettingsStore() const appSettings = useAppSettingsStore()
/** 拉取会话列表;首次加载时若 appSettings 仍有有效 active-conv 且当前无活跃对话则恢复 */ // ============================================================
// F4-1(2026-10-17)会话列表分页:后端 ai_conversation_list 活跃/归档各自
// offset+limit 分页(每页 CONV_PAGE_SIZE/组),首屏一页保启动性能;侧栏「加载更多」
// 按游标续拉,搜索输入时拉满(搜索过滤跑在已加载列表上,截断列表=搜索失灵)。
// 治实测 115 条活跃主会话 57% 在桌面端零入口(硬 50 截断)。
// ============================================================
/** 每页条数(每组独立;对齐后端 limit.unwrap_or(50) 首屏口径) */
const CONV_PAGE_SIZE = 50
/** 单次「拉满」安全页数上限(防异常数据下无限循环;50*40=2000/组远超真实规模) */
const CONV_MAX_PAGES = 40
/** 分页游标(模块级单例,主/分离窗各自实例):已拉取条数按组计数 + 是否还有下一页。
* reactive 供侧栏「加载更多」按钮直接绑显隐/loading 态。 */
export const convListPaging = reactive({
activeLoaded: 0,
archivedLoaded: 0,
hasMore: false,
loading: false,
})
/** 拉一页会话摘要。直接 invoke:api 层 listConversations 封装不带 offset 参数,
* 分页需透传 activeOffset/archivedOffset(composable 直连 invoke 有 useAiSend 等先例)。 */
function fetchConvPage(activeOffset: number, archivedOffset: number): Promise<AiConversationSummary[]> {
return invoke<AiConversationSummary[]>('ai_conversation_list', {
limit: CONV_PAGE_SIZE,
includeArchived: true,
activeOffset,
archivedOffset,
})
}
/** 拉取会话列表;首次加载时若 appSettings 仍有有效 active-conv 且当前无活跃对话则恢复。
* F4-1 分页:从第一页重拉到覆盖既有加载深度(convListPaging)或拉尽——事件后刷新
* (scheduleConversationsRefresh)不把「加载更多」拉出的深度回缩成首屏 50;首启深度 0
* 即只拉一页,首屏性能不变。 */
async function loadConversations() { async function loadConversations() {
if (convListPaging.loading) return
convListPaging.loading = true
try { try {
const depthActive = convListPaging.activeLoaded
const depthArchived = convListPaging.archivedLoaded
const accActive: AiConversationSummary[] = []
const accArchived: AiConversationSummary[] = []
const seen = new Set<string>()
let aOff = 0
let rOff = 0
// includeArchived=true:侧栏归档分组(ConversationSidebar archivedConvs)数据源即本内存列表, // includeArchived=true:侧栏归档分组(ConversationSidebar archivedConvs)数据源即本内存列表,
// 若拉取时排除归档,重启后已归档会话不可见且无恢复入口(2026-10-05 实锤 bug)。 // 若拉取时排除归档,重启后已归档会话不可见且无恢复入口(2026-10-05 实锤 bug)。
// 活跃/归档分组由侧栏 groupedActive/archivedConvs 各自分离渲染;后端已分组截断,归档不挤占活跃名额。 // 活跃/归档分组由侧栏 groupedActive/archivedConvs 各自分离渲染;后端分组分页,归档不挤占活跃名额。
state.conversations = await aiApi.listConversations(50, true) for (let i = 0; i < CONV_MAX_PAGES; i++) {
const page = await fetchConvPage(aOff, rOff)
const act = page.filter(c => !c.archived)
const arc = page.filter(c => c.archived)
for (const c of act) if (!seen.has(c.id)) { seen.add(c.id); accActive.push(c) }
for (const c of arc) if (!seen.has(c.id)) { seen.add(c.id); accArchived.push(c) }
aOff += act.length
rOff += arc.length
// 某组满额一页即可能还有下一页(后端无显式 has_more,满额启发式同 load_more 消息分页)
convListPaging.hasMore = act.length === CONV_PAGE_SIZE || arc.length === CONV_PAGE_SIZE
if (!convListPaging.hasMore) break
// 已覆盖此前加载深度即止(刷新场景),首启深度 0 第一页后即止
if (aOff >= depthActive && rOff >= depthArchived) break
}
state.conversations = [...accActive, ...accArchived]
convListPaging.activeLoaded = aOff
convListPaging.archivedLoaded = rOff
// 虚拟项保底:活跃会话未落库(懒创建——首条消息前 DB 无记录)时,侧栏显示虚拟占位项。 // 虚拟项保底:活跃会话未落库(懒创建——首条消息前 DB 无记录)时,侧栏显示虚拟占位项。
// 后端 ai_conversation_create 仅生成 id 存内存不落库,首条消息发送后 save_conversation 才写库。 // 后端 ai_conversation_create 仅生成 id 存内存不落库,首条消息发送后 save_conversation 才写库。
// 此处 active 会话不在 DB 列表时补一个虚拟项,实现「点新建立即出现在侧栏,不发消息不落库」。 // 此处 active 会话不在 DB 列表时补一个虚拟项,实现「点新建立即出现在侧栏,不发消息不落库」。
// 首条消息落库后 AiCompleted/AiError 触发的 loadConversations 拉到同 id 真实记录,虚拟项被替代无重复。 // 首条消息落库后 AiCompleted/AiError 触发的 loadConversations 拉到同 id 真实记录,虚拟项被替代无重复。
// (虚拟项不计入分页游标——游标只数 DB 真实拉取条数。)
if (state.activeConversationId if (state.activeConversationId
&& !state.conversations.some(c => c.id === state.activeConversationId)) { && !state.conversations.some(c => c.id === state.activeConversationId)) {
const now = String(Date.now()) const now = String(Date.now())
@@ -94,6 +156,41 @@ async function loadConversations() {
} as AiMessage) } as AiMessage)
notifyConversationChanged() notifyConversationChanged()
} }
} finally {
convListPaging.loading = false
}
}
/** F4-1「加载更多」:从当前游标续拉一页并追加(不重拉首页,避免重复传输+闪烁);
* 返回是否实际新增条目(侧栏据此决定是否继续,数据漂移致空页时自然停)。 */
async function loadMoreConversations(): Promise<boolean> {
if (convListPaging.loading || !convListPaging.hasMore) return false
convListPaging.loading = true
try {
const page = await fetchConvPage(convListPaging.activeLoaded, convListPaging.archivedLoaded)
const act = page.filter(c => !c.archived)
const arc = page.filter(c => c.archived)
const existing = new Set(state.conversations.map(c => c.id))
const fresh = page.filter(c => !existing.has(c.id))
if (fresh.length) state.conversations = [...state.conversations, ...fresh]
convListPaging.activeLoaded += act.length
convListPaging.archivedLoaded += arc.length
convListPaging.hasMore = act.length === CONV_PAGE_SIZE || arc.length === CONV_PAGE_SIZE
return fresh.length > 0
} catch (e) {
console.error('[AI] 加载更多会话失败:', e)
return false
} finally {
convListPaging.loading = false
}
}
/** F4-1 搜索全量兜底:把列表拉满。搜索过滤(stores.filteredConversations)跑在已加载
* 列表上,未拉满时老会话搜不到——搜索本就该扫全量,输入触发时一次拉尽。 */
async function loadAllConversations(): Promise<void> {
for (let i = 0; i < CONV_MAX_PAGES; i++) {
if (!convListPaging.hasMore) break
if (!(await loadMoreConversations())) break
} }
} }
@@ -754,6 +851,8 @@ export function useAiConversations() {
return { return {
loadConversations, loadConversations,
scheduleConversationsRefresh, scheduleConversationsRefresh,
loadMoreConversations,
loadAllConversations,
newConversation, newConversation,
switchConversation, switchConversation,
deleteConversation, deleteConversation,
@@ -768,4 +867,4 @@ export function useAiConversations() {
} }
} }
export { loadConversations, scheduleConversationsRefresh, loadMoreHistory, getLoadMoreState } export { loadConversations, scheduleConversationsRefresh, loadMoreConversations, loadAllConversations, loadMoreHistory, getLoadMoreState }
+3
View File
@@ -409,6 +409,9 @@ async function sendMessage(text: string, skill?: string, forceMode = false, part
role: 'user', role: 'user',
content: text.trim(), content: text.trim(),
timestamp: Date.now(), timestamp: Date.now(),
// 与后端落库同标记(chat.rs 落库带 source.channel='inject'):本地气泡
// 不带则轮次分桶把它当「发起消息」多计一轮,重载后才归位
source: { channel: 'inject' },
}) })
} }
void emit('ai-toast', { msg: t('ai.injectMerged'), type: 'success' }) void emit('ai-toast', { msg: t('ai.injectMerged'), type: 'success' })
+10
View File
@@ -133,6 +133,8 @@ export default {
queueSave: 'Save', queueSave: 'Save',
queueCancel: 'Cancel', queueCancel: 'Cancel',
queueSendNow: 'Send now', queueSendNow: 'Send now',
// UX walk panel-2 F2-1: send button title/aria (was mis-bound to queueSendNow)
send: 'Send',
// 3c UX batch addition (I4 queue backfill: pull a queued item back into the input box) // 3c UX batch addition (I4 queue backfill: pull a queued item back into the input box)
queueBackfill: 'Backfill', queueBackfill: 'Backfill',
@@ -185,6 +187,10 @@ export default {
copyMsg: 'Copy message', copyMsg: 'Copy message',
copied: 'Copied', copied: 'Copied',
copyFailed: 'Copy failed', copyFailed: 'Copy failed',
// F1-1: code block copy button (injected at v-html render layer via decorateCodeHtml)
copyCode: 'Copy',
// F1-1: collapsed long-message summary toggle (expanded state reuses collapse key)
foldedSummary: '{chars} chars collapsed / ~{tokens} tokens — click to expand',
// Copy bubble as image (html2canvas → clipboard; falls back to download) // Copy bubble as image (html2canvas → clipboard; falls back to download)
copyAsImage: 'Copy as image', copyAsImage: 'Copy as image',
copiedAsImage: 'Copied as image', copiedAsImage: 'Copied as image',
@@ -287,6 +293,8 @@ export default {
recoverNow: 'Resume', recoverNow: 'Resume',
viewHistory: 'View history messages', viewHistory: 'View history messages',
viewSummary: 'View context summary', viewSummary: 'View context summary',
// UX walk panel-6 F6-1: inline hint when a history/summary jump misses (target inside a collapsed segment)
historyLocateInSegment: 'This message is inside a collapsed segment (archived/compressed). Expand the divider in the message flow first',
viewContext: 'View AI context', viewContext: 'View AI context',
contextSystemPrompt: 'System Prompt', contextSystemPrompt: 'System Prompt',
contextEnvironment: 'Environment', contextEnvironment: 'Environment',
@@ -342,6 +350,8 @@ export default {
editEmptyBlocked: 'Edit content is empty, submission cancelled', editEmptyBlocked: 'Edit content is empty, submission cancelled',
skillNoMatchQuery: 'No skill matches "{q}", send blocked', skillNoMatchQuery: 'No skill matches "{q}", send blocked',
backfillOverwriteConfirm: 'The input box has an unsent draft; backfilling will overwrite it. Continue?', backfillOverwriteConfirm: 'The input box has an unsent draft; backfilling will overwrite it. Continue?',
// UX walk panel-2 F2-4: example-card overwrite confirm (aligned with backfill confirm)
exampleOverwriteConfirm: 'The input box has an unsent draft; the example will overwrite it. Continue?',
// ── Outbox / scheduled messages (OutboxDrawer + ChatInput clock entry, design 2026-10-10 §3.4) ── // ── Outbox / scheduled messages (OutboxDrawer + ChatInput clock entry, design 2026-10-10 §3.4) ──
outboxEntry: 'Scheduled messages', outboxEntry: 'Scheduled messages',
+10
View File
@@ -133,6 +133,8 @@ export default {
queueSave: '保存', queueSave: '保存',
queueCancel: '取消', queueCancel: '取消',
queueSendNow: '立即发送', queueSendNow: '立即发送',
// 走查-信息UX 面二 F2-1:发送钮 title/aria(原误绑 queueSendNow,语义是插队而非发送)
send: '发送',
// 3c UX 批追加(I4 队列回填:取出排队项填回输入框重新编辑) // 3c UX 批追加(I4 队列回填:取出排队项填回输入框重新编辑)
queueBackfill: '回填', queueBackfill: '回填',
@@ -186,6 +188,10 @@ export default {
copyMsg: '复制消息', copyMsg: '复制消息',
copied: '已复制', copied: '已复制',
copyFailed: '复制失败', copyFailed: '复制失败',
// F1-1:代码块复制按钮(v-html 渲染层注入,decorateCodeHtml 传参)
copyCode: '复制',
// F1-1:长文折叠条带量按钮(展开态复用 collapse 键)
foldedSummary: '已折叠 {chars} 字符 / 约 {tokens} tokens,点击展开',
// 气泡复制为图片(html2canvas 渲染 → 剪贴板;失败降级下载) // 气泡复制为图片(html2canvas 渲染 → 剪贴板;失败降级下载)
copyAsImage: '复制为图片', copyAsImage: '复制为图片',
copiedAsImage: '已复制为图片', copiedAsImage: '已复制为图片',
@@ -288,6 +294,8 @@ export default {
recoverNow: '恢复', recoverNow: '恢复',
viewHistory: '查看历史消息', viewHistory: '查看历史消息',
viewSummary: '查看上下文摘要', viewSummary: '查看上下文摘要',
// 走查-信息UX 面六 F6-1:历史/摘要项点击定位未命中(目标在折叠段内未渲染 DOM)的行内提示
historyLocateInSegment: '该消息在折叠段(已归档/已压缩)内,请先在消息流中展开对应分隔条',
viewContext: '查看 AI 上下文', viewContext: '查看 AI 上下文',
contextSystemPrompt: '系统提示', contextSystemPrompt: '系统提示',
contextEnvironment: '环境', contextEnvironment: '环境',
@@ -343,6 +351,8 @@ export default {
editEmptyBlocked: '编辑内容为空,已取消提交', editEmptyBlocked: '编辑内容为空,已取消提交',
skillNoMatchQuery: '未找到技能「{q}」,已阻止发送', skillNoMatchQuery: '未找到技能「{q}」,已阻止发送',
backfillOverwriteConfirm: '输入框已有未发送草稿,回填将覆盖,确定继续?', backfillOverwriteConfirm: '输入框已有未发送草稿,回填将覆盖,确定继续?',
// 走查-信息UX 面二 F2-4:示例问题卡覆盖草稿二次确认(对齐回填确认语义)
exampleOverwriteConfirm: '输入框已有未发送草稿,点击示例将覆盖,确定继续?',
// ── 待发箱/定时消息(OutboxDrawer + ChatInput ⏰ 入口,设计 2026-10-10 §3.4)── // ── 待发箱/定时消息(OutboxDrawer + ChatInput ⏰ 入口,设计 2026-10-10 §3.4)──
outboxEntry: '定时消息', outboxEntry: '定时消息',
+2 -1
View File
@@ -11,7 +11,8 @@
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 12px; font-size: 12px;
padding: 1px 5px; padding: 1px 5px;
background: rgba(255,255,255,0.06); /* 2026-10-18 配色收口:白叠层字面量改文字色派生,浅色主题自动转黑叠层 */
background: color-mix(in srgb, var(--df-text) 6%, transparent);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
color: var(--df-accent); color: var(--df-accent);
} }
+105 -29
View File
@@ -27,7 +27,7 @@
.error-banner { .error-banner {
display: flex; align-items: center; justify-content: space-between; gap: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
padding: 8px 12px; padding: 8px 12px;
background: rgba(255,107,107,0.12); border: 0.5px solid var(--df-danger); background: var(--df-danger-bg); border: 0.5px solid var(--df-danger);
border-radius: var(--df-radius-sm); color: var(--df-danger); font-size: 12px; border-radius: var(--df-radius-sm); color: var(--df-danger); font-size: 12px;
} }
.error-text { word-break: break-word; } .error-text { word-break: break-word; }
@@ -39,32 +39,36 @@
/* — 灵感状态标签:ideas 列表(Ideas.vue) + 灵感详情(IdeaDetail.vue) 共享 — /* — 灵感状态标签:ideas 列表(Ideas.vue) + 灵感详情(IdeaDetail.vue) 共享 —
原 Ideas.vue / IdeaDetail.vue <style scoped> 两处逐字一致(灵感专属 5 态色系, 原 Ideas.vue / IdeaDetail.vue <style scoped> 两处逐字一致(灵感专属 5 态色系,
与 Tasks/AuditLog 的 status-tag 语义不同,独立提取避免混淆)。 */ 与 Tasks/AuditLog 的 status-tag 语义不同,独立提取避免混淆)。
2026-10-18 配色收口:圆角/内距对齐徽章档(xs+pad-badge,AuditLog 同档),
显色改语义 token 三件套(底 *-bg/边 1px *-bd/字同色),清除 Material 并行色板;
中性档(draft/archived)走 neutral-bg+text-dim 不加边。 */
.status-tag { .status-tag {
font-size: 11px; font-weight: 500; padding: 4px 10px; font-size: 11px; font-weight: 500; padding: var(--df-pad-badge);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-xs);
flex-shrink: 0; white-space: nowrap; flex-shrink: 0; white-space: nowrap;
} }
.status-draft { background: rgba(90,99,128,0.2); color: var(--df-text-dim); } .status-draft { background: var(--df-neutral-bg); color: var(--df-text-dim); }
.status-pending_review { background: rgba(100,181,246,0.2); color: var(--df-info); } .status-pending_review { background: var(--df-info-bg); color: var(--df-info); border: 1px solid var(--df-info-bd); }
.status-approved { background: rgba(100,255,218,0.15); color: var(--df-success); } .status-approved { background: var(--df-success-bg); color: var(--df-success); border: 1px solid var(--df-success-bd); }
.status-promoted { background: rgba(108,99,255,0.2); color: var(--df-accent); } .status-promoted { background: var(--df-accent-bg); color: var(--df-accent); border: 1px solid var(--df-accent-bd); }
.status-rejected { background: rgba(255,107,107,0.2); color: var(--df-danger); } .status-rejected { background: var(--df-danger-bg); color: var(--df-danger); border: 1px solid var(--df-danger-bd); }
/* 归档态(归档箱内才有):中性灰,与 draft 同系;此前列表/详情渲染 .status-archived 无对应色 → 徽章悬空 */ /* 归档态(归档箱内才有):中性灰,与 draft 同系;此前列表/详情渲染 .status-archived 无对应色 → 徽章悬空 */
.status-archived { background: rgba(90,99,128,0.2); color: var(--df-text-dim); } .status-archived { background: var(--df-neutral-bg); color: var(--df-text-dim); }
/* — 任务状态徽章色(7 态):Tasks 列表 + TaskDetail/ProjectDetail 详情共用 — /* — 任务状态徽章色(8 态):Tasks 列表 + TaskDetail/ProjectDetail 详情共用 —
WK-6:原仅 TaskDetail/ProjectDetail scoped 定义,Tasks.vue 列表拿不到 → 裸文本。 原 TaskDetail/ProjectDetail scoped 副本已删,此处为唯一真值。
提取全局对齐三视图;配色以 TaskDetail.vue(7 态最全)为准,尺寸/圆角统一走上方 .status-tag。 2026-10-18 配色收口:Material 并行色板(hex/rgba)全清,改语义 token 三件套;
(TaskDetail 的 scoped 同名类特异度更高会覆盖,但值与全局一致,无视觉差异) */ testing(#ff9800)/deferred(#ffc107)原 amber/orange 系按配色审计归警告族;
.status-todo { background: rgba(90,99,128,0.2); color: var(--df-text-dim); } review/testing/deferred 三态同走 warning,靠徽章文字区分。 */
.status-progress { background: rgba(100,181,246,0.2); color: var(--df-info); } .status-todo { background: var(--df-neutral-bg); color: var(--df-text-dim); }
.status-review { background: rgba(255,217,61,0.2); color: var(--df-warning); } .status-progress { background: var(--df-info-bg); color: var(--df-info); border: 1px solid var(--df-info-bd); }
.status-testing { background: rgba(255,152,0,0.2); color: #ff9800; } .status-review { background: var(--df-warning-bg); color: var(--df-warning); border: 1px solid var(--df-warning-bd); }
.status-done { background: rgba(100,255,218,0.15); color: var(--df-success); } .status-testing { background: var(--df-warning-bg); color: var(--df-warning); border: 1px solid var(--df-warning-bd); }
.status-blocked { background: rgba(255,107,107,0.12); color: var(--df-danger); border: 0.5px solid var(--df-danger); } .status-done { background: var(--df-success-bg); color: var(--df-success); border: 1px solid var(--df-success-bd); }
.status-abandoned { background: rgba(255,107,107,0.2); color: var(--df-danger); } .status-blocked { background: var(--df-danger-bg); color: var(--df-danger); border: 1px solid var(--df-danger-bd); }
.status-deferred { background: rgba(255,193,7,0.15); color: #f0a030; } .status-abandoned { background: var(--df-danger-bg); color: var(--df-danger); border: 1px solid var(--df-danger-bd); }
.status-deferred { background: var(--df-warning-bg); color: var(--df-warning); border: 1px solid var(--df-warning-bd); }
/* — 多维评分条:IdeaDetail.vue + ProjectDetail.vue 共享 — /* — 多维评分条:IdeaDetail.vue + ProjectDetail.vue 共享 —
原 IdeaDetail.vue L770-808 / ProjectDetail.vue L678-692 两处逐字一致 原 IdeaDetail.vue L770-808 / ProjectDetail.vue L678-692 两处逐字一致
@@ -181,7 +185,7 @@
font-size: 11px; font-size: 11px;
padding: 2px 8px; padding: 2px 8px;
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
background: rgba(108, 99, 255, 0.08); background: var(--df-accent-bg);
color: var(--df-text-secondary); color: var(--df-text-secondary);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
} }
@@ -261,7 +265,7 @@
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius); border-radius: var(--df-radius);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); box-shadow: var(--df-shadow-md);
z-index: 20; z-index: 20;
} }
.ai-skill-item { .ai-skill-item {
@@ -374,11 +378,83 @@
color: var(--df-text-dim); color: var(--df-text-dim);
} }
/* 压缩中 spinner 图标旋转动画(原 AiChat.vue <style scoped> 抽取; /* 压缩中 spinner 图标旋转动画(原 AiChat.vue <style scoped> 抽取;
TopBar.vue .ai-btn-spinner 按名引用,Vue 不对 @keyframes scoped 故全局可见) */ TopBar.vue .ai-btn-spinner 按名引用,Vue 不对 @keyframes scoped 故全局可见;
2026-10-18 动画并入 global.css df-spin 单一来源) */
.ai-btn-spinner { .ai-btn-spinner {
animation: ai-btn-spin 0.9s linear infinite; animation: df-spin 0.9s linear infinite;
} }
@keyframes ai-btn-spin {
from { transform: rotate(0deg); } /* ═══════════════════════════════════════════════════════════
to { transform: rotate(360deg); } 样式大重构 R0 公共类(2026-10-18 新增)
来源:u-agent 管理台范式(D:\Downloads\u-agent),hairline 网格/发丝线行/染色两档
染色统一走 token:底 --df-*-bg(12%)+ 边 --df-*-bd(30%)+ 同色字
═══════════════════════════════════════════════════════════ */
/* — .df-kv: hairline 网格档案卡(gap:1px 以边框色作发丝分隔线) — */
.df-kv {
display: grid;
gap: 1px;
background: var(--df-border);
border: 1px solid var(--df-border);
border-radius: var(--df-radius-md);
overflow: hidden;
}
.df-kv-i {
background: var(--df-bg-raised);
padding: 10px 12px;
min-width: 0;
}
.df-kv-k {
font-size: var(--df-fs-micro);
text-transform: uppercase;
color: var(--df-text-dim);
font-family: var(--df-font-mono);
}
.df-kv-v {
font-size: var(--df-fs-aux);
font-family: var(--df-font-mono);
margin-top: 2px;
word-break: break-all;
}
/* — .df-row: 发丝线行(末行无线) — */
.df-row {
padding: 8px 0;
border-bottom: 1px solid var(--df-border);
}
.df-row:last-child { border-bottom: none; }
/* — .df-note: 通知条(info/warning/danger 染色) — */
.df-note {
padding: 8px 12px;
border-radius: var(--df-radius-md);
font-size: var(--df-fs-ctrl);
}
.df-note--info { background: var(--df-info-bg); border: 1px solid var(--df-info-bd); color: var(--df-info); }
.df-note--warning { background: var(--df-warning-bg); border: 1px solid var(--df-warning-bd); color: var(--df-warning); }
.df-note--danger { background: var(--df-danger-bg); border: 1px solid var(--df-danger-bd); color: var(--df-danger); }
/* — .df-pill: 状态胶囊(全圆 + 染色,体系同 .df-note) — */
.df-pill {
border-radius: 999px;
padding: 1px 8px;
font-size: var(--df-fs-meta);
font-family: var(--df-font-mono);
}
.df-pill--success { background: var(--df-success-bg); border: 1px solid var(--df-success-bd); color: var(--df-success); }
.df-pill--warning { background: var(--df-warning-bg); border: 1px solid var(--df-warning-bd); color: var(--df-warning); }
.df-pill--danger { background: var(--df-danger-bg); border: 1px solid var(--df-danger-bd); color: var(--df-danger); }
.df-pill--info { background: var(--df-info-bg); border: 1px solid var(--df-info-bd); color: var(--df-info); }
/* — .df-tab: 下划线 tab(激活 2px accent 底线) — */
.df-tab {
padding: 6px 10px;
font-size: var(--df-fs-ctrl);
color: var(--df-text-secondary);
border-bottom: 2px solid transparent;
cursor: pointer;
}
.df-tab--active {
color: var(--df-text);
border-bottom-color: var(--df-accent);
} }
+169 -20
View File
@@ -5,19 +5,20 @@
═══════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════ */
:root { :root {
/* — Surface — */ /* — Surface — 2026-10-18 UI 升级:参考 u-agent 管理台 GitHub Dark 四级灰阶(#0d1117→#22272e),
--df-bg: #0c0e1a; 替换原紫调深底,信息密度型界面灰阶更中性、层级更清晰 */
--df-bg-raised: #12152a; --df-bg: #0d1117;
--df-bg-card: #171b33; --df-bg-raised: #161b22;
--df-bg-card-hover: #1c2140; --df-bg-card: #1c2128;
--df-sidebar-bg: #090b15; --df-bg-card-hover: #22272e;
--df-sidebar-hover: rgba(108,99,255,0.06); --df-sidebar-bg: #0d1117;
--df-sidebar-active: rgba(108,99,255,0.12); --df-sidebar-hover: rgba(88,166,255,0.08);
--df-sidebar-active: rgba(88,166,255,0.14);
/* — Text — */ /* — Text — GitHub Dark 三级文字(#e6edf3/#8b949e/#6e7681) — */
--df-text: #eef0f6; --df-text: #e6edf3;
--df-text-secondary: #8b90a8; --df-text-secondary: #8b949e;
--df-text-dim: #4a4f6a; --df-text-dim: #6e7681;
/* — Accent: 紫色系(系统功能、互动元素)— */ /* — Accent: 紫色系(系统功能、互动元素)— */
--df-accent: #7b6ff0; --df-accent: #7b6ff0;
@@ -39,6 +40,35 @@
--df-info: #5eaff0; --df-info: #5eaff0;
--df-info-bg: rgba(94,175,240,0.12); --df-info-bg: rgba(94,175,240,0.12);
/* — 染色边框档(30% 边,与 .df-badge 边框同值;底 12% 由 --df-*-bg 承担)—
消费方直接引用 token,禁写 rgba 字面量/回退值 */
--df-success-bd: rgba(61,219,160,0.3);
--df-warning-bd: rgba(240,199,94,0.3);
--df-danger-bd: rgba(240,101,101,0.3);
--df-info-bd: rgba(94,175,240,0.3);
--df-accent-bd: rgba(123,111,240,0.3);
/* — 字号谱(纯整数,对齐 u-agent 13px 范式;token 必注入,消费方禁写回退值)— */
--df-fs-micro: 9px; /* 小节头/tag/计数 */
--df-fs-meta: 10px; /* 徽章/元数据 */
--df-fs-aux: 11px; /* 辅助文字/列表次级 */
--df-fs-ctrl: 12px; /* 控件文字/小按钮 */
--df-fs-body: 13px; /* 正文基准 */
--df-fs-title: 16px; /* 页头标题 */
/* — 控件高度档 — */
--df-h-btn: 30px; /* 主按钮(.btn 合一目标) */
--df-h-input: 26px; /* 行内输入/搜索 */
--df-h-modal-input: 30px; /* 弹窗输入 */
--df-h-icon-btn: 26px; /* 图标钮统一档 */
/* — 微内距暗刻度(chip/badge 族)— */
--df-pad-chip: 1px 6px;
--df-pad-badge: 3px 8px;
/* — 图标槽 — */
--df-icon-gutter: 42px; /* ToolCard 图标槽(38/42 魔法数归一) */
/* git 变更状态色(added/modified/deleted/untracked) */ /* git 变更状态色(added/modified/deleted/untracked) */
--df-git-added: #4caf50; --df-git-added: #4caf50;
--df-git-modified: #f0a020; --df-git-modified: #f0a020;
@@ -73,6 +103,13 @@
/* — Transition — */ /* — Transition — */
--df-ease: cubic-bezier(0.4, 0, 0.2, 1); --df-ease: cubic-bezier(0.4, 0, 0.2, 1);
/* — 叠层/中性/阴影(配色收口 2026-10-18:白叠层 64 处/中性徽章灰/阴影散档收敛入 token)— */
--df-hover: rgba(255,255,255,0.04); /* 行 hover 叠层 */
--df-zebra: rgba(255,255,255,0.015); /* 斑马纹 */
--df-neutral-bg: rgba(90,99,128,0.2); /* 中性徽章底(draft/todo/archived/risk-low) */
--df-shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
--df-shadow-md: 0 4px 16px rgba(0,0,0,0.3);
} }
/* ═══ 亮色主题 ═══ */ /* ═══ 亮色主题 ═══ */
@@ -103,6 +140,13 @@
--df-info: #0984e3; --df-info: #0984e3;
--df-info-bg: rgba(9,132,227,0.10); --df-info-bg: rgba(9,132,227,0.10);
/* 染色边框档(浅色对应值,同 alpha) */
--df-success-bd: rgba(0,184,148,0.3);
--df-warning-bd: rgba(225,112,85,0.3);
--df-danger-bd: rgba(214,48,49,0.3);
--df-info-bd: rgba(9,132,227,0.3);
--df-accent-bd: rgba(108,92,231,0.3);
/* git 变更状态色(added/modified/deleted/untracked) */ /* git 变更状态色(added/modified/deleted/untracked) */
--df-git-added: #4caf50; --df-git-added: #4caf50;
--df-git-modified: #f0a020; --df-git-modified: #f0a020;
@@ -114,6 +158,13 @@
--df-scrollbar: rgba(0,0,0,0.2); --df-scrollbar: rgba(0,0,0,0.2);
--df-scrollbar-hover: rgba(0,0,0,0.3); --df-scrollbar-hover: rgba(0,0,0,0.3);
/* 叠层/中性/阴影浅色档(配色收口 2026-10-18) */
--df-hover: rgba(0,0,0,0.04);
--df-zebra: rgba(0,0,0,0.012);
--df-neutral-bg: rgba(90,99,128,0.12);
--df-shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
--df-shadow-md: 0 4px 16px rgba(0,0,0,0.12);
} }
* { margin: 0; padding: 0; box-sizing: border-box; } * { margin: 0; padding: 0; box-sizing: border-box; }
@@ -123,7 +174,7 @@ html, body, #app {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
font-family: var(--df-font-sans); font-family: var(--df-font-sans);
font-size: 14px; font-size: 13px; /* 基准字号(样式大重构 2026-10-18:14→13,对齐 u-agent 高密度范式) */
font-weight: 400; font-weight: 400;
background: var(--df-bg); background: var(--df-bg);
color: var(--df-text); color: var(--df-text);
@@ -133,6 +184,38 @@ html, body, #app {
line-height: 1.5; line-height: 1.5;
} }
/* ═══ 2026-10-18 整洁性波:跨文件共享样式抽取(共享才抽取原则) ═══
来源: dup-style-scan.json(49 条跨文件重复规则),按文件族消费波替换引用 */
/* — Toast 族(双轨合一:AiChat/ApprovalPopup 的 .ai-toast-* 与 Knowledge/Settings 的 .toast-*) — */
.df-toast {
position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
padding: 8px 16px; border-radius: var(--df-radius); font-size: var(--df-fs-ctrl);
z-index: 300; box-shadow: var(--df-shadow-md);
}
.df-toast--success { background: var(--df-success-bg); color: var(--df-success); border: 1px solid var(--df-success-bd); }
.df-toast--warning { background: var(--df-warning-bg); color: var(--df-warning); border: 1px solid var(--df-warning-bd); }
.df-toast--danger { background: var(--df-danger-bg); color: var(--df-danger); border: 1px solid var(--df-danger-bd); }
.df-toast--info { background: var(--df-accent-bg); color: var(--df-accent); border: 1px solid var(--df-accent-bd); }
/* 底部就近反馈变体(Projects/Tasks/ApprovalDialog 操作类 toast,保留底部形态) */
.df-toast--bottom { position: fixed; bottom: 24px; top: auto; }
.df-toast-enter-active, .df-toast-leave-active { transition: opacity 0.2s, transform 0.2s; }
.df-toast-enter-from, .df-toast-leave-to { opacity: 0; transform: translate(-50%, -8px); }
/* — 通用动画 keyframes(各文件重复定义收敛) — */
@keyframes df-spin { to { transform: rotate(360deg); } }
@keyframes df-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
/* — 确认弹层按钮行(ConfirmDialog/AdvancedSection/AllowedDirsPanel 共享) — */
.df-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.df-confirm-enter-active, .df-confirm-leave-active { transition: opacity 0.15s; }
.df-confirm-enter-from, .df-confirm-leave-to { opacity: 0; }
/* — 工具 diff 展示块(ToolCard/ToolResultBody 共享) — */
.df-diff-pre { margin: 0; padding: 6px 0; max-height: 240px; overflow: auto; font-family: var(--df-font-mono); font-size: var(--df-fs-aux); line-height: 1.6; background: var(--df-bg); }
.df-diff-pre code { display: block; white-space: pre; }
.df-diff-line { display: block; padding: 0 10px; white-space: pre-wrap; word-break: break-all; }
/* — Scrollbar — */ /* — Scrollbar — */
::-webkit-scrollbar { width: 5px; height: 5px; } ::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-track { background: transparent; }
@@ -206,22 +289,23 @@ html, body, #app {
class 名与各页 template 保持一致,零侵入 class 名与各页 template 保持一致,零侵入
═══════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════ */
/* — Page Header(功能内页统一:24px 标题 + 紧凑下间距)— */ /* — Page Header(全站统一紧凑单行,对齐 u-agent 46px 顶栏范式,样式大重构 2026-10-18)— */
.page-header { .page-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: var(--df-gap-page); height: 46px;
margin-bottom: var(--df-gap-head);
} }
.page-header h1 { font-size: 24px; font-weight: 500; color: var(--df-text); } .page-header h1 { font-size: var(--df-fs-title); font-weight: 500; color: var(--df-text); }
.header-actions { display: flex; gap: 10px; } .header-actions { display: flex; gap: 8px; align-items: center; }
/* — Button — */ /* — Button(唯一基类,高度档 --df-h-btn;settings.css 副本已删除并轨,样式大重构 2026-10-18)— */
.btn { .btn {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
padding: 10px 16px; padding: 8px 16px; /* 有效高度 30px,对齐 --df-h-btn */
line-height: 1; line-height: 1;
border: none; border: none;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
@@ -237,9 +321,16 @@ html, body, #app {
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; } .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--df-text-secondary); border: 0.5px solid var(--df-border); } .btn-ghost { background: transparent; color: var(--df-text-secondary); border: 0.5px solid var(--df-border); }
.btn-ghost:hover { background: var(--df-bg-card); color: var(--df-text); } .btn-ghost:hover { background: var(--df-bg-card); color: var(--df-text); }
.btn-accent { background: var(--df-success-bg); color: var(--df-success); border: 0.5px solid rgba(61,219,160,0.3); } /* 并轨自 settings.css 副本:ghost 禁用态(原 global 缺此条) */
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-accent { background: var(--df-success-bg); color: var(--df-success); border: 0.5px solid var(--df-success-bd); }
.btn-accent:hover { background: rgba(61,219,160,0.22); } .btn-accent:hover { background: rgba(61,219,160,0.22); }
.btn-sm { padding: 4px 12px; font-size: 12px; } .btn-sm { padding: 4px 12px; font-size: 12px; }
/* 2026-10-18 整洁波收敛:实底危险钮(AdvancedSection/AllowedDirsPanel 两处重复抽取;
Projects 页描边款 btn-danger 属本页特有,保留其本地覆盖) */
.btn-danger { background: var(--df-danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-link { background: none; border: none; color: var(--df-accent); font-size: 12px; cursor: pointer; padding: 2px 6px; } .btn-link { background: none; border: none; color: var(--df-accent); font-size: 12px; cursor: pointer; padding: 2px 6px; }
.btn-link:hover { text-decoration: underline; } .btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--df-danger); } .btn-link-danger { color: var(--df-danger); }
@@ -326,3 +417,61 @@ html, body, #app {
border-color: var(--df-accent); border-color: var(--df-accent);
background: var(--df-bg-raised); background: var(--df-bg-raised);
} }
/* ═══ 2026-10-18 UI 升级:参考 u-agent 管理台范式注入公共组件 ═══
来源:D:\Downloads\u-agent\agent-manager.html(GitHub Dark 体系)
① 状态点三态(run 绿 / deg 琥珀 pulse / stop 灰)
② 透明彩底三件套徽章(底15% + 边30% + 同色字)
③ mono 数据字体标记(数值/版本/哈希/ID 用 mono,信息密度感) */
/* — 状态点三态 — */
.df-dot {
width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block;
}
.df-dot--run { background: var(--df-success); }
.df-dot--deg { background: var(--df-warning); box-shadow: 0 0 6px var(--df-warning); animation: df-pulse 1.5s infinite; }
.df-dot--stop { background: var(--df-text-dim); }
@keyframes df-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
/* — 透明彩底三件套徽章 — */
.df-badge {
font-family: var(--df-font-mono); font-size: 10px; padding: 3px 8px;
border-radius: var(--df-radius-sm); display: inline-flex; align-items: center; gap: 4px;
}
.df-badge--success { background: var(--df-success-bg); color: var(--df-success); border: 1px solid var(--df-success-bd); }
.df-badge--warning { background: var(--df-warning-bg); color: var(--df-warning); border: 1px solid var(--df-warning-bd); }
.df-badge--danger { background: var(--df-danger-bg); color: var(--df-danger); border: 1px solid var(--df-danger-bd); }
.df-badge--info { background: var(--df-info-bg); color: var(--df-info); border: 1px solid var(--df-info-bd); }
.df-badge--accent { background: var(--df-accent-soft); color: var(--df-accent); border: 1px solid var(--df-accent-bd); }
/* — 标签(tag,列表项内联小标签) — */
.df-tag {
font-size: 9px; font-family: var(--df-font-mono); padding: 1px 5px;
border-radius: var(--df-radius-xs); background: var(--df-bg-card-hover); color: var(--df-text-secondary);
}
.df-tag--info { background: var(--df-info-bg); color: var(--df-info); }
.df-tag--accent { background: var(--df-accent-bg); color: var(--df-accent); }
.df-tag--success { background: var(--df-success-bg); color: var(--df-success); }
/* — mono 数据标记 — */
.df-mono {
font-family: var(--df-font-mono); font-size: 12px; letter-spacing: -0.2px;
}
/* — 顶栏状态徽章(参考 u-agent hd-stats) — */
.df-hstat {
display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
background: var(--df-bg-card); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius); font-size: 11px; color: var(--df-text-secondary);
}
.df-hstat b { font-family: var(--df-font-mono); font-size: 12px; color: var(--df-text); }
/* — 小节头(样式大重构 2026-10-18 新增,对标 u-agent .grp/.sec-h 范式) — */
.df-sec-h {
font-size: var(--df-fs-meta);
font-weight: 600;
font-family: var(--df-font-mono);
text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--df-text-dim);
}
+25 -48
View File
@@ -129,9 +129,10 @@
{{ $t('aiChat.popupOpenPanel') }} {{ $t('aiChat.popupOpenPanel') }}
</button> </button>
<!-- P1-e-d:审批失败 toast(窗口内自包含 useToast;独立 WebviewWindow 无根 toast,自管渲染) --> <!-- P1-e-d:审批失败 toast(窗口内自包含 useToast;独立 WebviewWindow 无根 toast,自管渲染);
<Transition name="ai-toast"> 样式消费全局 .df-toast 族,error 映射 danger,定位经 scoped 覆写让出 header -->
<div v-if="toast.visible" class="ai-toast" :class="'ai-toast-' + toast.type">{{ toast.msg }}</div> <Transition name="df-toast">
<div v-if="toast.visible" class="df-toast" :class="toast.type === 'error' ? 'df-toast--danger' : 'df-toast--' + toast.type">{{ toast.msg }}</div>
</Transition> </Transition>
<!-- M5:path 类 deny 二次确认(拒绝不可逆,与 ToolCard 同款;独立窗口本地 ConfirmDialog, <!-- M5:path 类 deny 二次确认(拒绝不可逆,与 ToolCard 同款;独立窗口本地 ConfirmDialog,
@@ -527,11 +528,11 @@ function onDragEnd() { isDragging.value = false }
border: 0.5px solid var(--df-accent); border: 0.5px solid var(--df-accent);
border-left: 3px solid var(--df-accent); border-left: 3px solid var(--df-accent);
border-radius: var(--df-radius-md); border-radius: var(--df-radius-md);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--df-accent-soft); box-shadow: var(--df-shadow-md), 0 0 0 1px var(--df-accent-soft);
overflow: hidden; overflow: hidden;
} }
.popup-shell[data-dragging="true"] { .popup-shell[data-dragging="true"] {
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--df-accent); box-shadow: var(--df-shadow-md), 0 0 0 2px var(--df-accent);
} }
/* 顶部拖动条 */ /* 顶部拖动条 */
@@ -541,7 +542,7 @@ function onDragEnd() { isDragging.value = false }
gap: 8px; gap: 8px;
padding: 8px 10px; padding: 8px 10px;
background: linear-gradient(135deg, var(--df-accent-bg), transparent); background: linear-gradient(135deg, var(--df-accent-bg), transparent);
border-bottom: 0.5px solid var(--df-border, rgba(123, 111, 240, 0.2)); border-bottom: 0.5px solid var(--df-border);
cursor: move; cursor: move;
user-select: none; user-select: none;
} }
@@ -632,9 +633,9 @@ function onDragEnd() { isDragging.value = false }
transition: background 0.15s var(--df-ease); transition: background 0.15s var(--df-ease);
} }
.popup-item--path { border-left-color: var(--df-accent); } .popup-item--path { border-left-color: var(--df-accent); }
.popup-item--risk { border-left-color: var(--df-warning, #f0a020); } .popup-item--risk { border-left-color: var(--df-warning); }
.popup-item:hover { .popup-item:hover {
background: var(--df-sidebar-active, rgba(123, 111, 240, 0.12)); background: var(--df-sidebar-active);
} }
.popup-item-header { .popup-item-header {
@@ -666,8 +667,8 @@ function onDragEnd() { isDragging.value = false }
color: var(--df-accent); color: var(--df-accent);
} }
.popup-item-tag--risk { .popup-item-tag--risk {
background: rgba(240, 160, 32, 0.18); background: var(--df-warning-bg);
color: var(--df-warning, #f0a020); color: var(--df-warning);
} }
.popup-item-reason { .popup-item-reason {
@@ -695,16 +696,16 @@ function onDragEnd() { isDragging.value = false }
margin-bottom: 6px; margin-bottom: 6px;
font-size: 10px; font-size: 10px;
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
color: var(--df-text-dim, #888); color: var(--df-text-dim);
border-radius: var(--df-radius-sm, 4px); border-radius: var(--df-radius-sm);
background: var(--df-bg-card, transparent); background: var(--df-bg-card);
} }
.popup-item-wait.is-long { .popup-item-wait.is-long {
color: var(--df-warning, #d97706); color: var(--df-warning);
animation: pulseGlow 1.5s ease-in-out infinite; animation: pulseGlow 1.5s ease-in-out infinite;
} }
.popup-item-wait.is-urgent { .popup-item-wait.is-urgent {
color: var(--df-danger, #e5484d); color: var(--df-danger);
animation: pulseGlow 1s ease-in-out infinite; animation: pulseGlow 1s ease-in-out infinite;
} }
@@ -741,7 +742,7 @@ function onDragEnd() { isDragging.value = false }
height: 13px; height: 13px;
padding: 0 3px; padding: 0 3px;
margin-left: 1px; margin-left: 1px;
border-radius: var(--df-radius-xs, 3px); border-radius: var(--df-radius-xs);
font-family: var(--df-font-mono); font-family: var(--df-font-mono);
font-size: 9px; font-size: 9px;
font-weight: 500; font-weight: 500;
@@ -754,7 +755,7 @@ function onDragEnd() { isDragging.value = false }
color: #fff; color: #fff;
} }
.popup-btn--approve:hover:not(:disabled) { .popup-btn--approve:hover:not(:disabled) {
background: var(--df-accent-hover, #6558d8); background: var(--df-accent-hover);
} }
/* M4:session 按钮(弱填充态,介于 approve 强填充与 always 描边之间,视觉层级 once>session>always) */ /* M4:session 按钮(弱填充态,介于 approve 强填充与 always 描边之间,视觉层级 once>session>always) */
.popup-btn--session { .popup-btn--session {
@@ -776,11 +777,11 @@ function onDragEnd() { isDragging.value = false }
.popup-btn--reject { .popup-btn--reject {
background: var(--df-sidebar-hover); background: var(--df-sidebar-hover);
color: var(--df-text-dim); color: var(--df-text-dim);
border: 0.5px solid var(--df-border, rgba(255, 255, 255, 0.1)); border: 0.5px solid var(--df-border);
} }
.popup-btn--reject:hover:not(:disabled) { .popup-btn--reject:hover:not(:disabled) {
background: rgba(255, 80, 80, 0.15); background: var(--df-danger-bg);
color: var(--df-danger, #e5484d); color: var(--df-danger);
} }
.popup-btn-spinner { .popup-btn-spinner {
width: 10px; width: 10px;
@@ -800,7 +801,7 @@ function onDragEnd() { isDragging.value = false }
gap: 6px; gap: 6px;
padding: 10px; padding: 10px;
border: none; border: none;
border-top: 0.5px solid var(--df-border, rgba(123, 111, 240, 0.2)); border-top: 0.5px solid var(--df-border);
background: var(--df-accent-bg); background: var(--df-accent-bg);
color: var(--df-accent); color: var(--df-accent);
font-size: 12px; font-size: 12px;
@@ -813,31 +814,7 @@ function onDragEnd() { isDragging.value = false }
color: #fff; color: #fff;
} }
@keyframes df-spin { /* P1-e-d:审批失败 toast:消费 global.css .df-toast 四色族+过渡(2026-10-18 整洁波并轨),
to { transform: rotate(360deg); } 仅覆写浮窗上下文定位——top 让出拖动条 header,窄窗(380px)限宽防长错误文案溢出窗口 */
} .df-toast { top: 44px; max-width: 80%; overflow-wrap: anywhere; }
/* P1-e-d:审批失败 toast(自包含 useToast;独立窗口无根 toast 自管渲染。fixed 相对本窗口视口,
top 让出 header,不遮挡审批按钮区。样式对齐 AiChat .ai-toast 同款,scoped 防冲突) */
.ai-toast {
position: fixed;
top: 44px;
left: 50%;
transform: translateX(-50%);
padding: 6px 12px;
border-radius: var(--df-radius);
font-size: 11px;
font-weight: 600;
z-index: 100;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
max-width: 80%;
overflow-wrap: anywhere;
text-align: center;
}
.ai-toast-error { background: var(--df-danger-bg); color: var(--df-danger); border: 0.5px solid var(--df-danger); }
.ai-toast-warning { background: var(--df-warning-bg); color: var(--df-warning); border: 0.5px solid var(--df-warning); }
.ai-toast-info { background: var(--df-accent-bg); color: var(--df-accent); border: 0.5px solid var(--df-accent); }
.ai-toast-success { background: var(--df-success-bg); color: var(--df-success); border: 0.5px solid var(--df-success); }
.ai-toast-enter-active, .ai-toast-leave-active { transition: opacity 0.2s, transform 0.2s; }
.ai-toast-enter-from, .ai-toast-leave-to { opacity: 0; transform: translate(-50%, -8px); }
</style> </style>
+23 -40
View File
@@ -12,11 +12,11 @@
<!-- Tab 导航 --> <!-- Tab 导航 -->
<nav class="detail-tabs audit-tabs"> <nav class="detail-tabs audit-tabs">
<button class="tab-btn" :class="{ 'tab-active': activeTab === 'audit' }" type="button" @click="switchTab('audit')"> <button class="df-tab" :class="{ 'df-tab--active': activeTab === 'audit' }" type="button" @click="switchTab('audit')">
<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> <svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>
{{ t('auditLog.tabAudit') }} {{ t('auditLog.tabAudit') }}
</button> </button>
<button class="tab-btn" :class="{ 'tab-active': activeTab === 'conversations' }" type="button" @click="switchTab('conversations')"> <button class="df-tab" :class="{ 'df-tab--active': activeTab === 'conversations' }" type="button" @click="switchTab('conversations')">
<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/></svg> <svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/></svg>
{{ t('auditLog.tabConversations') }} {{ t('auditLog.tabConversations') }}
</button> </button>
@@ -91,11 +91,11 @@
<td colspan="7"> <td colspan="7">
<div class="audit-detail"> <div class="audit-detail">
<div class="detail-section"> <div class="detail-section">
<span class="detail-label">{{ t('auditLog.col.args') }}</span> <span class="df-sec-h">{{ t('auditLog.col.args') }}</span>
<pre class="detail-pre">{{ r.arguments_brief || '—' }}</pre> <pre class="detail-pre">{{ r.arguments_brief || '—' }}</pre>
</div> </div>
<div class="detail-section"> <div class="detail-section">
<span class="detail-label">{{ t('auditLog.col.result') }}</span> <span class="df-sec-h">{{ t('auditLog.col.result') }}</span>
<!-- 外置句柄(D2a):显「结果已外置」+ 展开经 IPC 读回原文全文 --> <!-- 外置句柄(D2a):显「结果已外置」+ 展开经 IPC 读回原文全文 -->
<template v-if="offloadHandle"> <template v-if="offloadHandle">
<OffloadedResultBar <OffloadedResultBar
@@ -512,12 +512,9 @@ onMounted(() => {
/* ===== 加载/错误状态 ===== */ /* ===== 加载/错误状态 ===== */
.audit-loading { display: flex; align-items: center; justify-content: center; padding: 40px; } .audit-loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.audit-error { color: var(--df-danger); } .audit-error { color: var(--df-danger); }
.audit-spinner { animation: audit-spin 0.9s linear infinite; } /* 消费 global.css df-spin(原本地 audit-spin 重复定义已删,2026-10-18 整洁波) */
.audit-spinner { animation: df-spin 0.9s linear infinite; }
.audit-spinner--lg { color: var(--df-text-dim); } .audit-spinner--lg { color: var(--df-text-dim); }
@keyframes audit-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* ===== 表格 ===== */ /* ===== 表格 ===== */
.audit-table-wrap { .audit-table-wrap {
@@ -550,9 +547,9 @@ onMounted(() => {
vertical-align: top; vertical-align: top;
} }
.audit-table tbody tr:last-child td { border-bottom: none; } .audit-table tbody tr:last-child td { border-bottom: none; }
.audit-table tbody tr:hover td { background: var(--df-bg-hover, rgba(255,255,255,0.03)); } .audit-table tbody tr:hover td { background: var(--df-hover); }
/* 展开/hover 行高亮由 .audit-row:hover/.expanded 管理,避免选择器冲突 */ /* 展开/hover 行高亮由 .audit-row:hover/.expanded 管理,避免选择器冲突 */
.audit-table tbody tr.audit-row:hover td { background: var(--df-bg-hover, rgba(255,255,255,0.03)); } .audit-table tbody tr.audit-row:hover td { background: var(--df-hover); }
.col-time { min-width: 120px; } .col-time { min-width: 120px; }
.col-tool { min-width: 130px; } .col-tool { min-width: 130px; }
@@ -573,14 +570,14 @@ onMounted(() => {
/* 可点击行 */ /* 可点击行 */
.audit-row { cursor: pointer; transition: background 0.12s; } .audit-row { cursor: pointer; transition: background 0.12s; }
.audit-row:hover td { background: var(--df-bg-hover, rgba(255,255,255,0.03)); } .audit-row:hover td { background: var(--df-hover); }
.audit-row.expanded td { background: var(--df-bg-hover, rgba(255,255,255,0.04)); } .audit-row.expanded td { background: var(--df-hover); }
/* 展开详情行 */ /* 展开详情行 */
.audit-detail-row td { padding: 0 !important; border-bottom: 0.5px solid var(--df-border); } .audit-detail-row td { padding: 0 !important; border-bottom: 0.5px solid var(--df-border); }
.audit-detail { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; } .audit-detail { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.detail-section { display: flex; flex-direction: column; gap: 4px; } .detail-section { display: flex; flex-direction: column; gap: 4px; }
.detail-label { font-size: 11px; color: var(--df-text-dim); text-transform: uppercase; letter-spacing: 0.5px; } /* 小节头走公共 .df-sec-h */
.detail-pre { .detail-pre {
margin: 0; padding: 8px 10px; margin: 0; padding: 8px 10px;
background: var(--df-bg); background: var(--df-bg);
@@ -604,7 +601,7 @@ onMounted(() => {
font-size: 11px; font-size: 11px;
color: var(--df-accent); color: var(--df-accent);
background: var(--df-accent-bg); background: var(--df-accent-bg);
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
} }
@@ -621,7 +618,7 @@ onMounted(() => {
display: inline-block; display: inline-block;
font-size: 10px; font-size: 10px;
font-weight: 600; font-weight: 600;
padding: 1px 7px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
background: var(--df-warning-bg); background: var(--df-warning-bg);
color: var(--df-warning); color: var(--df-warning);
@@ -636,7 +633,7 @@ onMounted(() => {
padding: 2px 8px; padding: 2px 8px;
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
} }
.risk-low { background: rgba(90,99,128,0.2); color: var(--df-text-dim); } .risk-low { background: var(--df-neutral-bg); color: var(--df-text-dim); }
.risk-medium { background: var(--df-warning-bg); color: var(--df-warning); } .risk-medium { background: var(--df-warning-bg); color: var(--df-warning); }
.risk-high { background: var(--df-danger-bg); color: var(--df-danger); } .risk-high { background: var(--df-danger-bg); color: var(--df-danger); }
@@ -645,7 +642,7 @@ onMounted(() => {
display: inline-block; display: inline-block;
font-size: 11px; font-size: 11px;
font-weight: 500; font-weight: 500;
padding: 3px 10px; padding: var(--df-pad-badge);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
white-space: nowrap; white-space: nowrap;
} }
@@ -655,7 +652,7 @@ onMounted(() => {
.status-executing { background: var(--df-info-bg); color: var(--df-info); } .status-executing { background: var(--df-info-bg); color: var(--df-info); }
.status-completed { background: var(--df-success-bg); color: var(--df-success); } .status-completed { background: var(--df-success-bg); color: var(--df-success); }
.status-failed { background: var(--df-danger-bg); color: var(--df-danger); } .status-failed { background: var(--df-danger-bg); color: var(--df-danger); }
.status-interrupted { background: rgba(90,99,128,0.2); color: var(--df-text-dim); } .status-interrupted { background: var(--df-neutral-bg); color: var(--df-text-dim); }
/* 决策者 tag */ /* 决策者 tag */
.decided-tag { .decided-tag {
@@ -667,7 +664,7 @@ onMounted(() => {
white-space: nowrap; /* 窄列防 CJK 逐字竖排(对齐 .status-tag) */ white-space: nowrap; /* 窄列防 CJK 逐字竖排(对齐 .status-tag) */
} }
.decided-human { background: var(--df-accent-bg); color: var(--df-accent); } .decided-human { background: var(--df-accent-bg); color: var(--df-accent); }
.decided-auto { background: rgba(90,99,128,0.2); color: var(--df-text-dim); } .decided-auto { background: var(--df-neutral-bg); color: var(--df-text-dim); }
.decided-none { color: var(--df-text-dim); } .decided-none { color: var(--df-text-dim); }
/* ===== 分页 ===== */ /* ===== 分页 ===== */
@@ -691,29 +688,15 @@ onMounted(() => {
/* empty-state 已提取到 global.css 全局 */ /* empty-state 已提取到 global.css 全局 */
/* ===== Tab 导航(对齐 ProjectDetail 同款交互) ===== */ /* ===== Tab 导航(公共 .df-tab 下划线范式,此处仅补底线叠齐/hover) ===== */
.audit-tabs { .audit-tabs {
display: flex; display: flex;
gap: 4px; gap: 4px;
border-bottom: 0.5px solid var(--df-border); border-bottom: 0.5px solid var(--df-border);
margin-bottom: 16px; margin-bottom: 16px;
} }
.audit-tabs .tab-btn { .audit-tabs .df-tab { margin-bottom: -0.5px; }
padding: 8px 16px; .audit-tabs .df-tab:hover { color: var(--df-text); }
background: transparent;
border: none;
border-bottom: 2px solid transparent;
color: var(--df-text-dim);
font-size: 13px;
cursor: pointer;
transition: color 0.15s, border-color 0.15s;
margin-bottom: -0.5px;
}
.audit-tabs .tab-btn:hover { color: var(--df-text); }
.audit-tabs .tab-btn.tab-active {
color: var(--df-text);
border-bottom-color: var(--df-accent);
}
/* ===== 对话历史 ===== */ /* ===== 对话历史 ===== */
.conv-split { .conv-split {
@@ -782,9 +765,9 @@ onMounted(() => {
} }
.conv-msg-role { font-size: 12px; font-weight: 500; color: var(--df-text); } .conv-msg-role { font-size: 12px; font-weight: 500; color: var(--df-text); }
.conv-msg-model, .conv-msg-toolname, .conv-msg-token { .conv-msg-model, .conv-msg-toolname, .conv-msg-token {
font-size: 10px; padding: 1px 6px; font-size: 10px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
background: rgba(90,99,128,0.2); color: var(--df-text-dim); background: var(--df-neutral-bg); color: var(--df-text-dim);
} }
.conv-msg-token { font-family: var(--df-font-mono); color: var(--df-info); background: var(--df-info-bg); } .conv-msg-token { font-family: var(--df-font-mono); color: var(--df-info); background: var(--df-info-bg); }
.conv-msg-time { font-size: 10px; color: var(--df-text-dim); margin-left: auto; } .conv-msg-time { font-size: 10px; color: var(--df-text-dim); margin-left: auto; }
@@ -818,7 +801,7 @@ onMounted(() => {
padding: 6px 10px; padding: 6px 10px;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: var(--df-warning-bg); background: var(--df-warning-bg);
border: 0.5px solid rgba(240,199,94,0.2); border: 0.5px solid var(--df-warning-bd);
} }
.conv-msg-toolcall-head { .conv-msg-toolcall-head {
display: flex; align-items: center; gap: 8px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
+7 -25
View File
@@ -1,12 +1,12 @@
<template> <template>
<div class="dashboard"> <div class="dashboard">
<!-- ═══ Header ═══ --> <!-- ═══ Header(全局 .page-header 46px 紧凑单行,标题/间距不再自造) ═══ -->
<header class="dash-header"> <header class="page-header">
<div class="dash-header-left"> <div class="dash-header-left">
<h1 class="dash-title">{{ $t('dashboard.title') }}</h1> <h1>{{ $t('dashboard.title') }}</h1>
<span class="dash-subtitle">{{ $t('dashboard.subtitle') }}</span> <span class="dash-subtitle">{{ $t('dashboard.subtitle') }}</span>
</div> </div>
<div class="dash-header-right"> <div class="header-actions">
<button class="btn btn-ghost btn-sm dash-refresh-btn" @click="refresh" :disabled="loading" :title="$t('dashboard.refresh')" :aria-label="$t('dashboard.refresh')"> <button class="btn btn-ghost btn-sm dash-refresh-btn" @click="refresh" :disabled="loading" :title="$t('dashboard.refresh')" :aria-label="$t('dashboard.refresh')">
<svg aria-hidden="true" v-if="loading" class="dash-spinner" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 12a9 9 0 11-6.219-8.56"/></svg> <svg aria-hidden="true" v-if="loading" class="dash-spinner" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 12a9 9 0 11-6.219-8.56"/></svg>
<svg aria-hidden="true" v-else width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 11-2.12-9.36L23 10"/></svg> <svg aria-hidden="true" v-else width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 11-2.12-9.36L23 10"/></svg>
@@ -111,20 +111,7 @@ onMounted(() => {
<style scoped> <style scoped>
.dashboard { padding: 16px 20px 20px; } .dashboard { padding: 16px 20px 20px; }
/* ═══ Header ═══ */ /* ═══ Header(容器/标题走全局 .page-header,此处仅保留副标题装饰) ═══ */
.dash-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 14px;
}
.dash-title {
font-size: 18px;
font-weight: 500;
letter-spacing: -0.4px;
color: var(--df-text);
line-height: 1.2;
}
.dash-subtitle { .dash-subtitle {
font-size: 11px; font-size: 11px;
color: var(--df-text-dim); color: var(--df-text-dim);
@@ -140,14 +127,9 @@ onMounted(() => {
background: var(--df-success); background: var(--df-success);
display: inline-block; display: inline-block;
} }
.dash-header-right { display: flex; gap: 6px; align-items: center; }
/* 刷新按钮图标旋转动画(加载中反馈) */ /* 刷新按钮图标旋转动画(加载中反馈);消费 global.css df-spin(原本地 dash-spin 重复定义已删) */
.dash-spinner { animation: dash-spin 0.9s linear infinite; } .dash-spinner { animation: df-spin 0.9s linear infinite; }
@keyframes dash-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* ═══ Grid Layout ═══ */ /* ═══ Grid Layout ═══ */
.dash-grid { .dash-grid {
+4 -9
View File
@@ -606,12 +606,6 @@ watch(() => route.params.id, (id) => {
.idea-card:hover { background: var(--df-accent-bg); } .idea-card:hover { background: var(--df-accent-bg); }
.idea-card.selected { background: var(--df-accent-soft); border: 0.5px solid var(--df-accent); } .idea-card.selected { background: var(--df-accent-soft); border: 0.5px solid var(--df-accent); }
.idea-card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 6px;
}
.idea-title { font-size: 14px; font-weight: 500; color: var(--df-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .idea-title { font-size: 14px; font-weight: 500; color: var(--df-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idea-score { .idea-score {
@@ -620,9 +614,10 @@ watch(() => route.params.id, (id) => {
display: flex; align-items: center; justify-content: center; display: flex; align-items: center; justify-content: center;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
} }
.score-high { background: rgba(100,255,218,0.15); color: var(--df-success); } /* 评分徽章底统一走语义 token(双主题自适应) */
.score-mid { background: rgba(255,217,61,0.15); color: var(--df-warning); } .score-high { background: var(--df-success-bg); color: var(--df-success); }
.score-low { background: rgba(255,107,107,0.15); color: var(--df-danger); } .score-mid { background: var(--df-warning-bg); color: var(--df-warning); }
.score-low { background: var(--df-danger-bg); color: var(--df-danger); }
.idea-desc-preview { font-size: 12px; color: var(--df-text-dim); margin-bottom: 8px; line-height: 1.4; } .idea-desc-preview { font-size: 12px; color: var(--df-text-dim); margin-bottom: 8px; line-height: 1.4; }
+23 -38
View File
@@ -8,9 +8,9 @@
</div> </div>
</header> </header>
<!-- ⑤ 操作反馈 toast(保存/发布/拒绝/归档/创建成功 + 保存失败)--> <!-- ⑤ 操作反馈 toast(保存/发布/拒绝/归档/创建成功 + 保存失败);样式消费全局 .df-toast 族,error 映射 danger -->
<Transition name="toast"> <Transition name="df-toast">
<div v-if="toast.visible" class="toast" :class="'toast-' + toast.type">{{ toast.msg }}</div> <div v-if="toast.visible" class="df-toast" :class="toast.type === 'error' ? 'df-toast--danger' : 'df-toast--' + toast.type">{{ toast.msg }}</div>
</Transition> </Transition>
<!-- 错误条:消费 store.error(样式全局 .error-banner,仅间距用页面变量) --> <!-- 错误条:消费 store.error(样式全局 .error-banner,仅间距用页面变量) -->
@@ -21,20 +21,20 @@
<!-- 顶层 Tab: 知识库 / 审核收件箱 --> <!-- 顶层 Tab: 知识库 / 审核收件箱 -->
<div class="top-tabs"> <div class="top-tabs">
<button class="top-tab" :class="{ active: topTab === 'library' }" @click="switchTopTab('library')"> <button class="df-tab" :class="{ 'df-tab--active': topTab === 'library' }" @click="switchTopTab('library')">
{{ $t('knowledge.tab.library') }} {{ $t('knowledge.tab.library') }}
</button> </button>
<button class="top-tab" :class="{ active: topTab === 'inbox' }" @click="switchTopTab('inbox')"> <button class="df-tab" :class="{ 'df-tab--active': topTab === 'inbox' }" @click="switchTopTab('inbox')">
{{ $t('knowledge.tab.inbox') }} {{ $t('knowledge.tab.inbox') }}
<span v-if="store.candidates.length" class="inbox-badge">{{ store.candidates.length }}</span> <span v-if="store.candidates.length" class="inbox-badge">{{ store.candidates.length }}</span>
</button> </button>
<!-- 归档箱(2026-10-05 归档功能尾巴):低频可见可恢复,与回收站/正式库分池 --> <!-- 归档箱(2026-10-05 归档功能尾巴):低频可见可恢复,与回收站/正式库分池 -->
<button class="top-tab" :class="{ active: topTab === 'archived' }" @click="switchTopTab('archived')"> <button class="df-tab" :class="{ 'df-tab--active': topTab === 'archived' }" @click="switchTopTab('archived')">
🗄️ {{ $t('knowledge.tab.archived') }} 🗄️ {{ $t('knowledge.tab.archived') }}
<span v-if="store.archived.length" class="inbox-badge">{{ store.archived.length }}</span> <span v-if="store.archived.length" class="inbox-badge">{{ store.archived.length }}</span>
</button> </button>
<!-- 拒绝池(2026-10-05 分池):审核否决独立可见,与归档分池 --> <!-- 拒绝池(2026-10-05 分池):审核否决独立可见,与归档分池 -->
<button class="top-tab" :class="{ active: topTab === 'rejected' }" @click="switchTopTab('rejected')"> <button class="df-tab" :class="{ 'df-tab--active': topTab === 'rejected' }" @click="switchTopTab('rejected')">
🚫 {{ $t('knowledge.tab.rejected') }} 🚫 {{ $t('knowledge.tab.rejected') }}
<span v-if="store.rejected.length" class="inbox-badge">{{ store.rejected.length }}</span> <span v-if="store.rejected.length" class="inbox-badge">{{ store.rejected.length }}</span>
</button> </button>
@@ -487,35 +487,19 @@ onMounted(() => {
<style scoped> <style scoped>
.knowledge { padding: 16px 20px 20px; height: 100%; display: flex; flex-direction: column; container-type: inline-size; } .knowledge { padding: 16px 20px 20px; height: 100%; display: flex; flex-direction: column; container-type: inline-size; }
/* ===== 顶部 Toast 提示(⑤ 操作反馈,对齐 Settings.vue)===== */ /* 顶部 Toast 提示:已消费 global.css .df-toast 四色族+过渡(2026-10-18 整洁波并轨) */
.toast {
position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
z-index: 1000; padding: 8px 16px; border-radius: var(--df-radius-sm);
font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.toast-error { background: var(--df-danger-bg); color: var(--df-danger); border: 0.5px solid var(--df-danger); }
.toast-warning { background: var(--df-warning-bg); color: var(--df-warning); border: 0.5px solid var(--df-warning); }
.toast-info { background: var(--df-accent-bg); color: var(--df-accent); border: 0.5px solid var(--df-accent); }
.toast-success { background: var(--df-success-bg); color: var(--df-success); border: 0.5px solid var(--df-success); }
.toast-enter-active, .toast-leave-active { transition: opacity 0.2s, transform 0.2s; }
.toast-enter-from, .toast-leave-to { opacity: 0; transform: translate(-50%, -8px); }
/* page-header / btn / modal 等已提取到 global.css 全局 */ /* page-header / btn / modal 等已提取到 global.css 全局 */
/* ===== 错误条样式已提取到 styles/components.css 全局(.error-banner) ===== */ /* ===== 错误条样式已提取到 styles/components.css 全局(.error-banner) ===== */
/* ===== 顶层 Tab ===== */ /* ===== 顶层 Tab(公共 .df-tab 下划线范式,此处仅补本页布局/hover) ===== */
.top-tabs { display: flex; gap: 4px; margin-bottom: var(--df-gap-page); border-bottom: 0.5px solid var(--df-border); } .top-tabs { display: flex; gap: 4px; margin-bottom: var(--df-gap-page); border-bottom: 0.5px solid var(--df-border); }
.top-tab { .top-tabs .df-tab { display: flex; align-items: center; gap: 6px; }
padding: 8px 16px; border: none; background: transparent; color: var(--df-text-secondary); .top-tabs .df-tab:hover { color: var(--df-text); }
font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
display: flex; align-items: center; gap: 6px;
}
.top-tab:hover { color: var(--df-text); }
.top-tab.active { color: var(--df-accent); border-bottom-color: var(--df-accent); }
.inbox-badge { .inbox-badge {
font-size: 11px; background: var(--df-danger); color: #fff; font-size: 11px; background: var(--df-danger); color: #fff;
padding: 1px 6px; border-radius: var(--df-radius); min-width: 16px; text-align: center; padding: var(--df-pad-chip); border-radius: var(--df-radius); min-width: 16px; text-align: center;
} }
/* ===== 左右分栏 ===== */ /* ===== 左右分栏 ===== */
@@ -524,7 +508,7 @@ onMounted(() => {
flex: 1; min-height: 0; flex: 1; min-height: 0;
} }
.kn-list-panel, .kn-detail-panel { .kn-list-panel, .kn-detail-panel {
background: var(--df-bg-panel, var(--df-bg-card)); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-lg); border-radius: var(--df-radius-lg);
overflow: hidden; display: flex; flex-direction: column; overflow: hidden; display: flex; flex-direction: column;
@@ -564,7 +548,7 @@ onMounted(() => {
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
} }
.kn-card-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--df-text-dim); flex-wrap: wrap; } .kn-card-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--df-text-dim); flex-wrap: wrap; }
.meta-kind { background: rgba(90,99,128,0.2); padding: 1px 6px; border-radius: var(--df-radius-sm); } .meta-kind { background: var(--df-neutral-bg); padding: var(--df-pad-chip); border-radius: var(--df-radius-sm); }
.meta-reuse { color: var(--df-info); } .meta-reuse { color: var(--df-info); }
.list-empty { text-align: center; padding: 40px 0; color: var(--df-text-dim); font-size: 13px; } .list-empty { text-align: center; padding: 40px 0; color: var(--df-text-dim); font-size: 13px; }
@@ -574,14 +558,15 @@ onMounted(() => {
/* 状态徽章 / 置信度(列表卡片复用,详情由子组件 scoped 自带) */ /* 状态徽章 / 置信度(列表卡片复用,详情由子组件 scoped 自带) */
.kn-card-status { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--df-radius-xs); white-space: nowrap; } .kn-card-status { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--df-radius-xs); white-space: nowrap; }
.st-candidate { background: rgba(255,217,61,0.15); color: var(--df-warning); } /* 状态/置信度徽章底统一走语义 token(双主题自适应) */
.st-pending_review { background: rgba(108,159,255,0.15); color: var(--df-info); } .st-candidate { background: var(--df-warning-bg); color: var(--df-warning); }
.st-published { background: rgba(100,255,218,0.15); color: var(--df-success); } .st-pending_review { background: var(--df-info-bg); color: var(--df-info); }
.st-archived { background: rgba(90,99,128,0.2); color: var(--df-text-dim); } .st-published { background: var(--df-success-bg); color: var(--df-success); }
.st-rejected { background: rgba(240,84,110,0.15); color: var(--df-danger); } .st-archived { background: var(--df-neutral-bg); color: var(--df-text-dim); }
.conf-high { background: rgba(100,255,218,0.15); color: var(--df-success); padding: 1px 6px; border-radius: var(--df-radius-xs); } .st-rejected { background: var(--df-danger-bg); color: var(--df-danger); }
.conf-medium { background: rgba(255,217,61,0.15); color: var(--df-warning); padding: 1px 6px; border-radius: var(--df-radius-xs); } .conf-high { background: var(--df-success-bg); color: var(--df-success); padding: var(--df-pad-chip); border-radius: var(--df-radius-xs); }
.conf-low { background: rgba(255,107,107,0.15); color: var(--df-danger); padding: 1px 6px; border-radius: var(--df-radius-xs); } .conf-medium { background: var(--df-warning-bg); color: var(--df-warning); padding: var(--df-pad-chip); border-radius: var(--df-radius-xs); }
.conf-low { background: var(--df-danger-bg); color: var(--df-danger); padding: var(--df-pad-chip); border-radius: var(--df-radius-xs); }
/* form-row / form-input / form-select / form-textarea 已随新建/编辑弹层随 KnowledgeDetail 子组件迁移,此处仅保留本壳所需特有覆盖。 */ /* form-row / form-input / form-select / form-textarea 已随新建/编辑弹层随 KnowledgeDetail 子组件迁移,此处仅保留本壳所需特有覆盖。 */
.form-row { margin-bottom: 12px; } .form-row { margin-bottom: 12px; }
+57 -57
View File
@@ -66,24 +66,24 @@
<!-- Tab 导航(概览 / 文件浏览器) --> <!-- Tab 导航(概览 / 文件浏览器) -->
<nav class="detail-tabs"> <nav class="detail-tabs">
<button <button
class="tab-btn" class="df-tab"
:class="{ 'tab-active': activeTab === 'overview' }" :class="{ 'df-tab--active': activeTab === 'overview' }"
type="button" type="button"
@click="setActiveTab('overview')" @click="setActiveTab('overview')"
> >
{{ $t('projectDetail.tabOverview') }} {{ $t('projectDetail.tabOverview') }}
</button> </button>
<button <button
class="tab-btn" class="df-tab"
:class="{ 'tab-active': activeTab === 'files' }" :class="{ 'df-tab--active': activeTab === 'files' }"
type="button" type="button"
@click="setActiveTab('files')" @click="setActiveTab('files')"
> >
{{ $t('fileExplorer.tabTitle') }} {{ $t('fileExplorer.tabTitle') }}
</button> </button>
<button <button
class="tab-btn" class="df-tab"
:class="{ 'tab-active': activeTab === 'graph' }" :class="{ 'df-tab--active': activeTab === 'graph' }"
type="button" type="button"
@click="setActiveTab('graph')" @click="setActiveTab('graph')"
> >
@@ -177,7 +177,7 @@
<!-- 工程列表(hover 显行内操作) --> <!-- 工程列表(hover 显行内操作) -->
<div v-else class="module-list-overview"> <div v-else class="module-list-overview">
<div v-for="m in modules" :key="m.id" class="module-row-overview"> <div v-for="m in modules" :key="m.id" class="module-row-overview df-row">
<div class="module-row-head"> <div class="module-row-head">
<span class="module-name-overview">{{ m.name }}</span> <span class="module-name-overview">{{ m.name }}</span>
<span v-if="moduleStatusOf(m) === 'archived'" class="module-status-badge module-status-archived">{{ $t('projectDetail.moduleStatusArchived') }}</span> <span v-if="moduleStatusOf(m) === 'archived'" class="module-status-badge module-status-archived">{{ $t('projectDetail.moduleStatusArchived') }}</span>
@@ -1335,17 +1335,13 @@ onBeforeUnmount(() => {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
} }
/* 发丝线分隔行走全局 .df-row(8px 0 + border-bottom + 末行无线),此处只管行内布局 */
.module-row-overview { .module-row-overview {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: 4px;
padding: 6px 0;
border-bottom: 1px solid var(--df-border, rgba(0, 0, 0, 0.06));
min-width: 0; min-width: 0;
} }
.module-row-overview:last-child {
border-bottom: none;
}
.module-row-head { .module-row-head {
display: flex; display: flex;
align-items: baseline; align-items: baseline;
@@ -1387,30 +1383,31 @@ onBeforeUnmount(() => {
gap: 4px; gap: 4px;
} }
.module-stack-overview .tech-tag { .module-stack-overview .tech-tag {
font-size: 11px; font-size: var(--df-fs-aux);
padding: 1px 6px; padding: var(--df-pad-chip);
} }
.module-status-badge { .module-status-badge {
font-size: 11px; font-size: var(--df-fs-aux);
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: 8px; border-radius: var(--df-radius-xs);
font-weight: 500; font-weight: 500;
flex-shrink: 0; flex-shrink: 0;
} }
/* 模块状态徽章底统一语义 token(双主题自适应) */
.module-status-active { .module-status-active {
color: var(--df-success, #16a34a); color: var(--df-success);
background: rgba(22, 163, 74, 0.1); background: var(--df-success-bg);
} }
.module-status-archived { .module-status-archived {
color: var(--df-text-dim, #888); color: var(--df-text-dim);
background: rgba(136, 136, 136, 0.12); background: var(--df-neutral-bg);
} }
.status-badge { .status-badge {
display: inline-block; display: inline-block;
padding: 2px 8px; padding: var(--df-pad-badge);
border-radius: var(--df-radius-lg); border-radius: var(--df-radius-xs);
font-size: 11px; font-size: var(--df-fs-aux);
font-weight: 500; font-weight: 500;
background: var(--df-accent-bg); background: var(--df-accent-bg);
color: var(--df-accent); color: var(--df-accent);
@@ -1499,30 +1496,26 @@ onBeforeUnmount(() => {
.project-detail { padding: 16px 20px 20px; display: flex; flex-direction: column; height: 100%; min-height: 0; max-height: 100%; overflow: hidden; } .project-detail { padding: 16px 20px 20px; display: flex; flex-direction: column; height: 100%; min-height: 0; max-height: 100%; overflow: hidden; }
/* ===== Tab 导航(Batch 10 文件浏览器) ===== */ /* ===== Tab 导航(Batch 10 文件浏览器) ===== */
/* 按钮走全局 .df-tab/.df-tab--active(下划线范式),此处仅归零 button 默认样式;
不动 border-bottom,激活底线交由全局 --active 染色 */
.detail-tabs { .detail-tabs {
display: flex; display: flex;
gap: 4px; gap: 4px;
border-bottom: 0.5px solid var(--df-border); border-bottom: 0.5px solid var(--df-border);
margin-bottom: 16px; margin-bottom: 16px;
} }
.tab-btn { .detail-tabs .df-tab {
padding: 8px 16px; background: none;
background: transparent; border-top: none;
border: none; border-left: none;
border-bottom: 2px solid transparent; border-right: none;
color: var(--df-text-dim); font-family: inherit;
font-size: 13px; margin-bottom: -0.5px; /* 压盖容器发丝线,激活底线与容器边线重合 */
cursor: pointer;
transition: color 0.15s, border-color 0.15s; transition: color 0.15s, border-color 0.15s;
margin-bottom: -0.5px;
} }
.tab-btn:hover { .detail-tabs .df-tab:hover {
color: var(--df-text); color: var(--df-text);
} }
.tab-btn.tab-active {
color: var(--df-text);
border-bottom-color: var(--df-accent);
}
/* 文件浏览器容器(弹性填充,内部 FileExplorer 自管布局) */ /* 文件浏览器容器(弹性填充,内部 FileExplorer 自管布局) */
.file-explorer-wrap { .file-explorer-wrap {
@@ -1536,9 +1529,9 @@ onBeforeUnmount(() => {
/* .back-link / .back-link:hover 已提取到 styles/global.css 全局 */ /* .back-link / .back-link:hover 已提取到 styles/global.css 全局 */
.stage-badge { .stage-badge {
font-size: 12px; font-size: var(--df-fs-ctrl);
padding: 3px 10px; padding: var(--df-pad-badge);
border-radius: var(--df-radius-lg); border-radius: var(--df-radius-xs);
font-weight: 500; font-weight: 500;
} }
/* 阶段色全走语义 token(对齐全站约定:releasing/completed=success,见 ActiveProjectsPanel dot-release) */ /* 阶段色全走语义 token(对齐全站约定:releasing/completed=success,见 ActiveProjectsPanel dot-release) */
@@ -1554,6 +1547,13 @@ onBeforeUnmount(() => {
/* .btn 系列(btn/btn-primary/btn-ghost/btn-sm/btn-danger)已提取到 styles/global.css 全局 */ /* .btn 系列(btn/btn-primary/btn-ghost/btn-sm/btn-danger)已提取到 styles/global.css 全局 */
/* 同步/扫描/保存按钮内 spinner(此前本页无 .spinner 定义致加载态不可见;消费全局 df-spin) */
.spinner {
width: 12px; height: 12px;
border: 1.5px solid var(--df-border); border-top-color: var(--df-accent);
border-radius: 50%; animation: df-spin 0.8s linear infinite; display: inline-block;
}
/* ===== 概览布局(P1-g+ 问题10②:三栏拥挤 → 两栏 + 日志下方)===== /* ===== 概览布局(P1-g+ 问题10②:三栏拥挤 → 两栏 + 日志下方)=====
.detail-overview 整体滚动;内部 .detail-grid 两栏(项目信息 + 任务列表), .detail-overview 整体滚动;内部 .detail-grid 两栏(项目信息 + 任务列表),
.workflow-log-panel 跨整宽放下方。无日志记录时折叠为摘要不占整栏。 */ .workflow-log-panel 跨整宽放下方。无日志记录时折叠为摘要不占整栏。 */
@@ -1602,12 +1602,12 @@ onBeforeUnmount(() => {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 3px; gap: 3px;
padding: 2px 8px; padding: var(--df-pad-badge);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: 10px; border-radius: var(--df-radius-xs);
background: transparent; background: transparent;
color: var(--df-text-dim); color: var(--df-text-dim);
font-size: 10px; font-size: var(--df-fs-meta);
cursor: pointer; cursor: pointer;
transition: background 0.15s, color 0.15s, border-color 0.15s; transition: background 0.15s, color 0.15s, border-color 0.15s;
white-space: nowrap; white-space: nowrap;
@@ -1624,13 +1624,13 @@ onBeforeUnmount(() => {
} }
/* 状态色类已全局化至 components.css,scoped 不重复定义 */ /* 状态色类已全局化至 components.css,scoped 不重复定义 */
/* A2[PD-P1-3]:工作流日志「全局事件」标注(次要小字标签) */ /* A2[PD-P1-3]:工作流日志「全局事件」标注(次要小字标签,背景走中性徽章 token) */
.global-event-tag { .global-event-tag {
font-size: 10px; font-size: var(--df-fs-meta);
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: 8px; border-radius: var(--df-radius-xs);
color: var(--df-text-dim); color: var(--df-text-dim);
background: rgba(136, 136, 136, 0.12); background: var(--df-neutral-bg);
flex-shrink: 0; flex-shrink: 0;
} }
@@ -1674,7 +1674,7 @@ onBeforeUnmount(() => {
.task-card:last-child { border-bottom: none; } .task-card:last-child { border-bottom: none; }
.task-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; } .task-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.task-title { font-size: 14px; font-weight: 500; color: var(--df-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .task-title { font-size: 14px; font-weight: 500; color: var(--df-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-status { font-size: 11px; padding: 4px 10px; border-radius: var(--df-radius-sm); } .task-status { font-size: var(--df-fs-aux); padding: var(--df-pad-badge); border-radius: var(--df-radius-xs); }
/* 状态色类已全局化至 components.css;此处仅保留本视图特有的进度覆盖 */ /* 状态色类已全局化至 components.css;此处仅保留本视图特有的进度覆盖 */
.status-progress { background: var(--df-accent-soft); color: var(--df-accent); } .status-progress { background: var(--df-accent-soft); color: var(--df-accent); }
@@ -1686,12 +1686,12 @@ onBeforeUnmount(() => {
} }
.branch-icon { color: var(--df-accent); font-size: 13px; } .branch-icon { color: var(--df-accent); font-size: 13px; }
.branch-name { .branch-name {
font-size: 12px; font-size: var(--df-fs-ctrl);
font-family: 'SF Mono', 'Fira Code', monospace; font-family: 'SF Mono', 'Fira Code', monospace;
color: var(--df-text-secondary); color: var(--df-text-secondary);
background: var(--df-accent-bg); background: var(--df-accent-bg);
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-xs);
} }
.task-meta { .task-meta {
display: flex; display: flex;
@@ -1711,7 +1711,7 @@ onBeforeUnmount(() => {
display: flex; display: flex;
gap: 8px; gap: 8px;
padding: 5px 0; padding: 5px 0;
border-bottom: 0.5px solid rgba(42,42,74,0.5); border-bottom: 0.5px solid var(--df-border);
} }
.log-item:last-child { border-bottom: none; } .log-item:last-child { border-bottom: none; }
.log-time { color: var(--df-text-dim); min-width: 64px; } .log-time { color: var(--df-text-dim); min-width: 64px; }
@@ -1719,9 +1719,9 @@ onBeforeUnmount(() => {
min-width: 42px; min-width: 42px;
font-weight: 500; font-weight: 500;
text-transform: uppercase; text-transform: uppercase;
font-size: 10px; font-size: var(--df-fs-meta);
padding: 1px 4px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-xs);
text-align: center; text-align: center;
} }
.log-info .log-level { color: var(--df-info); } .log-info .log-level { color: var(--df-info); }
+8 -38
View File
@@ -206,8 +206,8 @@
<!-- 确认弹层(删除/彻底删除,替代原生 window.confirm) --> <!-- 确认弹层(删除/彻底删除,替代原生 window.confirm) -->
<ConfirmDialog :visible="confirmState.visible" :msg="confirmState.msg" @result="answerConfirm" /> <ConfirmDialog :visible="confirmState.visible" :msg="confirmState.msg" @result="answerConfirm" />
<!-- 批量导入结果 toast --> <!-- 批量导入结果 toast(全局 .df-toast 族+底部变体;error 映射 danger) -->
<div v-if="toast.visible" class="toast" :class="'toast-' + toast.type">{{ toast.msg }}</div> <div v-if="toast.visible" class="df-toast df-toast--bottom" :class="toast.type === 'error' ? 'df-toast--danger' : 'df-toast--' + toast.type">{{ toast.msg }}</div>
</div> </div>
</template> </template>
@@ -524,8 +524,8 @@ async function runImport() {
/* page-header / btn / modal 系列已提取到 global.css 全局 */ /* page-header / btn / modal 系列已提取到 global.css 全局 */
/* 本页特有:.btn-danger(全局尚未提供)、.btn:disabled(全局仅 .btn-primary:disabled) */ /* 本页特有:.btn-danger(全局尚未提供)、.btn:disabled(全局仅 .btn-primary:disabled) */
.btn-danger { background: transparent; color: var(--df-danger); border: 0.5px solid rgba(240,101,101,0.4); } .btn-danger { background: transparent; color: var(--df-danger); border: 0.5px solid var(--df-danger-bd); }
.btn-danger:hover { background: rgba(240,101,101,0.12); } .btn-danger:hover { background: var(--df-danger-bg); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; } .btn:disabled { opacity: 0.4; cursor: not-allowed; }
/* ===== 卡片网格 ===== */ /* ===== 卡片网格 ===== */
@@ -565,27 +565,7 @@ async function runImport() {
color: var(--df-accent); color: var(--df-accent);
} }
/* ===== 进度条 ===== */ /* 进度条族(.card-progress/.progress-*)已随卡片渲染迁至 ProjectCard.vue,本页残留定义已删(2026-10-18 整洁波) */
.card-progress { margin-bottom: 16px; }
.progress-label-row {
display: flex;
justify-content: space-between;
margin-bottom: 6px;
}
.progress-stage { font-size: 12px; color: var(--df-text-dim); }
.progress-pct { font-size: 12px; font-weight: 500; color: var(--df-text); }
.progress-bar {
height: 6px;
background: var(--df-border);
border-radius: var(--df-radius-sm);
overflow: hidden;
}
.progress-fill {
height: 100%;
background: var(--df-accent);
border-radius: var(--df-radius-sm);
transition: width 0.3s;
}
/* ===== 技术栈标签:基础样式已收敛至全局 components.css(DRY 收口 ), /* ===== 技术栈标签:基础样式已收敛至全局 components.css(DRY 收口 ),
创建/导入模态与本页 ProjectCard 渲染的标签均走全局 .tech-tag/.card-tags。 ===== */ 创建/导入模态与本页 ProjectCard 渲染的标签均走全局 .tech-tag/.card-tags。 ===== */
@@ -606,7 +586,7 @@ async function runImport() {
.error-banner { .error-banner {
display: flex; align-items: center; justify-content: space-between; gap: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
padding: 8px 12px; margin-bottom: var(--df-gap-page); padding: 8px 12px; margin-bottom: var(--df-gap-page);
background: rgba(255,107,107,0.12); border: 0.5px solid var(--df-danger); background: var(--df-danger-bg); border: 0.5px solid var(--df-danger);
border-radius: var(--df-radius-sm); color: var(--df-danger); font-size: 12px; border-radius: var(--df-radius-sm); color: var(--df-danger); font-size: 12px;
} }
.error-text { word-break: break-word; } .error-text { word-break: break-word; }
@@ -653,20 +633,10 @@ async function runImport() {
.import-table .col-path { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--df-font-mono, monospace); font-size: 11px; } .import-table .col-path { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--df-font-mono, monospace); font-size: 11px; }
.row-disabled { opacity: 0.5; } .row-disabled { opacity: 0.5; }
.imp-name { font-weight: 500; color: var(--df-text); } .imp-name { font-weight: 500; color: var(--df-text); }
.mono-tag { margin-left: 6px; font-size: 10px; padding: 1px 6px; border-radius: var(--df-radius-xs); background: rgba(255,217,61,0.15); color: var(--df-warning); border: 0.5px solid var(--df-border); } .mono-tag { margin-left: 6px; font-size: 10px; padding: var(--df-pad-chip); border-radius: var(--df-radius-xs); background: var(--df-warning-bg); color: var(--df-warning); border: 0.5px solid var(--df-border); }
.bound-mark { color: var(--df-success); font-weight: 600; } .bound-mark { color: var(--df-success); font-weight: 600; }
.selection-count { margin-right: auto; font-size: 12px; color: var(--df-text-dim); } .selection-count { margin-right: auto; font-size: 12px; color: var(--df-text-dim); }
.import-box .modal-actions { align-items: center; } .import-box .modal-actions { align-items: center; }
/* ===== Toast ===== */ /* toast 样式已统一到全局 global.css .df-toast 族(+--bottom 底部变体) */
.toast {
position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
padding: 10px 18px; border-radius: var(--df-radius-sm);
font-size: 13px; z-index: 200; max-width: 80vw;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.toast-info { background: var(--df-accent); color: #fff; }
.toast-error { background: var(--df-danger); color: #fff; }
/* ToastType 新增 'success' 兜底样式(本视图当前未用,补全避免裸类) */
.toast-success { background: var(--df-success); color: #fff; }
</style> </style>
+4 -22
View File
@@ -1,7 +1,7 @@
<template> <template>
<div class="settings"> <div class="settings">
<Transition name="toast"> <Transition name="df-toast">
<div v-if="toast.visible" class="toast" :class="'toast-' + toast.type">{{ toast.msg }}</div> <div v-if="toast.visible" class="df-toast" :class="toast.type === 'error' ? 'df-toast--danger' : 'df-toast--' + toast.type">{{ toast.msg }}</div>
</Transition> </Transition>
<ConfirmDialog :visible="confirmState.visible" :msg="confirmState.msg" :danger-label="$t('common.delete')" @result="answerConfirm" /> <ConfirmDialog :visible="confirmState.visible" :msg="confirmState.msg" :danger-label="$t('common.delete')" @result="answerConfirm" />
<!-- 页面头部 --> <!-- 页面头部 -->
@@ -313,25 +313,7 @@ onUnmounted(() => {
<style scoped> <style scoped>
.settings { padding: 16px 20px 20px; } .settings { padding: 16px 20px 20px; }
/* ===== 顶部 Toast 提示 ===== */ /* 顶部 Toast 提示:已消费 global.css .df-toast 四色族+过渡(2026-10-18 整洁波并轨) */
.toast {
position: fixed;
top: 16px;
left: 50%;
transform: translateX(-50%);
z-index: 1000;
padding: 8px 16px;
border-radius: var(--df-radius-sm);
font-size: 13px;
box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.toast-error { background: var(--df-danger-bg); color: var(--df-danger); border: 0.5px solid var(--df-danger); }
.toast-warning { background: var(--df-warning-bg); color: var(--df-warning); border: 0.5px solid var(--df-warning); }
.toast-info { background: var(--df-accent-bg); color: var(--df-accent); border: 0.5px solid var(--df-accent); }
/* P0-2: 保存成功明确反馈(绿色),与 info(中性强调)区分 */
.toast-success { background: var(--df-success-bg); color: var(--df-success); border: 0.5px solid var(--df-success); }
.toast-enter-active, .toast-leave-active { transition: opacity 0.2s, transform 0.2s; }
.toast-enter-from, .toast-leave-to { opacity: 0; transform: translate(-50%, -8px); }
/* 确认弹层已替换为 ConfirmDialog 组件(不再需要自建 CSS) */ /* 确认弹层已替换为 ConfirmDialog 组件(不再需要自建 CSS) */
@@ -354,7 +336,7 @@ onUnmounted(() => {
} }
/* .btn / .btn-primary / .btn-ghost / .btn-sm 已迁移到 settings.css 全局, /* .btn / .btn-primary / .btn-ghost / .btn-sm 已迁移到 settings.css 全局,
本壳的 toast/confirm 内联按钮沿用全局基础样式;此处仅保留全局未定义的 .btn-danger。 */ 本壳无特有按钮样式(.btn-danger 由 Projects/AdvancedSection 等使用处各自定义)。 */
/* ===== 窄屏响应式:nav 折叠为顶部横向 tab(由 SettingsNav is-horizontal 渲染) ===== */ /* ===== 窄屏响应式:nav 折叠为顶部横向 tab(由 SettingsNav is-horizontal 渲染) ===== */
@media (max-width: 768px) { @media (max-width: 768px) {
+21 -24
View File
@@ -123,12 +123,12 @@
<!-- 基础分支(空值不显行) --> <!-- 基础分支(空值不显行) -->
<div v-if="task.base_branch" class="info-item"> <div v-if="task.base_branch" class="info-item">
<span class="label">{{ $t('taskDetail.baseBranch') }}</span> <span class="label">{{ $t('taskDetail.baseBranch') }}</span>
<span class="value mono">{{ task.base_branch }}</span> <span class="value df-mono">{{ task.base_branch }}</span>
</div> </div>
<!-- 工作流定义(空值不显行) --> <!-- 工作流定义(空值不显行) -->
<div v-if="task.workflow_def_id" class="info-item"> <div v-if="task.workflow_def_id" class="info-item">
<span class="label">{{ $t('taskDetail.workflowDef') }}</span> <span class="label">{{ $t('taskDetail.workflowDef') }}</span>
<span class="value mono">{{ task.workflow_def_id }}</span> <span class="value df-mono">{{ task.workflow_def_id }}</span>
</div> </div>
<!-- 创建/更新时间:最底小字(Problem4 ⑥) --> <!-- 创建/更新时间:最底小字(Problem4 ⑥) -->
<div class="info-item timestamps"> <div class="info-item timestamps">
@@ -835,21 +835,18 @@ onBeforeUnmount(() => {
min-width: 0; min-width: 0;
} }
/* Problem4 ① 吸顶 header(推进按钮始终可见) */ /* Problem4 ① 吸顶 header(推进按钮始终可见)
高度/对齐交给全局 .page-header(46px 定高),此处仅保留吸顶所需的
背景铺满/出血负边距/底部分割线,不再自造 padding 堆高度 */
.task-detail-header { .task-detail-header {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 10; z-index: 10;
background: var(--df-bg); background: var(--df-bg);
/* 留底部细分割线,与全局 page-header margin-bottom 协同(0.5px 边框规范) */
padding-bottom: 8px;
border-bottom: 0.5px solid var(--df-border); border-bottom: 0.5px solid var(--df-border);
/* 顶负 padding 抵消 .task-detail 的 16px 顶 padding,吸顶贴顶 */ /* 负 margin 抵消 .task-detail 的内边距,吸顶时背景全宽贴顶 */
margin: -16px -20px 0; margin: -16px -20px 0;
padding-left: 20px; padding: 0 20px;
padding-right: 20px;
padding-top: 16px;
align-items: center;
} }
/* header-actions 内多个推进按钮 + refresh 排列(对齐全局 .header-actions gap:10px) */ /* header-actions 内多个推进按钮 + refresh 排列(对齐全局 .header-actions gap:10px) */
.task-detail-header .header-actions { flex-wrap: wrap; justify-content: flex-end; } .task-detail-header .header-actions { flex-wrap: wrap; justify-content: flex-end; }
@@ -869,12 +866,12 @@ onBeforeUnmount(() => {
.wf-progress-hint { color: var(--df-success); } .wf-progress-hint { color: var(--df-success); }
.wf-progress-hint-fail { color: var(--df-danger); } .wf-progress-hint-fail { color: var(--df-danger); }
/* F-04 review 轮次徽章 */ /* F-04 review 轮次徽章(背景走 warning 语义 token) */
.review-rounds-badge { .review-rounds-badge {
font-size: 11px; font-size: var(--df-fs-aux);
color: var(--df-warning); color: var(--df-warning);
background: rgba(255,217,61,0.12); background: var(--df-warning-bg);
padding: 3px 8px; padding: var(--df-pad-badge);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
margin-left: 8px; margin-left: 8px;
white-space: nowrap; white-space: nowrap;
@@ -884,8 +881,8 @@ onBeforeUnmount(() => {
/* 状态色类已全局化至 components.css(scoped 删除,消除漂移) */ /* 状态色类已全局化至 components.css(scoped 删除,消除漂移) */
.priority-badge { .priority-badge {
font-size: 10px; font-weight: 500; font-size: var(--df-fs-meta); font-weight: 500;
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
} }
/* 四档统一 color-mix 派生自语义 token(对齐 Tasks.vue 列表同款,主题切换语义不变) */ /* 四档统一 color-mix 派生自语义 token(对齐 Tasks.vue 列表同款,主题切换语义不变) */
@@ -977,16 +974,16 @@ onBeforeUnmount(() => {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 3px; gap: 3px;
font-size: 12px; font-size: var(--df-fs-ctrl);
color: var(--df-text-secondary); color: var(--df-text-secondary);
background: var(--df-accent-bg); background: var(--df-accent-bg);
padding: 2px 8px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
font-family: monospace; font-family: var(--df-font-mono);
} }
.branch-icon { color: var(--df-accent); } .branch-icon { color: var(--df-accent); }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; } /* mono 数据字走全局 .df-mono(模板类名已并轨,本地副本删除) */
.empty-hint { .empty-hint {
text-align: center; padding: 24px 12px; text-align: center; padding: 24px 12px;
@@ -1086,7 +1083,7 @@ onBeforeUnmount(() => {
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
box-shadow: 0 6px 16px rgba(0,0,0,0.25); box-shadow: var(--df-shadow-sm);
z-index: 20; z-index: 20;
padding: 6px 0; padding: 6px 0;
} }
@@ -1111,7 +1108,7 @@ onBeforeUnmount(() => {
cursor: pointer; cursor: pointer;
text-align: left; text-align: left;
} }
.quick-menu-item:hover { background: rgba(255,255,255,0.06); } .quick-menu-item:hover { background: var(--df-hover); }
.quick-menu-divider { .quick-menu-divider {
height: 0.5px; height: 0.5px;
background: var(--df-border); background: var(--df-border);
@@ -1152,9 +1149,9 @@ onBeforeUnmount(() => {
.detail-grid { grid-template-columns: 1fr; } .detail-grid { grid-template-columns: 1fr; }
} }
/* 窄屏 header-actions 内推进按钮可能换行,允许并压缩间距 */ /* 窄屏 header-actions 内推进按钮可能换行,允许并压缩间距(定高改自适应防溢出) */
@media (max-width: 720px) { @media (max-width: 720px) {
.task-detail-header { flex-wrap: wrap; } .task-detail-header { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; }
.task-detail-header .header-left { flex: 1 1 100%; margin-bottom: 8px; } .task-detail-header .header-left { flex: 1 1 100%; margin-bottom: 8px; }
} }
</style> </style>
+30 -45
View File
@@ -151,14 +151,14 @@
<button class="task-quick-btn" :title="$t('tasks.quickActions')" :aria-label="$t('tasks.quickActions')" @click.stop="toggleQuickMenu(row.task.id)">⚙️</button> <button class="task-quick-btn" :title="$t('tasks.quickActions')" :aria-label="$t('tasks.quickActions')" @click.stop="toggleQuickMenu(row.task.id)">⚙️</button>
<div v-if="quickMenuId === row.task.id" class="quick-menu" @click.stop> <div v-if="quickMenuId === row.task.id" class="quick-menu" @click.stop>
<div class="quick-menu-section"> <div class="quick-menu-section">
<div class="quick-menu-label">{{ $t('tasks.quickStatus') }}</div> <div class="df-sec-h quick-menu-label">{{ $t('tasks.quickStatus') }}</div>
<button v-for="s in quickStatusesFor(row.task)" :key="s.key" class="quick-menu-item" @click="quickAdvance(row.task.id, s.key)"> <button v-for="s in quickStatusesFor(row.task)" :key="s.key" class="quick-menu-item" @click="quickAdvance(row.task.id, s.key)">
<span>{{ s.icon }}</span>{{ s.label }} <span>{{ s.icon }}</span>{{ s.label }}
</button> </button>
</div> </div>
<div class="quick-menu-divider"></div> <div class="quick-menu-divider"></div>
<div class="quick-menu-section"> <div class="quick-menu-section">
<div class="quick-menu-label">{{ $t('tasks.quickPriority') }}</div> <div class="df-sec-h quick-menu-label">{{ $t('tasks.quickPriority') }}</div>
<button v-for="p in quickPriorities" :key="p.value" class="quick-menu-item" @click="quickPriority(row.task.id, p.value)"> <button v-for="p in quickPriorities" :key="p.value" class="quick-menu-item" @click="quickPriority(row.task.id, p.value)">
<span :class="p.cls">●</span>{{ p.label }} <span :class="p.cls">●</span>{{ p.label }}
</button> </button>
@@ -208,14 +208,14 @@
<button class="task-quick-btn" :title="$t('tasks.quickActions')" :aria-label="$t('tasks.quickActions')" @click.stop="toggleQuickMenu(child.id)">⚙️</button> <button class="task-quick-btn" :title="$t('tasks.quickActions')" :aria-label="$t('tasks.quickActions')" @click.stop="toggleQuickMenu(child.id)">⚙️</button>
<div v-if="quickMenuId === child.id" class="quick-menu" @click.stop> <div v-if="quickMenuId === child.id" class="quick-menu" @click.stop>
<div class="quick-menu-section"> <div class="quick-menu-section">
<div class="quick-menu-label">{{ $t('tasks.quickStatus') }}</div> <div class="df-sec-h quick-menu-label">{{ $t('tasks.quickStatus') }}</div>
<button v-for="s in quickStatusesFor(child)" :key="s.key" class="quick-menu-item" @click="quickAdvance(child.id, s.key)"> <button v-for="s in quickStatusesFor(child)" :key="s.key" class="quick-menu-item" @click="quickAdvance(child.id, s.key)">
<span>{{ s.icon }}</span>{{ s.label }} <span>{{ s.icon }}</span>{{ s.label }}
</button> </button>
</div> </div>
<div class="quick-menu-divider"></div> <div class="quick-menu-divider"></div>
<div class="quick-menu-section"> <div class="quick-menu-section">
<div class="quick-menu-label">{{ $t('tasks.quickPriority') }}</div> <div class="df-sec-h quick-menu-label">{{ $t('tasks.quickPriority') }}</div>
<button v-for="p in quickPriorities" :key="p.value" class="quick-menu-item" @click="quickPriority(child.id, p.value)"> <button v-for="p in quickPriorities" :key="p.value" class="quick-menu-item" @click="quickPriority(child.id, p.value)">
<span :class="p.cls">●</span>{{ p.label }} <span :class="p.cls">●</span>{{ p.label }}
</button> </button>
@@ -256,14 +256,14 @@
<button class="task-quick-btn" :title="$t('tasks.quickActions')" :aria-label="$t('tasks.quickActions')" @click.stop="toggleQuickMenu(row.task.id)">⚙️</button> <button class="task-quick-btn" :title="$t('tasks.quickActions')" :aria-label="$t('tasks.quickActions')" @click.stop="toggleQuickMenu(row.task.id)">⚙️</button>
<div v-if="quickMenuId === row.task.id" class="quick-menu" @click.stop> <div v-if="quickMenuId === row.task.id" class="quick-menu" @click.stop>
<div class="quick-menu-section"> <div class="quick-menu-section">
<div class="quick-menu-label">{{ $t('tasks.quickStatus') }}</div> <div class="df-sec-h quick-menu-label">{{ $t('tasks.quickStatus') }}</div>
<button v-for="s in quickStatusesFor(row.task)" :key="s.key" class="quick-menu-item" @click="quickAdvance(row.task.id, s.key)"> <button v-for="s in quickStatusesFor(row.task)" :key="s.key" class="quick-menu-item" @click="quickAdvance(row.task.id, s.key)">
<span>{{ s.icon }}</span>{{ s.label }} <span>{{ s.icon }}</span>{{ s.label }}
</button> </button>
</div> </div>
<div class="quick-menu-divider"></div> <div class="quick-menu-divider"></div>
<div class="quick-menu-section"> <div class="quick-menu-section">
<div class="quick-menu-label">{{ $t('tasks.quickPriority') }}</div> <div class="df-sec-h quick-menu-label">{{ $t('tasks.quickPriority') }}</div>
<button v-for="p in quickPriorities" :key="p.value" class="quick-menu-item" @click="quickPriority(row.task.id, p.value)"> <button v-for="p in quickPriorities" :key="p.value" class="quick-menu-item" @click="quickPriority(row.task.id, p.value)">
<span :class="p.cls">●</span>{{ p.label }} <span :class="p.cls">●</span>{{ p.label }}
</button> </button>
@@ -405,8 +405,8 @@
</div> </div>
</div> </div>
<!-- 快捷操作失败 toast(WK-13,对齐 Projects.vue 操作反馈) --> <!-- 快捷操作失败 toast(WK-13,对齐 Projects.vue 操作反馈;全局 .df-toast 族+底部变体) -->
<div v-if="toast.visible" class="toast" :class="'toast-' + toast.type">{{ toast.msg }}</div> <div v-if="toast.visible" class="df-toast df-toast--bottom" :class="toast.type === 'error' ? 'df-toast--danger' : 'df-toast--' + toast.type">{{ toast.msg }}</div>
<!-- 确认弹层(删除任务,替代原生 window.confirm) --> <!-- 确认弹层(删除任务,替代原生 window.confirm) -->
<ConfirmDialog :visible="confirmState.visible" :msg="confirmState.msg" @result="answerConfirm" /> <ConfirmDialog :visible="confirmState.visible" :msg="confirmState.msg" @result="answerConfirm" />
@@ -1041,8 +1041,8 @@ onUnmounted(() => {
margin-bottom: 12px; margin-bottom: 12px;
padding: 8px 10px; padding: 8px 10px;
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
background: var(--df-danger-bg, rgba(220, 38, 38, 0.08)); background: var(--df-danger-bg);
color: var(--df-danger, #dc2626); color: var(--df-danger);
font-size: 12px; font-size: 12px;
} }
@@ -1132,14 +1132,13 @@ onUnmounted(() => {
border-bottom: 0.5px solid var(--df-border); border-bottom: 0.5px solid var(--df-border);
flex-shrink: 0; flex-shrink: 0;
} }
.kanban-col-icon { font-size: 13px; }
.kanban-col-name { font-size: 13px; font-weight: 500; color: var(--df-text); flex: 1; } .kanban-col-name { font-size: 13px; font-weight: 500; color: var(--df-text); flex: 1; }
.kanban-col-count { .kanban-col-count {
font-size: 11px; font-size: 11px;
color: var(--df-text-dim); color: var(--df-text-dim);
background: rgba(255, 255, 255, 0.06); background: rgba(255, 255, 255, 0.06);
padding: 1px 8px; padding: var(--df-pad-chip);
border-radius: 8px; border-radius: var(--df-radius-xs);
} }
.kanban-col-body { .kanban-col-body {
flex: 1; flex: 1;
@@ -1169,7 +1168,7 @@ onUnmounted(() => {
cursor: pointer; cursor: pointer;
transition: box-shadow 0.15s, border-color 0.15s; transition: box-shadow 0.15s, border-color 0.15s;
} }
.task-card:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); border-color: var(--df-accent); } .task-card:hover { box-shadow: var(--df-shadow-sm); border-color: var(--df-accent); }
.task-card.sortable-ghost { opacity: 0.5; } .task-card.sortable-ghost { opacity: 0.5; }
/* 父卡禁拖:去掉抓取光标、左侧描边提示这是聚合容器卡 */ /* 父卡禁拖:去掉抓取光标、左侧描边提示这是聚合容器卡 */
.task-card--parent { cursor: default; border-left: 2px solid var(--df-accent); } .task-card--parent { cursor: default; border-left: 2px solid var(--df-accent); }
@@ -1195,9 +1194,9 @@ onUnmounted(() => {
.parent-tag { .parent-tag {
font-size: 11px; font-size: 11px;
color: var(--df-text-dim); color: var(--df-text-dim);
background: rgba(255, 255, 255, 0.05); background: var(--df-hover);
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: 6px; border-radius: var(--df-radius-xs);
max-width: 140px; max-width: 140px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -1207,8 +1206,8 @@ onUnmounted(() => {
font-size: 11px; font-size: 11px;
color: var(--df-text-dim); color: var(--df-text-dim);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: 6px; border-radius: var(--df-radius-xs);
} }
/* page-header / page-header h1 / header-actions 已提取到全局 global.css */ /* page-header / page-header h1 / header-actions 已提取到全局 global.css */
@@ -1269,7 +1268,7 @@ onUnmounted(() => {
gap: 3px; gap: 3px;
padding: 2px 8px; padding: 2px 8px;
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: 10px; border-radius: var(--df-radius-xs);
background: transparent; background: transparent;
color: var(--df-text-dim); color: var(--df-text-dim);
font-size: 11px; font-size: 11px;
@@ -1330,8 +1329,8 @@ onUnmounted(() => {
font-size: 11px; font-size: 11px;
color: var(--df-text-dim); color: var(--df-text-dim);
background: rgba(255,255,255,0.06); background: rgba(255,255,255,0.06);
padding: 1px 8px; padding: var(--df-pad-chip);
border-radius: 8px; border-radius: var(--df-radius-xs);
} }
/* 任务条目(紧凑) */ /* 任务条目(紧凑) */
@@ -1344,7 +1343,7 @@ onUnmounted(() => {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 8px 14px; padding: 8px 14px;
border-bottom: 0.5px solid rgba(255,255,255,0.03); border-bottom: 0.5px solid var(--df-hover);
transition: background 0.1s; transition: background 0.1s;
cursor: pointer; cursor: pointer;
} }
@@ -1372,7 +1371,7 @@ onUnmounted(() => {
.priority-badge { .priority-badge {
font-size: 10px; font-size: 10px;
font-weight: 500; font-weight: 500;
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: var(--df-radius-xs); border-radius: var(--df-radius-xs);
flex-shrink: 0; flex-shrink: 0;
} }
@@ -1446,8 +1445,8 @@ onUnmounted(() => {
font-weight: 600; font-weight: 600;
color: var(--df-text-dim); color: var(--df-text-dim);
background: rgba(255,255,255,0.06); background: rgba(255,255,255,0.06);
padding: 1px 6px; padding: var(--df-pad-chip);
border-radius: 8px; border-radius: var(--df-radius-xs);
flex-shrink: 0; flex-shrink: 0;
white-space: nowrap; white-space: nowrap;
} }
@@ -1488,18 +1487,13 @@ onUnmounted(() => {
background: var(--df-bg-card); background: var(--df-bg-card);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm); border-radius: var(--df-radius-sm);
box-shadow: 0 6px 16px rgba(0,0,0,0.25); box-shadow: var(--df-shadow-sm);
z-index: 20; z-index: 20;
padding: 6px 0; padding: 6px 0;
} }
.quick-menu-section { padding: 4px 0; } .quick-menu-section { padding: 4px 0; }
.quick-menu-label { /* 小节头公共类 .df-sec-h,此处仅补菜单内缩进 */
font-size: 10px; .quick-menu-label { padding: 2px 12px; }
color: var(--df-text-dim);
padding: 2px 12px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.quick-menu-item { .quick-menu-item {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -1513,7 +1507,7 @@ onUnmounted(() => {
cursor: pointer; cursor: pointer;
text-align: left; text-align: left;
} }
.quick-menu-item:hover { background: rgba(255,255,255,0.06); } .quick-menu-item:hover { background: var(--df-hover); }
.quick-menu-divider { .quick-menu-divider {
height: 0.5px; height: 0.5px;
background: var(--df-border); background: var(--df-border);
@@ -1521,16 +1515,7 @@ onUnmounted(() => {
} }
.quick-menu-danger { color: var(--df-danger); } .quick-menu-danger { color: var(--df-danger); }
/* ===== 快捷操作失败 toast(WK-13,对齐 Projects.vue 操作反馈) ===== */ /* 快捷操作失败 toast 样式已统一到全局 global.css .df-toast 族(+--bottom 底部变体) */
.toast {
position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
padding: 10px 18px; border-radius: var(--df-radius-sm);
font-size: 13px; z-index: 200; max-width: 80vw;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.toast-info { background: var(--df-accent); color: #fff; }
.toast-error { background: var(--df-danger); color: #fff; }
.toast-success { background: var(--df-success); color: #fff; }
/* 空态 */ /* 空态 */
/* empty-state 已提取到全局 global.css */ /* empty-state 已提取到全局 global.css */