@goodandready/dsh-model-sync 0.4.7 → 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 -16
- package/lib/synchronizer.js +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1270,24 +1270,23 @@ window.__ModuleLoader__.load({
|
|
|
1270
1270
|
}
|
|
1271
1271
|
|
|
1272
1272
|
function apply(ctx) {
|
|
1273
|
-
ctx.effect(() => {
|
|
1274
|
-
|
|
1275
|
-
|
|
1273
|
+
ctx.effect(() => ctx.locale.register(NS, { en, zh }), 'dsh-model-sync: dictionaries')
|
|
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 */ }
|
|
1276
1280
|
}
|
|
1277
|
-
return () => {}
|
|
1278
|
-
}, 'dsh-model-sync: dictionaries')
|
|
1279
|
-
try {
|
|
1280
|
-
// Plugin-list seat (plugins.item) first: it is the seat the current core
|
|
1281
|
-
// (0.1.6-alpha.2) renders as the plugin's own page with its configuration. The
|
|
1282
|
-
// label is a static string on purpose — it is resolved while the page renders,
|
|
1283
|
-
// and a locale lookup there would take the whole client batch down with it.
|
|
1284
|
-
ctx.slots.inject('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 }))))
|
|
1285
|
-
// Row seat and the legacy seat stay as fallbacks.
|
|
1286
|
-
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 }))))
|
|
1287
|
-
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 }))))
|
|
1288
|
-
} catch (err) {
|
|
1289
|
-
try { console.debug('[dsh-model-sync] slots inject best-effort:', err) } catch { /* console unavailable */ }
|
|
1290
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 }))))
|
|
1291
1290
|
}
|
|
1292
1291
|
|
|
1293
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') {
|