generated from nhcarrigan/template
feat: add configurable max output tokens setting
This commit is contained in:
@@ -31,6 +31,9 @@ pub struct ClaudeStartOptions {
|
|||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub disable_1m_context: bool,
|
pub disable_1m_context: bool,
|
||||||
|
|
||||||
|
#[serde(default)]
|
||||||
|
pub max_output_tokens: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
@@ -126,6 +129,9 @@ pub struct HikariConfig {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub disable_1m_context: bool,
|
pub disable_1m_context: bool,
|
||||||
|
|
||||||
|
#[serde(default)]
|
||||||
|
pub max_output_tokens: Option<u64>,
|
||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub trusted_workspaces: Vec<String>,
|
pub trusted_workspaces: Vec<String>,
|
||||||
|
|
||||||
@@ -172,6 +178,7 @@ impl Default for HikariConfig {
|
|||||||
discord_rpc_enabled: true,
|
discord_rpc_enabled: true,
|
||||||
use_worktree: false,
|
use_worktree: false,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
|
max_output_tokens: None,
|
||||||
trusted_workspaces: Vec::new(),
|
trusted_workspaces: Vec::new(),
|
||||||
background_image_path: None,
|
background_image_path: None,
|
||||||
background_image_opacity: 0.3,
|
background_image_opacity: 0.3,
|
||||||
@@ -325,6 +332,7 @@ mod tests {
|
|||||||
discord_rpc_enabled: true,
|
discord_rpc_enabled: true,
|
||||||
use_worktree: true,
|
use_worktree: true,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
|
max_output_tokens: Some(32000),
|
||||||
trusted_workspaces: vec!["/home/naomi/projects/trusted".to_string()],
|
trusted_workspaces: vec!["/home/naomi/projects/trusted".to_string()],
|
||||||
background_image_path: Some("/home/naomi/bg.png".to_string()),
|
background_image_path: Some("/home/naomi/bg.png".to_string()),
|
||||||
background_image_opacity: 0.25,
|
background_image_opacity: 0.25,
|
||||||
|
|||||||
@@ -296,6 +296,11 @@ impl WslBridge {
|
|||||||
cmd.env("CLAUDE_CODE_DISABLE_1M_CONTEXT", "1");
|
cmd.env("CLAUDE_CODE_DISABLE_1M_CONTEXT", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set max output tokens if specified
|
||||||
|
if let Some(max_tokens) = options.max_output_tokens {
|
||||||
|
cmd.env("CLAUDE_CODE_MAX_OUTPUT_TOKENS", max_tokens.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
cmd
|
cmd
|
||||||
} else {
|
} else {
|
||||||
// Running on Windows - use wsl with bash login shell to ensure PATH is loaded
|
// Running on Windows - use wsl with bash login shell to ensure PATH is loaded
|
||||||
@@ -343,6 +348,11 @@ impl WslBridge {
|
|||||||
claude_cmd.push_str("CLAUDE_CODE_DISABLE_1M_CONTEXT=1 ");
|
claude_cmd.push_str("CLAUDE_CODE_DISABLE_1M_CONTEXT=1 ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set max output tokens if specified
|
||||||
|
if let Some(max_tokens) = options.max_output_tokens {
|
||||||
|
claude_cmd.push_str(&format!("CLAUDE_CODE_MAX_OUTPUT_TOKENS={} ", max_tokens));
|
||||||
|
}
|
||||||
|
|
||||||
claude_cmd.push_str(
|
claude_cmd.push_str(
|
||||||
"claude --output-format stream-json --input-format stream-json --verbose",
|
"claude --output-format stream-json --input-format stream-json --verbose",
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ async function changeDirectory(path: string): Promise<void> {
|
|||||||
allowed_tools: allAllowedTools,
|
allowed_tools: allAllowedTools,
|
||||||
use_worktree: config.use_worktree ?? false,
|
use_worktree: config.use_worktree ?? false,
|
||||||
disable_1m_context: config.disable_1m_context ?? false,
|
disable_1m_context: config.disable_1m_context ?? false,
|
||||||
|
max_output_tokens: config.max_output_tokens ?? null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -139,6 +140,7 @@ async function startNewConversation(): Promise<void> {
|
|||||||
allowed_tools: allAllowedTools,
|
allowed_tools: allAllowedTools,
|
||||||
use_worktree: config.use_worktree ?? false,
|
use_worktree: config.use_worktree ?? false,
|
||||||
disable_1m_context: config.disable_1m_context ?? false,
|
disable_1m_context: config.disable_1m_context ?? false,
|
||||||
|
max_output_tokens: config.max_output_tokens ?? null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
show_thinking_blocks: true,
|
show_thinking_blocks: true,
|
||||||
use_worktree: false,
|
use_worktree: false,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
|
max_output_tokens: null,
|
||||||
trusted_workspaces: [],
|
trusted_workspaces: [],
|
||||||
background_image_path: null,
|
background_image_path: null,
|
||||||
background_image_opacity: 0.3,
|
background_image_opacity: 0.3,
|
||||||
@@ -533,6 +534,25 @@
|
|||||||
context window
|
context window
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Max Output Tokens -->
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="block text-sm text-[var(--text-primary)] mb-1" for="max-output-tokens">
|
||||||
|
Max output tokens
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
id="max-output-tokens"
|
||||||
|
type="number"
|
||||||
|
min="1"
|
||||||
|
placeholder="Default (32000)"
|
||||||
|
bind:value={config.max_output_tokens}
|
||||||
|
class="w-full px-3 py-2 text-sm bg-[var(--bg-primary)] border border-[var(--border-color)] rounded text-[var(--text-primary)] placeholder-[var(--text-tertiary)] focus:outline-none focus:border-[var(--accent-primary)]"
|
||||||
|
/>
|
||||||
|
<p class="text-xs text-[var(--text-tertiary)] mt-1">
|
||||||
|
Sets <code class="font-mono">CLAUDE_CODE_MAX_OUTPUT_TOKENS</code> — increase if responses are
|
||||||
|
being cut off mid-reply
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Greeting Section -->
|
<!-- Greeting Section -->
|
||||||
|
|||||||
@@ -107,6 +107,7 @@
|
|||||||
show_thinking_blocks: true,
|
show_thinking_blocks: true,
|
||||||
use_worktree: false,
|
use_worktree: false,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
|
max_output_tokens: null,
|
||||||
trusted_workspaces: [],
|
trusted_workspaces: [],
|
||||||
background_image_path: null,
|
background_image_path: null,
|
||||||
background_image_opacity: 0.3,
|
background_image_opacity: 0.3,
|
||||||
@@ -185,6 +186,7 @@
|
|||||||
allowed_tools: allAllowedTools,
|
allowed_tools: allAllowedTools,
|
||||||
use_worktree: currentConfig.use_worktree ?? false,
|
use_worktree: currentConfig.use_worktree ?? false,
|
||||||
disable_1m_context: currentConfig.disable_1m_context ?? false,
|
disable_1m_context: currentConfig.disable_1m_context ?? false,
|
||||||
|
max_output_tokens: currentConfig.max_output_tokens ?? null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -344,6 +346,7 @@
|
|||||||
allowed_tools: allAllowedTools,
|
allowed_tools: allAllowedTools,
|
||||||
use_worktree: currentConfig.use_worktree ?? false,
|
use_worktree: currentConfig.use_worktree ?? false,
|
||||||
disable_1m_context: currentConfig.disable_1m_context ?? false,
|
disable_1m_context: currentConfig.disable_1m_context ?? false,
|
||||||
|
max_output_tokens: currentConfig.max_output_tokens ?? null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ describe("config store", () => {
|
|||||||
show_thinking_blocks: true,
|
show_thinking_blocks: true,
|
||||||
use_worktree: false,
|
use_worktree: false,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
|
max_output_tokens: null,
|
||||||
trusted_workspaces: [],
|
trusted_workspaces: [],
|
||||||
background_image_path: null,
|
background_image_path: null,
|
||||||
background_image_opacity: 0.3,
|
background_image_opacity: 0.3,
|
||||||
@@ -247,6 +248,7 @@ describe("config store", () => {
|
|||||||
show_thinking_blocks: true,
|
show_thinking_blocks: true,
|
||||||
use_worktree: false,
|
use_worktree: false,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
|
max_output_tokens: null,
|
||||||
trusted_workspaces: [],
|
trusted_workspaces: [],
|
||||||
background_image_path: null,
|
background_image_path: null,
|
||||||
background_image_opacity: 0.3,
|
background_image_opacity: 0.3,
|
||||||
@@ -797,6 +799,7 @@ describe("config store", () => {
|
|||||||
show_thinking_blocks: true,
|
show_thinking_blocks: true,
|
||||||
use_worktree: false,
|
use_worktree: false,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
|
max_output_tokens: null,
|
||||||
trusted_workspaces: [],
|
trusted_workspaces: [],
|
||||||
background_image_path: null,
|
background_image_path: null,
|
||||||
background_image_opacity: 0.3,
|
background_image_opacity: 0.3,
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ export interface HikariConfig {
|
|||||||
use_worktree: boolean;
|
use_worktree: boolean;
|
||||||
// Disable 1M context window
|
// Disable 1M context window
|
||||||
disable_1m_context: boolean;
|
disable_1m_context: boolean;
|
||||||
|
// Max output tokens for Claude Code responses
|
||||||
|
max_output_tokens: number | null;
|
||||||
// Workspaces the user has explicitly trusted
|
// Workspaces the user has explicitly trusted
|
||||||
trusted_workspaces: string[];
|
trusted_workspaces: string[];
|
||||||
// Background image settings
|
// Background image settings
|
||||||
@@ -98,6 +100,7 @@ const defaultConfig: HikariConfig = {
|
|||||||
show_thinking_blocks: true,
|
show_thinking_blocks: true,
|
||||||
use_worktree: false,
|
use_worktree: false,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
|
max_output_tokens: null,
|
||||||
trusted_workspaces: [],
|
trusted_workspaces: [],
|
||||||
background_image_path: null,
|
background_image_path: null,
|
||||||
background_image_opacity: 0.3,
|
background_image_opacity: 0.3,
|
||||||
|
|||||||
Reference in New Issue
Block a user