refactor: streamline AI enhancement logic in feature dialogs

- Simplified the handling of enhanced text in AddFeatureDialog and EditFeatureDialog by storing the enhanced text in a variable before updating the state.
- Updated the dropdown menu and button components to ensure consistent styling and behavior across both dialogs.
- Enhanced user experience by ensuring the cursor style indicates interactivity in the dropdown menus.

This refactor improves code readability and maintains a consistent UI experience.
This commit is contained in:
SuperComboGamer
2025-12-16 01:48:28 -05:00
parent 7131c70186
commit 1641f9da5e
4 changed files with 91 additions and 89 deletions

View File

@@ -14,7 +14,7 @@ import {
isValidEnhancementMode,
type EnhancementMode,
} from "../../../lib/enhancement-prompts.js";
import { resolveModelString } from "../../../lib/model-resolver.js";
import { resolveModelString, CLAUDE_MODEL_MAP } from "../../../lib/model-resolver.js";
const logger = createLogger("EnhancePrompt");
@@ -68,7 +68,7 @@ async function extractTextFromStream(
if (msg.type === "assistant" && msg.message?.content) {
for (const block of msg.message.content) {
if (block.type === "text" && block.text) {
responseText = block.text;
responseText += block.text;
}
}
} else if (msg.type === "result" && msg.subtype === "success") {
@@ -141,7 +141,7 @@ export function createEnhanceHandler(): (
const userPrompt = buildUserPrompt(validMode, trimmedText, true);
// Resolve the model - use the passed model, default to sonnet for quality
const resolvedModel = resolveModelString(model, "claude-sonnet-4-20250514");
const resolvedModel = resolveModelString(model, CLAUDE_MODEL_MAP.sonnet);
logger.debug(`Using model: ${resolvedModel}`);