@goodandready/dsh-model-sync 0.4.8 → 0.4.9
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/lib/client.js +15 -11
- package/lib/synchronizer.js +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1271,18 +1271,22 @@ window.__ModuleLoader__.load({
|
|
|
1271
1271
|
|
|
1272
1272
|
function apply(ctx) {
|
|
1273
1273
|
ctx.effect(() => ctx.locale.register(NS, { en, zh }), 'dsh-model-sync: dictionaries')
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
ctx.slots.inject('plugins.row.config', () => ctx.slots.register({ name: 'plugins.row.config', key: ROW_CONFIG_KEY, locale: NS, inject: () => ({ ctx }) }, (props) => React.createElement(ErrorBoundary, null, React.createElement(ModelSyncCard, { ...props, ctx }))))
|
|
1282
|
-
ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({ name: 'settings.plugin.item', key: NS, locale: NS, inject: () => ({ ctx }) }, (props) => React.createElement(ErrorBoundary, null, React.createElement(ModelSyncCard, { ...props, ctx }))))
|
|
1283
|
-
} catch (err) {
|
|
1284
|
-
try { console.debug('[dsh-model-sync] slots inject best-effort:', err) } catch { /* console unavailable */ }
|
|
1274
|
+
const trySlot = (name, register) => {
|
|
1275
|
+
try {
|
|
1276
|
+
if (typeof ctx.slots?.inject === 'function') ctx.slots.inject(name, register)
|
|
1277
|
+
else if (typeof ctx.slots?.register === 'function') register()
|
|
1278
|
+
} catch (err) {
|
|
1279
|
+
try { console.warn('[dsh-model-sync] slot register failed for ' + name + ':', err?.message ?? err) } catch { /* console unavailable */ }
|
|
1280
|
+
}
|
|
1285
1281
|
}
|
|
1282
|
+
// Plugin-list seat (plugins.item) first: it is the seat the current core
|
|
1283
|
+
// (0.1.6-alpha.2) renders as the plugin's own page with its configuration. The
|
|
1284
|
+
// label is a static string on purpose — it is resolved while the page renders,
|
|
1285
|
+
// and a locale lookup there would take the whole client batch down with it.
|
|
1286
|
+
trySlot('plugins.item', () => ctx.slots.register({ name: 'plugins.item', id: ROW_ID, order: 60, label: () => 'Model synchronization', locale: NS, inject: () => ({ ctx }) }, (props) => React.createElement(ErrorBoundary, null, React.createElement(ModelSyncCard, { ...props, ctx }))))
|
|
1287
|
+
// Row seat and the legacy seat stay as fallbacks.
|
|
1288
|
+
trySlot('plugins.row.config', () => ctx.slots.register({ name: 'plugins.row.config', key: ROW_CONFIG_KEY, locale: NS, inject: () => ({ ctx }) }, (props) => React.createElement(ErrorBoundary, null, React.createElement(ModelSyncCard, { ...props, ctx }))))
|
|
1289
|
+
trySlot('settings.plugin.item', () => ctx.slots.register({ name: 'settings.plugin.item', key: NS, locale: NS, inject: () => ({ ctx }) }, (props) => React.createElement(ErrorBoundary, null, React.createElement(ModelSyncCard, { ...props, ctx }))))
|
|
1286
1290
|
}
|
|
1287
1291
|
|
|
1288
1292
|
module.exports = { apply, inject: ['slots', 'locale', 'configForms'], filterModelsByCapabilities }
|
package/lib/synchronizer.js
CHANGED
|
@@ -524,7 +524,7 @@ export function createModelSynchronizer(ctx, { getConfig = () => ({}), saveConfi
|
|
|
524
524
|
if (provider === 'commandcode') {
|
|
525
525
|
if (typeof settings?.mutate === 'function') {
|
|
526
526
|
await settings.mutate('llm-commandcode', [
|
|
527
|
-
{ op: 'set', path: ['visibleModels'], value: selectedModels }
|
|
527
|
+
{ op: 'set', path: ['visibleModels'], value: selectedModels.length ? selectedModels : nextModels.map((m) => m.id) }
|
|
528
528
|
])
|
|
529
529
|
}
|
|
530
530
|
if (section?.providers?.commandcode && typeof settings?.replace === 'function') {
|