@trans-ai/trans-code 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/provider/provider.ts +0 -27
- package/src/screens/REPL.tsx +2 -2
- package/src/version.ts +1 -1
package/package.json
CHANGED
package/src/provider/provider.ts
CHANGED
|
@@ -502,33 +502,6 @@ export function switchNote(displayName: string, pickedModel: string, served?: st
|
|
|
502
502
|
return `已切换到 ${displayName}`;
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
-
/** @deprecated Use createModel instead. Kept for the existing REPL. */
|
|
506
|
-
export function createProviderWithKey(id: string, apiKey: string): TransProvider {
|
|
507
|
-
const config = MODEL_REGISTRY[id as ModelId];
|
|
508
|
-
if (!config) throw new Error(`Unknown model: ${id}`);
|
|
509
|
-
|
|
510
|
-
registerApiKey(id, apiKey);
|
|
511
|
-
|
|
512
|
-
const model =
|
|
513
|
-
config.provider === 'anthropic'
|
|
514
|
-
? new ChatAnthropic({
|
|
515
|
-
modelName: config.model,
|
|
516
|
-
anthropicApiKey: apiKey,
|
|
517
|
-
})
|
|
518
|
-
: new ChatOpenAI({
|
|
519
|
-
modelName: config.model,
|
|
520
|
-
openAIApiKey: apiKey,
|
|
521
|
-
configuration: config.baseUrl ? { baseURL: config.baseUrl } : undefined,
|
|
522
|
-
});
|
|
523
|
-
|
|
524
|
-
return { modelId: id, model, config };
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
/** @deprecated Use createModel instead. Kept for the existing REPL. */
|
|
528
|
-
export function createProvider(id: string): TransProvider {
|
|
529
|
-
return createModel(id);
|
|
530
|
-
}
|
|
531
|
-
|
|
532
505
|
// ---- REPL key/model persistence (~/.transcode.json) ----
|
|
533
506
|
|
|
534
507
|
const keyStore = new Map<string, string>(
|
package/src/screens/REPL.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { findCommand, getCommands, type CommandContext } from '../commands.js';
|
|
5
5
|
import {
|
|
6
6
|
getAvailableModels,
|
|
7
|
-
|
|
7
|
+
createModel,
|
|
8
8
|
setPreferredModel,
|
|
9
9
|
registerApiKey,
|
|
10
10
|
lookupApiKey,
|
|
@@ -277,7 +277,7 @@ export default function REPL({ ctx, updateNotice }: REPLProps) {
|
|
|
277
277
|
const provider =
|
|
278
278
|
process.env.TRANSCODE_MOCK === '1'
|
|
279
279
|
? undefined
|
|
280
|
-
:
|
|
280
|
+
: createModel(ctx.modelId);
|
|
281
281
|
|
|
282
282
|
const projectContext = await loadProjectContext(process.cwd());
|
|
283
283
|
const systemPrompt = buildSystemPrompt(
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated from package.json by scripts/sync-version.ts (npm version hook)
|
|
2
|
-
export const VERSION = '0.7.
|
|
2
|
+
export const VERSION = '0.7.1';
|