auto-sync: 2026-05-19 13:46:12
This commit is contained in:
@@ -196,9 +196,9 @@ function CreateTaskModal({ onClose, onSubmit }: {
|
||||
|
||||
{/* Title */}
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<label style={{ fontSize: 11, color: 'var(--muted)', marginBottom: 4, display: 'block' }}>标题(可选)</label>
|
||||
<label style={{ fontSize: 11, color: 'var(--muted)', marginBottom: 4, display: 'block' }}>标题(可选,不填将自动生成)</label>
|
||||
<input value={title} onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder="简要概括任务..."
|
||||
placeholder="简要概括任务,不填自动从描述生成..."
|
||||
style={{ width: '100%', padding: '8px 12px', borderRadius: 6, border: '1px solid var(--line)', background: 'var(--panel)', color: 'var(--fg)', fontSize: 13 }} />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -222,14 +222,16 @@ export const api = {
|
||||
const pid = _currentProjectId || Object.keys((await api.projects()).projects)[0];
|
||||
if (!pid) return { ok: false, error: 'No project selected' };
|
||||
const prio = typeof data.priority === 'string' ? parseInt(data.priority, 10) || 5 : 5;
|
||||
return postJ(`${API_BASE}/api/projects/${pid}/tasks`, {
|
||||
// title 为空时不传,后端自动生成(description 前30字 + …)
|
||||
const payload: any = {
|
||||
id: `task-${Date.now().toString(36)}`,
|
||||
title: data.title || data.requirement || '',
|
||||
description: data.requirement || data.title || '',
|
||||
task_type: data.project_type || 'general',
|
||||
priority: prio,
|
||||
assigned_by: 'user',
|
||||
});
|
||||
};
|
||||
if (data.title && data.title.trim()) payload.title = data.title.trim();
|
||||
return postJ(`${API_BASE}/api/projects/${pid}/tasks`, payload);
|
||||
} catch (e: any) {
|
||||
return { ok: false, error: e.message };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user