feat: write the UI in English, select only conversation content
- source strings are English again; Chinese comes from lib/l10n/zh.dart through tr()/trArgs() and AppText, and a language without a table (Spanish, ...) reads English instead of Chinese - server and user data (titles, messages, file names, notes, task names) is drawn with plain Text, so it is never looked up in the table - SelectionArea moved from the whole message list to the messages, the answer text, an opened tool call's details and the turn footer; status lines and folded tool rows no longer start a selection - a message the transcript does not know (its start event was lost while the stream was down) fetches the tail once, so a turn continued from another client comes in with its prompt - bump to 0.5.3
This commit is contained in:
1 parent
7b5bccf28f
commit
511c3b006b
43 files changed
+1620
-1791
No files matched your search
@@ -122,14 +122,14 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppText(
|
||||
widget.initial == null ? '新建计划任务' : '编辑计划任务',
|
||||
widget.initial == null ? 'New scheduled task' : 'Edit scheduled task',
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _saving ? null : _save,
|
||||
child: AppText(_saving ? '保存中…' : '保存'),
|
||||
child: AppText(_saving ? 'Saving…' : 'Save'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -138,15 +138,15 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 32),
|
||||
children: [
|
||||
AppText(trArgs('运行位置:{0}', [widget.scopeLabel]),
|
||||
AppText(trArgs('Runs in: {0}', [widget.scopeLabel]),
|
||||
style: TextStyle(fontSize: 12.5, color: theme.hintColor)),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: _name,
|
||||
maxLength: 80,
|
||||
decoration: InputDecoration(
|
||||
labelText: tr('任务名称'),
|
||||
hintText: tr('每日同步'),
|
||||
labelText: tr('Task name'),
|
||||
hintText: tr('Daily sync'),
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
@@ -156,14 +156,14 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
minLines: 4,
|
||||
maxLines: 10,
|
||||
decoration: InputDecoration(
|
||||
labelText: tr('提示词'),
|
||||
hintText: tr('总结未完成任务并给出下一步建议'),
|
||||
labelText: tr('Prompt'),
|
||||
hintText: tr('Summarize unfinished tasks and suggest next steps'),
|
||||
border: const OutlineInputBorder(),
|
||||
alignLabelWithHint: true,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const _FieldLabel('计划类型'),
|
||||
const _FieldLabel('Schedule type'),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
@@ -181,23 +181,23 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
const SizedBox(height: 8),
|
||||
SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const AppText('使用默认模型与智能体'),
|
||||
subtitle: const AppText('关闭后可固定这次运行使用的模型和智能体。'),
|
||||
title: const AppText('Use default model and agent'),
|
||||
subtitle: const AppText('Turn off to pin the model and agent this run uses.'),
|
||||
value: _useDefaults,
|
||||
onChanged: (v) => setState(() => _useDefaults = v),
|
||||
),
|
||||
if (!_useDefaults) ..._executionFields(theme),
|
||||
SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const AppText('已启用'),
|
||||
subtitle: const AppText('暂停的任务不会按计划运行,但可以手动运行。'),
|
||||
title: const AppText('Enabled'),
|
||||
subtitle: const AppText('Paused tasks don\'t run on schedule but can still be run manually.'),
|
||||
value: _enabled,
|
||||
onChanged: (v) => setState(() => _enabled = v),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
FilledButton(
|
||||
onPressed: _saving ? null : _save,
|
||||
child: AppText(_saving ? '保存中…' : '保存'),
|
||||
child: AppText(_saving ? 'Saving…' : 'Save'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -213,7 +213,7 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
return [_timesField(theme)];
|
||||
case 'weekly':
|
||||
return [
|
||||
const _FieldLabel('星期'),
|
||||
const _FieldLabel('Weekdays'),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
@@ -239,14 +239,14 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
return [
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const AppText('日期'),
|
||||
trailing: AppText(_dateText(_date)),
|
||||
title: const AppText('Date'),
|
||||
trailing: Text(_dateText(_date)),
|
||||
onTap: _pickDate,
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const AppText('时间'),
|
||||
trailing: AppText(_time),
|
||||
title: const AppText('Time'),
|
||||
trailing: Text(_time),
|
||||
onTap: () async {
|
||||
final picked = await _pickTime(_time);
|
||||
if (picked != null) setState(() => _time = picked);
|
||||
@@ -258,7 +258,7 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
TextField(
|
||||
controller: _cron,
|
||||
decoration: InputDecoration(
|
||||
labelText: tr('Cron 表达式'),
|
||||
labelText: tr('Cron expression'),
|
||||
hintText: '*/5 * * * *',
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
@@ -269,11 +269,11 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
for (final example in const [
|
||||
('每 5 分钟', '*/5 * * * *'),
|
||||
('每小时', '0 * * * *'),
|
||||
('每天 9 点', '0 9 * * *'),
|
||||
('每周一 9 点', '0 9 * * 1'),
|
||||
('每月 1 日', '0 9 1 * *'),
|
||||
('Every 5 minutes', '*/5 * * * *'),
|
||||
('Every hour', '0 * * * *'),
|
||||
('Daily at 9', '0 9 * * *'),
|
||||
('Mondays at 9', '0 9 * * 1'),
|
||||
('1st of each month', '0 9 1 * *'),
|
||||
])
|
||||
ActionChip(
|
||||
label: AppText(example.$1),
|
||||
@@ -291,7 +291,7 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const _FieldLabel('时间点'),
|
||||
const _FieldLabel('Times'),
|
||||
for (var i = 0; i < _times.length; i++)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
@@ -303,12 +303,12 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
final picked = await _pickTime(_times[i]);
|
||||
if (picked != null) setState(() => _times[i] = picked);
|
||||
},
|
||||
child: AppText(_times[i]),
|
||||
child: Text(_times[i]),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.remove_circle_outline, size: 20),
|
||||
tooltip: tr('移除时间'),
|
||||
tooltip: tr('Remove time'),
|
||||
onPressed: _times.length <= 1
|
||||
? null
|
||||
: () => setState(() => _times.removeAt(i)),
|
||||
@@ -322,30 +322,30 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
if (picked != null) setState(() => _times.add(picked));
|
||||
},
|
||||
icon: const Icon(Icons.add, size: 18),
|
||||
label: const AppText('添加时间'),
|
||||
label: const AppText('Add time'),
|
||||
),
|
||||
AppText('时间按服务器所在时区。', style: TextStyle(fontSize: 11.5, color: theme.hintColor)),
|
||||
AppText('Times follow the server\'s time zone.', style: TextStyle(fontSize: 11.5, color: theme.hintColor)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _executionFields(ThemeData theme) {
|
||||
final model = _modelId.isEmpty
|
||||
? '选择模型'
|
||||
? 'Select model'
|
||||
: (widget.app.modelNames['$_providerId/$_modelId'] ?? '$_providerId/$_modelId');
|
||||
final agent = _agent.isEmpty ? '默认智能体' : _agent;
|
||||
final agent = _agent.isEmpty ? 'Default agent' : _agent;
|
||||
return [
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: const Icon(Icons.memory, size: 20),
|
||||
title: const AppText('模型'),
|
||||
trailing: AppText(model, overflow: TextOverflow.ellipsis),
|
||||
title: const AppText('Model'),
|
||||
trailing: Text(model, overflow: TextOverflow.ellipsis),
|
||||
onTap: _pickModel,
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: const Icon(Icons.smart_toy_outlined, size: 20),
|
||||
title: const AppText('智能体'),
|
||||
title: const AppText('Agent'),
|
||||
trailing: AppText(agent, overflow: TextOverflow.ellipsis),
|
||||
onTap: _pickAgent,
|
||||
),
|
||||
@@ -404,13 +404,13 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
ListTile(
|
||||
title: const AppText('默认智能体'),
|
||||
title: const AppText('Default agent'),
|
||||
trailing: _agent.isEmpty ? const Icon(Icons.check, size: 20) : null,
|
||||
onTap: () => Navigator.pop(sheet, ''),
|
||||
),
|
||||
for (final agent in widget.app.agentList)
|
||||
ListTile(
|
||||
title: AppText(agent.name.isEmpty ? agent.id : agent.name),
|
||||
title: Text(agent.name.isEmpty ? agent.id : agent.name),
|
||||
trailing: _agent == agent.id
|
||||
? const Icon(Icons.check, size: 20)
|
||||
: null,
|
||||
@@ -429,22 +429,22 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
String? problem;
|
||||
if (name.isEmpty) {
|
||||
problem = '任务名称为必填项';
|
||||
problem = 'Task name is required';
|
||||
} else if (name.length > 80) {
|
||||
problem = '任务名称不能超过 80 个字符';
|
||||
problem = 'Task name can\'t exceed 80 characters';
|
||||
} else if (prompt.isEmpty) {
|
||||
problem = '提示词为必填项';
|
||||
problem = 'Prompt is required';
|
||||
} else if (prompt.length > 20000) {
|
||||
problem = '提示词不能超过 20000 个字符';
|
||||
problem = 'Prompt can\'t exceed 20,000 characters';
|
||||
} else if ((_kind == 'daily' || _kind == 'weekly') &&
|
||||
_times.any((t) => !RegExp(r'^([01]\d|2[0-3]):[0-5]\d$').hasMatch(t))) {
|
||||
problem = '时间格式必须是 HH:mm';
|
||||
problem = 'Time must be in HH:mm format';
|
||||
} else if (_kind == 'weekly' && _weekdays.isEmpty) {
|
||||
problem = '请至少选择一个星期';
|
||||
problem = 'Select at least one weekday';
|
||||
} else if (_kind == 'cron' && _cron.text.trim().isEmpty) {
|
||||
problem = 'Cron 表达式为必填项';
|
||||
problem = 'Cron expression is required';
|
||||
} else if (!_useDefaults && _modelId.isEmpty) {
|
||||
problem = '请选择模型,或改回使用默认模型';
|
||||
problem = 'Select a model, or switch back to the default model';
|
||||
}
|
||||
if (problem != null) {
|
||||
messenger.showSnackBar(SnackBar(content: AppText(problem)));
|
||||
|
||||
Reference in new issue
Block a user