GUI: impostazioni modello (con versione) ed effort, finestra piu grande
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d557b906f
commit
eb01590b16
5 files changed
+32
-7
No files matched your search
+24
-5
@@ -37,15 +37,32 @@ static ProcessStartInfo NewClaude(string prompt)
|
||||
|
||||
class Gui : Form
|
||||
{
|
||||
readonly TextBox prompt = new() { Dock = DockStyle.Top, Multiline = true, Height = 80, AcceptsReturn = true };
|
||||
readonly TextBox prompt = new() { Dock = DockStyle.Top, Multiline = true, Height = 120, AcceptsReturn = true };
|
||||
readonly Button send = new() { Dock = DockStyle.Top, Text = "Invia a Claude", Height = 32 };
|
||||
readonly TextBox output = new() { Dock = DockStyle.Fill, Multiline = true, ReadOnly = true, ScrollBars = ScrollBars.Vertical };
|
||||
|
||||
record Model(string Label, string Id) { public override string ToString() => Label; }
|
||||
static readonly Model[] Models =
|
||||
[
|
||||
new("Fable 5.1 (claude-fable-5-1)", "claude-fable-5-1"),
|
||||
new("Opus 5.5 (claude-opus-5-5)", "claude-opus-5-5"),
|
||||
new("Sonnet 5.5 (claude-sonnet-5-5)", "claude-sonnet-5-5"),
|
||||
new("Haiku 5.5 (claude-haiku-5-5)", "claude-haiku-5-5"),
|
||||
];
|
||||
const string Default = "predefinito";
|
||||
readonly ComboBox model = new() { DropDownStyle = ComboBoxStyle.DropDown, Width = 300 }; // editabile: ID completo
|
||||
readonly ComboBox effort = new() { DropDownStyle = ComboBoxStyle.DropDownList, Width = 100 };
|
||||
|
||||
public Gui()
|
||||
{
|
||||
Text = "LlmRun";
|
||||
Width = 700; Height = 500;
|
||||
Controls.Add(output); Controls.Add(send); Controls.Add(prompt); // Fill per primo: l'ordine inverso dei Dock
|
||||
Width = 1000; Height = 700;
|
||||
model.Items.Add(Default); model.Items.AddRange(Models); model.SelectedIndex = 0;
|
||||
effort.Items.AddRange([Default, "low", "medium", "high", "xhigh", "max"]); effort.SelectedIndex = 0;
|
||||
var settings = new FlowLayoutPanel { Dock = DockStyle.Top, Height = 32, Padding = new Padding(4) };
|
||||
settings.Controls.AddRange([new Label { Text = "Modello", AutoSize = true, Margin = new Padding(0, 6, 0, 0) }, model,
|
||||
new Label { Text = "Effort", AutoSize = true, Margin = new Padding(8, 6, 0, 0) }, effort]);
|
||||
Controls.Add(output); Controls.Add(send); Controls.Add(prompt); Controls.Add(settings); // Fill per primo: l'ordine inverso dei Dock
|
||||
send.Click += async (_, _) => await Run();
|
||||
}
|
||||
|
||||
@@ -56,7 +73,7 @@ class Gui : Form
|
||||
output.Clear();
|
||||
try
|
||||
{
|
||||
var psi = Program_NewClaude(prompt.Text);
|
||||
var psi = NewClaude(prompt.Text);
|
||||
using var p = Process.Start(psi)!;
|
||||
p.StandardInput.Close();
|
||||
void Append(string? l) { if (l != null) BeginInvoke(() => output.AppendText(l + Environment.NewLine)); }
|
||||
@@ -70,7 +87,7 @@ class Gui : Form
|
||||
finally { send.Enabled = true; }
|
||||
}
|
||||
|
||||
static ProcessStartInfo Program_NewClaude(string prompt)
|
||||
ProcessStartInfo NewClaude(string prompt)
|
||||
{
|
||||
var psi = new ProcessStartInfo("claude")
|
||||
{
|
||||
@@ -81,6 +98,8 @@ class Gui : Form
|
||||
};
|
||||
psi.ArgumentList.Add("-p");
|
||||
psi.ArgumentList.Add(prompt);
|
||||
foreach (var (flag, value) in new[] { ("--model", model.SelectedItem is Model m ? m.Id : model.Text.Trim()), ("--effort", effort.Text) })
|
||||
if (value != "" && value != Default) { psi.ArgumentList.Add(flag); psi.ArgumentList.Add(value); }
|
||||
return psi;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user