Skip to content

Commit 5e84dc4

Browse files
committed
fix: xata clone config --mode=ai (#2629)
Synced from monorepo@1da65b45fc9190b0ae85a8d80fb43e2891fdeab0
1 parent b995155 commit 5e84dc4

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

.sync-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fd1fcfb9be6f0863b3a59624e3c64c3e86243b59
1+
1da65b45fc9190b0ae85a8d80fb43e2891fdeab0

src/commands/ai/sql.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Flags = {
1616
project?: string;
1717
branch?: string;
1818
database?: string;
19+
model?: string;
1920
yes: boolean;
2021
};
2122

@@ -113,7 +114,7 @@ export async function implementation(this: LocalContext, flags: Flags) {
113114

114115
const handleGenerateSQL = async (query: string, currentSQL: string): Promise<string> => {
115116
invariant(env.ANTHROPIC_API_KEY, 'ANTHROPIC_API_KEY is required for AI features');
116-
return await generateSQL(env.ANTHROPIC_API_KEY, query, formattedSchema, currentSQL);
117+
return await generateSQL(env.ANTHROPIC_API_KEY, query, formattedSchema, currentSQL, { model: flags.model });
117118
};
118119

119120
const ui = new TerminalUI({
@@ -161,6 +162,12 @@ export const GenerateSQLCommand = buildCommand({
161162
parse: String,
162163
optional: true
163164
},
165+
model: {
166+
kind: 'parsed',
167+
brief: 'Anthropic model override for AI SQL generation',
168+
parse: String,
169+
optional: true
170+
},
164171
yes: {
165172
kind: 'boolean',
166173
brief: 'Do not ask for confirmation, assume yes.',

src/commands/clone/config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type Flags = {
6060
project?: string;
6161
branch?: string;
6262
prompt?: string;
63+
model?: string;
6364
};
6465

6566
export async function implementation(this: LocalContext, flags: Flags) {
@@ -147,7 +148,8 @@ export async function implementation(this: LocalContext, flags: Flags) {
147148
env.ANTHROPIC_API_KEY,
148149
effectivePrompt,
149150
formattedSchema,
150-
previousConfigYaml
151+
previousConfigYaml,
152+
{ model: flags.model }
151153
);
152154
} catch (err) {
153155
this.process.stderr.write(
@@ -265,6 +267,12 @@ export const CloneConfigCommand = buildCommand({
265267
brief: 'Instructions for AI mode (e.g., which columns to anonymize, specific transformers to use)',
266268
parse: String,
267269
optional: true
270+
},
271+
model: {
272+
kind: 'parsed',
273+
brief: 'Anthropic model override for AI mode',
274+
parse: String,
275+
optional: true
268276
}
269277
}
270278
},

0 commit comments

Comments
 (0)