docs: add lineloss requesturl fix design spec
临时方案:在 derive_request_url_from_instruction 中添加台区线损 URL 映射 🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
48
docs/superpowers/specs/2026-04-13-lineloss-requesturl-fix.md
Normal file
48
docs/superpowers/specs/2026-04-13-lineloss-requesturl-fix.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# 台区线损 Skill - requesturl 快速修复方案
|
||||
|
||||
## 问题背景
|
||||
|
||||
`sgHideBrowerserOpenPage` 命令需要 `requesturl` 参数(发起调用的页面 URL),但当前台区线损指令解析时返回 `about:blank`,导致浏览器不执行命令。
|
||||
|
||||
知乎热榜场景正常工作,因为 `derive_request_url_from_instruction` 返回了 `https://www.zhihu.com`。
|
||||
|
||||
## 设计方案
|
||||
|
||||
**方案:在 `derive_request_url_from_instruction` 中添加台区线损 URL 映射**
|
||||
|
||||
### 修改位置
|
||||
|
||||
`src/service/server.rs` - `derive_request_url_from_instruction` 函数
|
||||
|
||||
### 修改内容
|
||||
|
||||
```rust
|
||||
fn derive_request_url_from_instruction(instruction: &str) -> Option<String> {
|
||||
// 已有:知乎相关(保持不变)
|
||||
if crate::compat::workflow_executor::detect_route(instruction, None, None)
|
||||
.is_some_and(|route| { ... })
|
||||
{
|
||||
return Some("https://www.zhihu.com".to_string());
|
||||
}
|
||||
|
||||
// 新增:台区线损相关
|
||||
// TODO: 临时方案,后续应从 skill 配置或 deterministic_submit 解析结果中获取
|
||||
if instruction.contains("线损") || instruction.contains("lineloss") {
|
||||
return Some("http://20.76.57.61:18080".to_string());
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
```
|
||||
|
||||
### 约束条件
|
||||
|
||||
- URL 为硬编码,后续需重构为通用方案
|
||||
- 仅匹配指令中包含"线损"或"lineloss"的场景
|
||||
|
||||
## 后续规划
|
||||
|
||||
将实现通用方案:
|
||||
- 从 `DeterministicExecutionPlan.expected_domain` 构造完整 URL
|
||||
- 或从 skill 配置文件中读取 target URL
|
||||
- 调整流程顺序,先解析 skill 再打开 helper page
|
||||
Reference in New Issue
Block a user