@objectstack/service-settings 7.0.0 → 7.2.0
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/index.cjs +178 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +178 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1318,7 +1318,16 @@ var manifest3 = {
|
|
|
1318
1318
|
{ value: "gateway", label: "Vercel AI Gateway" },
|
|
1319
1319
|
{ value: "openai", label: "OpenAI" },
|
|
1320
1320
|
{ value: "anthropic", label: "Anthropic" },
|
|
1321
|
-
{ value: "google", label: "Google Generative AI" }
|
|
1321
|
+
{ value: "google", label: "Google Generative AI" },
|
|
1322
|
+
// Below: providers expose an OpenAI-compatible Chat Completions API,
|
|
1323
|
+
// so they reuse the @ai-sdk/openai SDK with a preset base_url. The
|
|
1324
|
+
// plugin's buildAdapterFromValues maps these onto provider="openai"
|
|
1325
|
+
// + an auto-filled openai_base_url at runtime.
|
|
1326
|
+
{ value: "deepseek", label: "DeepSeek (OpenAI-compatible)" },
|
|
1327
|
+
{ value: "dashscope", label: "\u963F\u91CC\u901A\u4E49 DashScope (OpenAI-compatible)" },
|
|
1328
|
+
{ value: "cloudflare", label: "Cloudflare AI Gateway (OpenAI-compatible)" },
|
|
1329
|
+
{ value: "siliconflow", label: "\u7845\u57FA\u6D41\u52A8 SiliconFlow (OpenAI-compatible)" },
|
|
1330
|
+
{ value: "openrouter", label: "OpenRouter (OpenAI-compatible)" }
|
|
1322
1331
|
]
|
|
1323
1332
|
},
|
|
1324
1333
|
// ── Vercel AI Gateway ─────────────────────────────────────────
|
|
@@ -1431,6 +1440,160 @@ var manifest3 = {
|
|
|
1431
1440
|
default: "gemini-2.0-flash",
|
|
1432
1441
|
visible: "${data.provider === 'google'}"
|
|
1433
1442
|
},
|
|
1443
|
+
// ── OpenAI-compatible presets (DeepSeek / DashScope / Cloudflare / …) ──
|
|
1444
|
+
//
|
|
1445
|
+
// These providers all expose `/v1/chat/completions` in OpenAI shape, so
|
|
1446
|
+
// we reuse the `@ai-sdk/openai` SDK with a preset base URL. The plugin
|
|
1447
|
+
// normalises `provider=deepseek` (etc.) to `provider=openai` at adapter
|
|
1448
|
+
// construction time, injecting the right base URL and a sensible default
|
|
1449
|
+
// model id. Users only fill in API key + (optionally) model — the URL
|
|
1450
|
+
// is preset, eliminating the #1 onboarding mistake.
|
|
1451
|
+
{
|
|
1452
|
+
type: "group",
|
|
1453
|
+
id: "deepseek",
|
|
1454
|
+
label: "DeepSeek",
|
|
1455
|
+
required: false,
|
|
1456
|
+
visible: "${data.provider === 'deepseek'}",
|
|
1457
|
+
description: "OpenAI-compatible API at https://api.deepseek.com. Base URL is auto-filled."
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
type: "password",
|
|
1461
|
+
key: "deepseek_api_key",
|
|
1462
|
+
label: "DeepSeek API key",
|
|
1463
|
+
required: true,
|
|
1464
|
+
encrypted: true,
|
|
1465
|
+
description: "sk-... \u2014 issued at platform.deepseek.com.",
|
|
1466
|
+
visible: "${data.provider === 'deepseek'}"
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
type: "text",
|
|
1470
|
+
key: "deepseek_model",
|
|
1471
|
+
label: "Model",
|
|
1472
|
+
required: false,
|
|
1473
|
+
default: "deepseek-chat",
|
|
1474
|
+
description: "Examples: deepseek-chat (V3), deepseek-reasoner (R1 thinking).",
|
|
1475
|
+
visible: "${data.provider === 'deepseek'}"
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
type: "group",
|
|
1479
|
+
id: "dashscope",
|
|
1480
|
+
label: "\u963F\u91CC\u901A\u4E49 DashScope",
|
|
1481
|
+
required: false,
|
|
1482
|
+
visible: "${data.provider === 'dashscope'}",
|
|
1483
|
+
description: "OpenAI-compatible endpoint at dashscope.aliyuncs.com/compatible-mode/v1. Base URL is auto-filled."
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
type: "password",
|
|
1487
|
+
key: "dashscope_api_key",
|
|
1488
|
+
label: "DashScope API key",
|
|
1489
|
+
required: true,
|
|
1490
|
+
encrypted: true,
|
|
1491
|
+
description: "sk-... \u2014 issued at dashscope.console.aliyun.com.",
|
|
1492
|
+
visible: "${data.provider === 'dashscope'}"
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
type: "text",
|
|
1496
|
+
key: "dashscope_model",
|
|
1497
|
+
label: "Model",
|
|
1498
|
+
required: false,
|
|
1499
|
+
default: "qwen-plus",
|
|
1500
|
+
description: "Examples: qwen-plus, qwen-max, qwen3-max, qwen-turbo.",
|
|
1501
|
+
visible: "${data.provider === 'dashscope'}"
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
type: "group",
|
|
1505
|
+
id: "cloudflare",
|
|
1506
|
+
label: "Cloudflare AI Gateway",
|
|
1507
|
+
required: false,
|
|
1508
|
+
visible: "${data.provider === 'cloudflare'}",
|
|
1509
|
+
description: "Uses the /compat endpoint so the model id is `provider/model` (e.g. `openai/gpt-4o-mini`, `anthropic/claude-3-5-sonnet`, `deepseek/deepseek-chat`). Note: alibaba/qwen* is NOT supported by Cloudflare /compat \u2014 use the DashScope provider for Qwen."
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
type: "text",
|
|
1513
|
+
key: "cloudflare_account_id",
|
|
1514
|
+
label: "Cloudflare account id",
|
|
1515
|
+
required: true,
|
|
1516
|
+
description: "The 32-char hex id from your Cloudflare dashboard URL.",
|
|
1517
|
+
visible: "${data.provider === 'cloudflare'}"
|
|
1518
|
+
},
|
|
1519
|
+
{
|
|
1520
|
+
type: "text",
|
|
1521
|
+
key: "cloudflare_gateway_id",
|
|
1522
|
+
label: "Gateway id",
|
|
1523
|
+
required: false,
|
|
1524
|
+
default: "default",
|
|
1525
|
+
description: "Gateway name configured in Cloudflare \u2192 AI Gateway. Defaults to `default`.",
|
|
1526
|
+
visible: "${data.provider === 'cloudflare'}"
|
|
1527
|
+
},
|
|
1528
|
+
{
|
|
1529
|
+
type: "password",
|
|
1530
|
+
key: "cloudflare_api_key",
|
|
1531
|
+
label: "Cloudflare AI Gateway token",
|
|
1532
|
+
required: true,
|
|
1533
|
+
encrypted: true,
|
|
1534
|
+
description: 'Issued in AI Gateway \u2192 "API tokens" tab (cfut_\u2026 or sk_\u2026).',
|
|
1535
|
+
visible: "${data.provider === 'cloudflare'}"
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
type: "text",
|
|
1539
|
+
key: "cloudflare_model",
|
|
1540
|
+
label: "Model",
|
|
1541
|
+
required: false,
|
|
1542
|
+
default: "openai/gpt-4o-mini",
|
|
1543
|
+
description: "Format: provider/model. Allowed providers (per Cloudflare /compat): anthropic, openai, groq, mistral, cohere, perplexity, workers-ai, google-ai-studio, vertex, grok, deepseek, cerebras, baseten, parallel.",
|
|
1544
|
+
visible: "${data.provider === 'cloudflare'}"
|
|
1545
|
+
},
|
|
1546
|
+
{
|
|
1547
|
+
type: "group",
|
|
1548
|
+
id: "siliconflow",
|
|
1549
|
+
label: "\u7845\u57FA\u6D41\u52A8 SiliconFlow",
|
|
1550
|
+
required: false,
|
|
1551
|
+
visible: "${data.provider === 'siliconflow'}",
|
|
1552
|
+
description: "OpenAI-compatible endpoint at api.siliconflow.cn/v1. Base URL is auto-filled."
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
type: "password",
|
|
1556
|
+
key: "siliconflow_api_key",
|
|
1557
|
+
label: "SiliconFlow API key",
|
|
1558
|
+
required: true,
|
|
1559
|
+
encrypted: true,
|
|
1560
|
+
visible: "${data.provider === 'siliconflow'}"
|
|
1561
|
+
},
|
|
1562
|
+
{
|
|
1563
|
+
type: "text",
|
|
1564
|
+
key: "siliconflow_model",
|
|
1565
|
+
label: "Model",
|
|
1566
|
+
required: false,
|
|
1567
|
+
default: "Qwen/Qwen2.5-7B-Instruct",
|
|
1568
|
+
description: "Examples: Qwen/Qwen2.5-72B-Instruct, deepseek-ai/DeepSeek-V3, meta-llama/Meta-Llama-3.1-8B-Instruct.",
|
|
1569
|
+
visible: "${data.provider === 'siliconflow'}"
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
type: "group",
|
|
1573
|
+
id: "openrouter",
|
|
1574
|
+
label: "OpenRouter",
|
|
1575
|
+
required: false,
|
|
1576
|
+
visible: "${data.provider === 'openrouter'}",
|
|
1577
|
+
description: "Multi-provider router at openrouter.ai/api/v1. Base URL is auto-filled."
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
type: "password",
|
|
1581
|
+
key: "openrouter_api_key",
|
|
1582
|
+
label: "OpenRouter API key",
|
|
1583
|
+
required: true,
|
|
1584
|
+
encrypted: true,
|
|
1585
|
+
description: "sk-or-...",
|
|
1586
|
+
visible: "${data.provider === 'openrouter'}"
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
type: "text",
|
|
1590
|
+
key: "openrouter_model",
|
|
1591
|
+
label: "Model",
|
|
1592
|
+
required: false,
|
|
1593
|
+
default: "openai/gpt-4o-mini",
|
|
1594
|
+
description: "Format: provider/model (e.g. anthropic/claude-3.5-sonnet, deepseek/deepseek-chat).",
|
|
1595
|
+
visible: "${data.provider === 'openrouter'}"
|
|
1596
|
+
},
|
|
1434
1597
|
// ── Generation defaults ──────────────────────────────────────
|
|
1435
1598
|
{
|
|
1436
1599
|
type: "group",
|
|
@@ -1648,6 +1811,20 @@ var aiTestActionHandler = async ({ values, payload }) => {
|
|
|
1648
1811
|
message: `Vercel AI Gateway configured (model=${values.gateway_model}). Mount @objectstack/service-ai to exercise live calls.`
|
|
1649
1812
|
};
|
|
1650
1813
|
}
|
|
1814
|
+
if (provider === "cloudflare") {
|
|
1815
|
+
if (!values.cloudflare_account_id) {
|
|
1816
|
+
return { ok: false, severity: "error", message: "Cloudflare account id is required." };
|
|
1817
|
+
}
|
|
1818
|
+
if (!values.cloudflare_api_key) {
|
|
1819
|
+
return { ok: false, severity: "error", message: "Cloudflare AI Gateway token is required." };
|
|
1820
|
+
}
|
|
1821
|
+
const model2 = values.cloudflare_model ?? "(default openai/gpt-4o-mini)";
|
|
1822
|
+
return {
|
|
1823
|
+
ok: true,
|
|
1824
|
+
severity: "info",
|
|
1825
|
+
message: `Cloudflare AI Gateway configured (model=${model2}). Mount @objectstack/service-ai to exercise live calls.`
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1651
1828
|
const keyField = `${provider}_api_key`;
|
|
1652
1829
|
if (!values[keyField]) {
|
|
1653
1830
|
return { ok: false, severity: "error", message: `${provider} API key is required.` };
|