langtrain 0.1.9 → 0.1.10
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/dist/cli.js +33 -37
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +33 -37
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli.ts +38 -48
package/dist/cli.js
CHANGED
|
@@ -12626,9 +12626,11 @@ function saveConfig(config) {
|
|
|
12626
12626
|
}
|
|
12627
12627
|
import_fs.default.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
12628
12628
|
}
|
|
12629
|
+
var packageJson = require(import_path.default.join(__dirname, "../package.json"));
|
|
12629
12630
|
async function main() {
|
|
12630
12631
|
const program = new import_commander.Command();
|
|
12631
|
-
|
|
12632
|
+
const version = packageJson.version;
|
|
12633
|
+
program.name("langtrain").description(packageJson.description || "Langtrain CLI for AI Model Fine-tuning and Generation").version(version);
|
|
12632
12634
|
program.action(async () => {
|
|
12633
12635
|
console.clear();
|
|
12634
12636
|
const banner = `
|
|
@@ -12640,23 +12642,24 @@ async function main() {
|
|
|
12640
12642
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D
|
|
12641
12643
|
`;
|
|
12642
12644
|
console.log((0, import_gradient_string.default)(["#00DC82", "#36E4DA", "#0047E1"])(banner));
|
|
12643
|
-
(0, import_prompts.intro)(`${(0, import_colors.bgCyan)((0, import_colors.black)(
|
|
12645
|
+
(0, import_prompts.intro)(`${(0, import_colors.bgCyan)((0, import_colors.black)(` Langtrain SDK v${version} `))}`);
|
|
12644
12646
|
const config = getConfig();
|
|
12645
12647
|
if (!config.apiKey) {
|
|
12646
12648
|
(0, import_prompts.intro)((0, import_colors.yellow)("Authentication required"));
|
|
12647
|
-
|
|
12648
|
-
|
|
12649
|
-
|
|
12650
|
-
|
|
12651
|
-
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
|
|
12649
|
+
await handleLogin();
|
|
12650
|
+
}
|
|
12651
|
+
const handlers = {
|
|
12652
|
+
"login": handleLogin,
|
|
12653
|
+
"tune-finetune": (c) => handleTuneFinetune(c.tune),
|
|
12654
|
+
"tune-generate": (c) => handleTuneGenerate(c.tune),
|
|
12655
|
+
"vision-finetune": (c) => handleVisionFinetune(c.vision),
|
|
12656
|
+
"vision-generate": (c) => handleVisionGenerate(c.vision),
|
|
12657
|
+
"agent-list": (c) => handleAgentList(c.agent),
|
|
12658
|
+
"exit": async () => {
|
|
12659
|
+
(0, import_prompts.outro)("Goodbye!");
|
|
12655
12660
|
process.exit(0);
|
|
12656
12661
|
}
|
|
12657
|
-
|
|
12658
|
-
(0, import_prompts.intro)((0, import_colors.green)("Successfully logged in!"));
|
|
12659
|
-
}
|
|
12662
|
+
};
|
|
12660
12663
|
while (true) {
|
|
12661
12664
|
const operation = await (0, import_prompts.select)({
|
|
12662
12665
|
message: "Select an operation:",
|
|
@@ -12674,33 +12677,26 @@ async function main() {
|
|
|
12674
12677
|
{ value: "exit", label: " \u21B3 Exit" }
|
|
12675
12678
|
]
|
|
12676
12679
|
});
|
|
12677
|
-
if ((0, import_prompts.isCancel)(operation)
|
|
12680
|
+
if ((0, import_prompts.isCancel)(operation)) {
|
|
12678
12681
|
(0, import_prompts.outro)("Goodbye!");
|
|
12679
12682
|
process.exit(0);
|
|
12680
12683
|
}
|
|
12681
|
-
if (typeof operation === "string"
|
|
12682
|
-
continue;
|
|
12683
|
-
|
|
12684
|
-
|
|
12685
|
-
|
|
12686
|
-
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12693
|
-
|
|
12694
|
-
|
|
12695
|
-
|
|
12696
|
-
|
|
12697
|
-
} else if (operation === "vision-generate") {
|
|
12698
|
-
await handleVisionGenerate(currentVision);
|
|
12699
|
-
} else if (operation === "agent-list") {
|
|
12700
|
-
await handleAgentList(currentAgent);
|
|
12701
|
-
}
|
|
12702
|
-
} catch (error) {
|
|
12703
|
-
(0, import_prompts.outro)((0, import_colors.red)(`Error: ${error.message}`));
|
|
12684
|
+
if (typeof operation === "string") {
|
|
12685
|
+
if (operation.startsWith("group-")) continue;
|
|
12686
|
+
const handler = handlers[operation];
|
|
12687
|
+
if (handler) {
|
|
12688
|
+
try {
|
|
12689
|
+
const currentConfig = getConfig();
|
|
12690
|
+
const clients = {
|
|
12691
|
+
vision: new Langvision({ apiKey: currentConfig.apiKey }),
|
|
12692
|
+
tune: new Langtune({ apiKey: currentConfig.apiKey }),
|
|
12693
|
+
agent: new AgentClient({ apiKey: currentConfig.apiKey, baseUrl: currentConfig.baseUrl })
|
|
12694
|
+
};
|
|
12695
|
+
await handler(clients);
|
|
12696
|
+
} catch (error) {
|
|
12697
|
+
(0, import_prompts.outro)((0, import_colors.red)(`Error: ${error.message}`));
|
|
12698
|
+
}
|
|
12699
|
+
}
|
|
12704
12700
|
}
|
|
12705
12701
|
}
|
|
12706
12702
|
});
|