@vheins/opencode-9router 0.4.1 → 0.4.2
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/plugin.js +4 -10
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PLUGIN_NAME, PROVIDER_DISPLAY_NAME, DEFAULT_BASE_URL, DEFAULT_API_PATH,
|
|
1
|
+
import { PLUGIN_NAME, PROVIDER_DISPLAY_NAME, DEFAULT_BASE_URL, DEFAULT_API_PATH, KNOWN_PROVIDER_PREFIXES, } from "./constants.js";
|
|
2
2
|
function formatModelName(modelId) {
|
|
3
3
|
for (const [prefix, provider] of Object.entries(KNOWN_PROVIDER_PREFIXES)) {
|
|
4
4
|
if (modelId.startsWith(prefix)) {
|
|
@@ -48,13 +48,12 @@ async function discoverModels(baseURL) {
|
|
|
48
48
|
export const NineRouterPlugin = async ({ client }, options) => {
|
|
49
49
|
const configuredBaseURL = resolveBaseURL(options);
|
|
50
50
|
const discovered = await discoverModels(configuredBaseURL);
|
|
51
|
-
const models = discovered ?? FALLBACK_MODELS;
|
|
52
51
|
if (!discovered && client?.app?.log) {
|
|
53
52
|
await client.app.log({
|
|
54
53
|
body: {
|
|
55
54
|
service: "9router-provider",
|
|
56
|
-
level: "
|
|
57
|
-
message: `9Router not reachable at ${configuredBaseURL}.
|
|
55
|
+
level: "error",
|
|
56
|
+
message: `9Router not reachable at ${configuredBaseURL}. Please check if 9Router is running and accessible.`,
|
|
58
57
|
},
|
|
59
58
|
});
|
|
60
59
|
}
|
|
@@ -67,7 +66,7 @@ export const NineRouterPlugin = async ({ client }, options) => {
|
|
|
67
66
|
options: {
|
|
68
67
|
baseURL: ensureAPIPath(configuredBaseURL),
|
|
69
68
|
},
|
|
70
|
-
models,
|
|
69
|
+
models: discovered ?? {},
|
|
71
70
|
};
|
|
72
71
|
},
|
|
73
72
|
auth: {
|
|
@@ -90,11 +89,6 @@ export const NineRouterPlugin = async ({ client }, options) => {
|
|
|
90
89
|
message: `${PROVIDER_DISPLAY_NAME} Base URL (default: ${DEFAULT_BASE_URL})`,
|
|
91
90
|
key: "baseURL",
|
|
92
91
|
},
|
|
93
|
-
{
|
|
94
|
-
type: "text",
|
|
95
|
-
message: `${PROVIDER_DISPLAY_NAME} API Key (from Dashboard → Endpoints)`,
|
|
96
|
-
key: "apiKey",
|
|
97
|
-
},
|
|
98
92
|
],
|
|
99
93
|
},
|
|
100
94
|
],
|