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.mjs
CHANGED
|
@@ -12631,9 +12631,11 @@ function saveConfig(config) {
|
|
|
12631
12631
|
}
|
|
12632
12632
|
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
12633
12633
|
}
|
|
12634
|
+
var packageJson = __require(path5.join(__dirname, "../package.json"));
|
|
12634
12635
|
async function main() {
|
|
12635
12636
|
const program = new Command();
|
|
12636
|
-
|
|
12637
|
+
const version = packageJson.version;
|
|
12638
|
+
program.name("langtrain").description(packageJson.description || "Langtrain CLI for AI Model Fine-tuning and Generation").version(version);
|
|
12637
12639
|
program.action(async () => {
|
|
12638
12640
|
console.clear();
|
|
12639
12641
|
const banner = `
|
|
@@ -12645,23 +12647,24 @@ async function main() {
|
|
|
12645
12647
|
\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
|
|
12646
12648
|
`;
|
|
12647
12649
|
console.log(gradient(["#00DC82", "#36E4DA", "#0047E1"])(banner));
|
|
12648
|
-
intro(`${bgCyan(black(
|
|
12650
|
+
intro(`${bgCyan(black(` Langtrain SDK v${version} `))}`);
|
|
12649
12651
|
const config = getConfig();
|
|
12650
12652
|
if (!config.apiKey) {
|
|
12651
12653
|
intro(yellow("Authentication required"));
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12654
|
+
await handleLogin();
|
|
12655
|
+
}
|
|
12656
|
+
const handlers = {
|
|
12657
|
+
"login": handleLogin,
|
|
12658
|
+
"tune-finetune": (c) => handleTuneFinetune(c.tune),
|
|
12659
|
+
"tune-generate": (c) => handleTuneGenerate(c.tune),
|
|
12660
|
+
"vision-finetune": (c) => handleVisionFinetune(c.vision),
|
|
12661
|
+
"vision-generate": (c) => handleVisionGenerate(c.vision),
|
|
12662
|
+
"agent-list": (c) => handleAgentList(c.agent),
|
|
12663
|
+
"exit": async () => {
|
|
12664
|
+
outro("Goodbye!");
|
|
12660
12665
|
process.exit(0);
|
|
12661
12666
|
}
|
|
12662
|
-
|
|
12663
|
-
intro(green("Successfully logged in!"));
|
|
12664
|
-
}
|
|
12667
|
+
};
|
|
12665
12668
|
while (true) {
|
|
12666
12669
|
const operation = await select({
|
|
12667
12670
|
message: "Select an operation:",
|
|
@@ -12679,33 +12682,26 @@ async function main() {
|
|
|
12679
12682
|
{ value: "exit", label: " \u21B3 Exit" }
|
|
12680
12683
|
]
|
|
12681
12684
|
});
|
|
12682
|
-
if (isCancel(operation)
|
|
12685
|
+
if (isCancel(operation)) {
|
|
12683
12686
|
outro("Goodbye!");
|
|
12684
12687
|
process.exit(0);
|
|
12685
12688
|
}
|
|
12686
|
-
if (typeof operation === "string"
|
|
12687
|
-
continue;
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12693
|
-
|
|
12694
|
-
|
|
12695
|
-
|
|
12696
|
-
|
|
12697
|
-
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
|
|
12702
|
-
} else if (operation === "vision-generate") {
|
|
12703
|
-
await handleVisionGenerate(currentVision);
|
|
12704
|
-
} else if (operation === "agent-list") {
|
|
12705
|
-
await handleAgentList(currentAgent);
|
|
12706
|
-
}
|
|
12707
|
-
} catch (error) {
|
|
12708
|
-
outro(red(`Error: ${error.message}`));
|
|
12689
|
+
if (typeof operation === "string") {
|
|
12690
|
+
if (operation.startsWith("group-")) continue;
|
|
12691
|
+
const handler = handlers[operation];
|
|
12692
|
+
if (handler) {
|
|
12693
|
+
try {
|
|
12694
|
+
const currentConfig = getConfig();
|
|
12695
|
+
const clients = {
|
|
12696
|
+
vision: new Langvision({ apiKey: currentConfig.apiKey }),
|
|
12697
|
+
tune: new Langtune({ apiKey: currentConfig.apiKey }),
|
|
12698
|
+
agent: new AgentClient({ apiKey: currentConfig.apiKey, baseUrl: currentConfig.baseUrl })
|
|
12699
|
+
};
|
|
12700
|
+
await handler(clients);
|
|
12701
|
+
} catch (error) {
|
|
12702
|
+
outro(red(`Error: ${error.message}`));
|
|
12703
|
+
}
|
|
12704
|
+
}
|
|
12709
12705
|
}
|
|
12710
12706
|
}
|
|
12711
12707
|
});
|