dsclaw 0.1.2 → 0.1.4
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 +25 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +24 -12
- package/dist/index.js.map +1 -1
- package/dist/web/chat.html +23 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22065,6 +22065,12 @@ function degradationMessage(service) {
|
|
|
22065
22065
|
var log11 = createLogger("gateway");
|
|
22066
22066
|
var sessionHistories = /* @__PURE__ */ new Map();
|
|
22067
22067
|
var MAX_HISTORY = 20;
|
|
22068
|
+
function detectProviderFromKey(key) {
|
|
22069
|
+
if (key.startsWith("sk-ant-")) return "anthropic";
|
|
22070
|
+
if (key.startsWith("sk-")) return "openai";
|
|
22071
|
+
if (key.startsWith("AIza")) return "google";
|
|
22072
|
+
return null;
|
|
22073
|
+
}
|
|
22068
22074
|
var DSClawGateway = class {
|
|
22069
22075
|
config;
|
|
22070
22076
|
channels = [];
|
|
@@ -22254,18 +22260,24 @@ var DSClawGateway = class {
|
|
|
22254
22260
|
return;
|
|
22255
22261
|
}
|
|
22256
22262
|
if (!session.llmProvider) {
|
|
22257
|
-
|
|
22258
|
-
|
|
22259
|
-
|
|
22260
|
-
|
|
22261
|
-
|
|
22262
|
-
|
|
22263
|
-
|
|
22264
|
-
|
|
22265
|
-
|
|
22266
|
-
|
|
22267
|
-
|
|
22268
|
-
|
|
22263
|
+
const detected = detectProviderFromKey(text);
|
|
22264
|
+
if (detected && text.length >= 10) {
|
|
22265
|
+
session.llmProvider = detected;
|
|
22266
|
+
saveSession(userId, session);
|
|
22267
|
+
} else {
|
|
22268
|
+
await channel.send(userId, {
|
|
22269
|
+
card: {
|
|
22270
|
+
title: "Choose AI Provider",
|
|
22271
|
+
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)",
|
|
22272
|
+
actions: [
|
|
22273
|
+
{ label: "OpenAI (GPT-4o)", callbackData: "llm:openai" },
|
|
22274
|
+
{ label: "Anthropic (Claude)", callbackData: "llm:anthropic" },
|
|
22275
|
+
{ label: "Google (Gemini) \u2605", callbackData: "llm:google" }
|
|
22276
|
+
]
|
|
22277
|
+
}
|
|
22278
|
+
});
|
|
22279
|
+
return;
|
|
22280
|
+
}
|
|
22269
22281
|
}
|
|
22270
22282
|
if (isWeb) {
|
|
22271
22283
|
channel.sendClearInput(userId);
|