dsclaw 0.1.2 → 0.1.3

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/index.js CHANGED
@@ -1417,6 +1417,12 @@ function degradationMessage(service) {
1417
1417
  var log11 = createLogger("gateway");
1418
1418
  var sessionHistories = /* @__PURE__ */ new Map();
1419
1419
  var MAX_HISTORY = 20;
1420
+ function detectProviderFromKey(key) {
1421
+ if (key.startsWith("sk-ant-")) return "anthropic";
1422
+ if (key.startsWith("sk-")) return "openai";
1423
+ if (key.startsWith("AIza")) return "google";
1424
+ return null;
1425
+ }
1420
1426
  var DSClawGateway = class {
1421
1427
  config;
1422
1428
  channels = [];
@@ -1606,18 +1612,24 @@ var DSClawGateway = class {
1606
1612
  return;
1607
1613
  }
1608
1614
  if (!session.llmProvider) {
1609
- await channel.send(userId, {
1610
- card: {
1611
- title: "Choose AI Provider",
1612
- summary: "Please select your AI provider first.\n\nGet a free key:\n- **OpenAI**: [platform.openai.com/api-keys](https://platform.openai.com/api-keys)\n- **Anthropic**: [console.anthropic.com/settings/keys](https://console.anthropic.com/settings/keys)\n- **Google** (recommended): [aistudio.google.com/apikey](https://aistudio.google.com/apikey)",
1613
- actions: [
1614
- { label: "OpenAI (GPT-4o)", callbackData: "llm:openai" },
1615
- { label: "Anthropic (Claude)", callbackData: "llm:anthropic" },
1616
- { label: "Google (Gemini) \u2605", callbackData: "llm:google" }
1617
- ]
1618
- }
1619
- });
1620
- return;
1615
+ const detected = detectProviderFromKey(text);
1616
+ if (detected && text.length >= 10) {
1617
+ session.llmProvider = detected;
1618
+ saveSession(userId, session);
1619
+ } else {
1620
+ await channel.send(userId, {
1621
+ card: {
1622
+ title: "Choose AI Provider",
1623
+ summary: "Please select your AI provider first, or paste your API key directly \u2014 I'll auto-detect.\n\nGet a free key:\n- **OpenAI**: [platform.openai.com/api-keys](https://platform.openai.com/api-keys)\n- **Anthropic**: [console.anthropic.com/settings/keys](https://console.anthropic.com/settings/keys)\n- **Google** (recommended): [aistudio.google.com/apikey](https://aistudio.google.com/apikey)",
1624
+ actions: [
1625
+ { label: "OpenAI (GPT-4o)", callbackData: "llm:openai" },
1626
+ { label: "Anthropic (Claude)", callbackData: "llm:anthropic" },
1627
+ { label: "Google (Gemini) \u2605", callbackData: "llm:google" }
1628
+ ]
1629
+ }
1630
+ });
1631
+ return;
1632
+ }
1621
1633
  }
1622
1634
  if (isWeb) {
1623
1635
  channel.sendClearInput(userId);
@@ -1897,7 +1909,7 @@ async function doctorCommand() {
1897
1909
 
1898
1910
  // src/cli/index.ts
1899
1911
  var program = new Command();
1900
- program.name("dsclaw").description("AI-powered dropshipping agent \u2014 chat with your DSers store.").version("0.1.2");
1912
+ program.name("dsclaw").description("AI-powered dropshipping agent \u2014 chat with your DSers store.").version("0.1.3");
1901
1913
  program.action(() => startCommand({}));
1902
1914
  program.command("init").description("Setup wizard \u2014 configure Telegram (optional)").action(initCommand);
1903
1915
  program.command("start").description("Start the DSClaw bot").option("-c, --config <path>", "Path to config file").option("--no-open", "Don't auto-open browser").action(startCommand);