Compare commits

...

1 Commits

Author SHA1 Message Date
Jiang Bohan
8e17afb0c2 fix(views): auto-split whitespace in custom args entries
Users naturally type `--model claude-sonnet-4-20250514` on one line,
but the backend needs them as separate tokens. Now `entriesToArgs`
splits each entry by whitespace before saving, so the API receives
`["--model", "claude-sonnet-4-20250514"]` instead of a single string.

Also updated placeholder and description to show the natural input
format.
2026-04-15 15:13:47 +08:00

View File

@@ -23,7 +23,7 @@ function argsToEntries(args: string[]): ArgEntry[] {
}
function entriesToArgs(entries: ArgEntry[]): string[] {
return entries.map((e) => e.value).filter((v) => v.trim() !== "");
return entries.flatMap((e) => e.value.trim().split(/\s+/)).filter(Boolean);
}
export function CustomArgsTab({
@@ -77,7 +77,7 @@ export function CustomArgsTab({
</Label>
<p className="text-xs text-muted-foreground mt-0.5">
Additional CLI arguments appended to the agent command at launch
(e.g. --model, --max-turns)
(e.g. --model claude-sonnet-4-20250514)
</p>
</div>
<Button
@@ -98,7 +98,7 @@ export function CustomArgsTab({
<Input
value={entry.value}
onChange={(e) => updateEntry(index, e.target.value)}
placeholder="--flag value"
placeholder="--model claude-sonnet-4-20250514"
className="flex-1 font-mono text-xs"
/>
<button