增加 opusplan 模式
Some checks are pending
Build Linux / Build Linux x86_64 (push) Waiting to run
Build Test / Build Test (${{ matrix.platform.name }}) (map[name:Linux os:ubuntu-latest rust-target:x86_64-unknown-linux-gnu]) (push) Waiting to run
Build Test / Build Test (${{ matrix.platform.name }}) (map[name:Windows os:windows-latest rust-target:x86_64-pc-windows-msvc]) (push) Waiting to run
Build Test / Build Test (${{ matrix.platform.name }}) (map[name:macOS os:macos-latest rust-target:x86_64-apple-darwin]) (push) Waiting to run
Build Test / Build Test Summary (push) Blocked by required conditions

This commit is contained in:
2025-08-14 00:21:11 +08:00
parent 28d00f9e62
commit 96eb05856e
5 changed files with 38 additions and 10 deletions

View File

@@ -926,11 +926,17 @@ pub async fn execute_claude_code(
let claude_path = find_claude_binary(&app)?;
// Map opus-plan to the appropriate Claude CLI parameter
let claude_model = match model.as_str() {
"opus-plan" => "opusplan".to_string(),
_ => model.clone()
};
let args = vec![
"-p".to_string(),
prompt.clone(),
"--model".to_string(),
model.clone(),
claude_model,
"--output-format".to_string(),
"stream-json".to_string(),
"--verbose".to_string(),
@@ -957,12 +963,18 @@ pub async fn continue_claude_code(
let claude_path = find_claude_binary(&app)?;
// Map opus-plan to the appropriate Claude CLI parameter
let claude_model = match model.as_str() {
"opus-plan" => "opusplan".to_string(),
_ => model.clone()
};
let args = vec![
"-c".to_string(), // Continue flag
"-p".to_string(),
prompt.clone(),
"--model".to_string(),
model.clone(),
claude_model,
"--output-format".to_string(),
"stream-json".to_string(),
"--verbose".to_string(),
@@ -991,13 +1003,19 @@ pub async fn resume_claude_code(
let claude_path = find_claude_binary(&app)?;
// Map opus-plan to the appropriate Claude CLI parameter
let claude_model = match model.as_str() {
"opus-plan" => "opusplan".to_string(),
_ => model.clone()
};
let args = vec![
"--resume".to_string(),
session_id.clone(),
"-p".to_string(),
prompt.clone(),
"--model".to_string(),
model.clone(),
claude_model,
"--output-format".to_string(),
"stream-json".to_string(),
"--verbose".to_string(),

View File

@@ -141,7 +141,7 @@ export const ClaudeCodeSession: React.FC<ClaudeCodeSessionProps> = ({
const [forkSessionName, setForkSessionName] = useState("");
// Queued prompts state
const [queuedPrompts, setQueuedPrompts] = useState<Array<{ id: string; prompt: string; model: "sonnet" | "opus" }>>([]);
const [queuedPrompts, setQueuedPrompts] = useState<Array<{ id: string; prompt: string; model: "sonnet" | "opus" | "opus-plan" }>>([]);
// 使用布局管理器的预览功能
// Note: openLayoutPreview is used directly instead of wrapping in handleOpenPreview
@@ -175,7 +175,7 @@ export const ClaudeCodeSession: React.FC<ClaudeCodeSessionProps> = ({
const unlistenRefs = useRef<UnlistenFn[]>([]);
const hasActiveSessionRef = useRef(false);
const floatingPromptRef = useRef<FloatingPromptInputRef>(null);
const queuedPromptsRef = useRef<Array<{ id: string; prompt: string; model: "sonnet" | "opus" }>>([]);
const queuedPromptsRef = useRef<Array<{ id: string; prompt: string; model: "sonnet" | "opus" | "opus-plan" }>>([]);
const isMountedRef = useRef(true);
const isListeningRef = useRef(false);
const sessionStartTime = useRef<number>(Date.now());
@@ -642,7 +642,7 @@ export const ClaudeCodeSession: React.FC<ClaudeCodeSessionProps> = ({
}
};
const handleSendPrompt = async (prompt: string, model: "sonnet" | "opus") => {
const handleSendPrompt = async (prompt: string, model: "sonnet" | "opus" | "opus-plan") => {
console.log('[ClaudeCodeSession] handleSendPrompt called with:', { prompt, model, projectPath, claudeSessionId, effectiveSession });
if (!projectPath) {

View File

@@ -26,7 +26,7 @@ interface FloatingPromptInputProps {
/**
* Callback when prompt is sent
*/
onSend: (prompt: string, model: "sonnet" | "opus") => void;
onSend: (prompt: string, model: "sonnet" | "opus" | "opus-plan") => void;
/**
* Whether the input is loading
*/
@@ -38,7 +38,7 @@ interface FloatingPromptInputProps {
/**
* Default model to select
*/
defaultModel?: "sonnet" | "opus";
defaultModel?: "sonnet" | "opus" | "opus-plan";
/**
* Project path for file picker
*/
@@ -95,7 +95,7 @@ const ThinkingModeIndicator: React.FC<{ level: number }> = ({ level }) => {
};
type Model = {
id: "sonnet" | "opus";
id: "sonnet" | "opus" | "opus-plan";
name: string;
description: string;
icon: React.ReactNode;
@@ -139,6 +139,12 @@ const FloatingPromptInputInner = (
name: t('agents.opusName'),
description: t('agents.opusDescription'),
icon: <Sparkles className="h-4 w-4" />
},
{
id: "opus-plan",
name: t('agents.opusPlanName'),
description: t('agents.opusPlanDescription'),
icon: <Brain className="h-4 w-4" />
}
];
@@ -180,7 +186,7 @@ const FloatingPromptInputInner = (
}
];
const [prompt, setPrompt] = useState("");
const [selectedModel, setSelectedModel] = useState<"sonnet" | "opus">(defaultModel);
const [selectedModel, setSelectedModel] = useState<"sonnet" | "opus" | "opus-plan">(defaultModel);
const [selectedThinkingMode, setSelectedThinkingMode] = useState<ThinkingMode>("auto");
const [isExpanded, setIsExpanded] = useState(false);
const [modelPickerOpen, setModelPickerOpen] = useState(false);

View File

@@ -198,6 +198,8 @@
"sonnetDescription": "Faster, efficient for most tasks",
"opusName": "Claude 4.1 Opus",
"opusDescription": "More capable, better for complex tasks",
"opusPlanName": "Opus Plan Mode",
"opusPlanDescription": "Use Opus 4.1 for planning, Sonnet 4 otherwise",
"defaultTaskDescription": "This will be used as the default task placeholder when executing the agent",
"systemPromptDescription": "Define the behavior and capabilities of your CC Agent",
"manageAgents": "Manage your Claude Code agents",

View File

@@ -187,6 +187,8 @@
"sonnetDescription": "更快,适用于大多数任务",
"opusName": "Claude 4.1 Opus",
"opusDescription": "功能更强,适用于复杂任务",
"opusPlanName": "Opus 计划模式",
"opusPlanDescription": "计划时使用 Opus 4.1,执行时使用 Sonnet 4",
"defaultTaskDescription": "执行智能体时将用作默认任务占位符",
"systemPromptDescription": "定义您的 CC 智能体的行为和功能",
"manageAgents": "管理您的 Claude Code 智能体",