Support turbo edits (pro) (#166)

This commit is contained in:
Will Chen
2025-05-14 23:35:50 -07:00
committed by GitHub
parent d545babb63
commit 35b459d82d
12 changed files with 400 additions and 26 deletions

View File

@@ -215,17 +215,16 @@ export function registerChatStreamHandlers() {
} else {
// Normal AI processing for non-test prompts
const settings = readSettings();
const { modelClient, backupModelClients } = await getModelClient(
settings.selectedModel,
settings,
);
// Extract codebase information if app is associated with the chat
let codebaseInfo = "";
let files: { path: string; content: string }[] = [];
if (updatedChat.app) {
const appPath = getDyadAppPath(updatedChat.app.path);
try {
codebaseInfo = await extractCodebase(appPath);
const out = await extractCodebase(appPath);
codebaseInfo = out.formattedOutput;
files = out.files;
logger.log(`Extracted codebase information from ${appPath}`);
} catch (error) {
logger.error("Error extracting codebase:", error);
@@ -237,6 +236,11 @@ export function registerChatStreamHandlers() {
"estimated tokens",
codebaseInfo.length / 4,
);
const { modelClient, backupModelClients } = await getModelClient(
settings.selectedModel,
settings,
files,
);
// Prepare message history for the AI
const messageHistory = updatedChat.messages.map((message) => ({