Commit cf2a6b2
committed
feat(ui): 重构变量系统并实现测试区独立变量管理
## 核心功能
### 变量系统重构
- 移除会话变量系统,实现独立的测试变量功能
- 将 useContextManagement 从 web 模块迁移到 ui 模块
- 升级 usePromptTester 支持测试变量注入和上下文
### 测试区临时变量管理
- 临时变量数据结构升级为 { value, timestamp }
- 按时间戳降序排序显示(最新在前)
- 支持手动增删改操作
- 添加变量对话框,支持变量名验证
- 删除按钮,支持单个变量删除
- 与优化后提示词解耦,不再自动绑定
### 变量提取功能
- 新增 variable-extraction 组件目录
- VariableAwareInput: 支持文本选择提取变量
- VariableExtractionDialog: 变量提取对话框
- useTextSelection: 文本选择管理
- useInputHistory: 输入历史管理
- 支持全局/临时变量类型选择
- 支持全部替换功能
## 技术改进
### 组件优化
- TestAreaPanel.vue: testVariables 从 Record<string, string> 升级为 Record<string, TestVariable>
- InputPanel.vue: 集成 VariableAwareInput 组件,支持变量提取
- ContextUserWorkspace.vue: 新增 temporaryVariables 状态管理
### 国际化完善
- 补充缺失的 test.invalidVariables 和 test.getVariablesFailed 键
- 新增变量提取相关的完整国际化文本
- 覆盖中文简体/繁体/英文三种语言
- 同步三语言国际化键值(en-US/zh-CN/zh-TW)
## 其他更新
- 修复 web/extension 中未使用变量和错误 API 调用
- 更新测试文件的组件导入路径
- 清理过度 debug 日志
- 更新相关文档(ui-refactor-plan.md, variable-system-redesign.md)
## 相关 Issue
- 解决测试区变量显示依赖优化结果的问题
- 实现变量独立管理需求
- 补充缺失的国际化文本
**测试:所有测试通过(core: 367, ui: 95)**1 parent 1d39f11 commit cf2a6b2
File tree
26 files changed
+6260
-1063
lines changed- docs/workspace
- packages
- extension/src
- ui
- src
- components
- context-mode
- variable-extraction
- composables
- i18n/locales
- tests
- e2e
- integration
- unit/components
- web
- src
26 files changed
+6260
-1063
lines changedLarge diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
74 | 87 | | |
| 88 | + | |
75 | 89 | | |
76 | 90 | | |
77 | 91 | | |
| |||
164 | 178 | | |
165 | 179 | | |
166 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
167 | 192 | | |
168 | 193 | | |
| 194 | + | |
169 | 195 | | |
| 196 | + | |
170 | 197 | | |
| 198 | + | |
171 | 199 | | |
| 200 | + | |
172 | 201 | | |
| 202 | + | |
173 | 203 | | |
| 204 | + | |
174 | 205 | | |
| 206 | + | |
175 | 207 | | |
| 208 | + | |
176 | 209 | | |
| 210 | + | |
177 | 211 | | |
| 212 | + | |
178 | 213 | | |
| 214 | + | |
179 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
180 | 225 | | |
181 | 226 | | |
182 | 227 | | |
| |||
185 | 230 | | |
186 | 231 | | |
187 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
188 | 237 | | |
189 | 238 | | |
190 | 239 | | |
| |||
193 | 242 | | |
194 | 243 | | |
195 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
196 | 253 | | |
197 | 254 | | |
198 | 255 | | |
199 | 256 | | |
200 | 257 | | |
201 | 258 | | |
202 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
203 | 269 | | |
0 commit comments