makecindy / makecindy/cindy

[0.1.71] 新建自动化模板必填参数留空时提示显示英文内部错误

Open
#3,795 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

**提交人**: mp55
**客户端版本**: 0.1.71

---

## 现象
在中文界面中,通过「自动化 → 新建自动化 → 新手帮助」使用带必填模板参数的模板时,如果不填写参数直接点击「创建」,弹出的提示是模板引擎的英文内部错误,而不是本地化的字段校验提示。

当前确认涉及以下两个模板:

1. **领域雷达**:「关注主题」留空,提示 `Missing required template parameter: topic`
2. **竞品动态追踪**:「竞品名单」留空,提示 `Missing required template parameter: competitors`

## 复现步骤
1. 打开「自动化」
2. 点击「新建自动化」
3. 进入「新手帮助」
4. 选择「领域雷达」或「竞品动态追踪」
5. 保持对应的必填字段为空
6. 点击「创建」

## 期望行为
显示当前语言对应的本地化提示,并使用用户可见的字段名,例如:
- `请填写关注主题`
- `请填写竞品名单`

不应把模板引擎的英文异常和内部参数 key 直接暴露给用户。

## 实际行为
Toast 提示为英文内部错误:
- `Missing required template parameter: topic`
- `Missing required template parameter: competitors`

## 初步原因
- 模板引擎在缺少必填参数时直接抛英文异常:`packages/maker-scheduler/src/engine/template.ts` 中 `throw new Error(\`Missing required template parameter: ${definition.key}\`)`
- 新建自动化表单捕获异常后把 `error.message` 原样传给 toast,未经 i18n 映射:`apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsx`

## 影响范围
两个模板共用同一套模板参数替换与异常处理逻辑,其他带 `required: true` 模板参数的自动化模板同样会复现。

## 复现频率
必现:两个模板留空必填参数点创建即 100% 复现。

---
**版本区域**: CN
**OS**: win32 x64 (10.0.26200)
**Harness**: Pi
**界面语言**: zh-CN

Contributor guide

Open the contributing guide

Research direction

Start with packages/maker-scheduler/src/engine/template.ts and apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsx, tracing the missing-parameter exception through the form’s toast handling. Reproduce the issue with the 领域雷达 and 竞品动态追踪 templates, then verify that required fields show localized, user-facing names instead of the English internal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
desktop, frontend, internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.