Skip to content

[tauri] 历史重新润色 IPC 契约前后端不一致 #22

Closed

Description

@Cooper-X-Oak

现象

  • 触发条件:后续在历史记录中接入“重新润色 / 切换风格重跑”功能,或直接调用前端 repolish wrapper。
  • 当前表现:前端 repolish(id, mode) 向后端发送 { id, mode } 并声明返回 DictationSession;后端 Tauri command 实际签名是 repolish(raw_text, mode) -> Result<String, String>。
  • 证据:
    • openless -all/app/src/lib/ipc.ts:
export function repolish(id: string, mode: PolishMode): Promise<DictationSession> {
  return invokeOrMock('repolish', { id, mode }, () => mockHistory[0]);
}
  • openless -all/app/src-tauri/src/commands.rs:
pub async fn repolish(
    coord: CoordinatorState<'_>,
    raw_text: String,
    mode: PolishMode,
) -> Result<String, String>

影响

  • 一旦 UI 接入重新润色按钮,点击会因为参数名不匹配而失败,表现为功能无响应。
  • TypeScript 类型声明会误导调用方以为能拿回完整 DictationSession,实际后端只返回字符串。
  • 历史记录页目前没有重新润色入口,和 README 中“历史增强:重新润色”的方向不一致。

建议接受标准

  • 明确 repolish 的契约:按历史 id 重跑并更新 session,或按 rawText 只返回润色文本,二选一。
  • 前端 IPC wrapper 和 Rust command 参数名、返回值类型一致。
  • 如果按历史记录重跑,历史页提供可见入口,并更新当前 item 的 finalText / mode。
  • 如果暂不支持历史重跑,删除或标记未使用 wrapper,避免后续误接。

TODO / 不确定项

  • TODO:确认 1.1.x Windows 适配是否需要包含历史重新润色,还是仅修正 IPC 契约防止后续踩坑。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions