mihailik commited on
Commit
1ec2d48
·
1 Parent(s): eeb4c01

Slash menu now lists the models.

Browse files
Files changed (3) hide show
  1. package-lock.json +2 -2
  2. package.json +1 -1
  3. src/app/init-milkdown.js +13 -14
package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
  {
2
  "name": "localm",
3
- "version": "1.1.12",
4
  "lockfileVersion": 3,
5
  "requires": true,
6
  "packages": {
7
  "": {
8
  "name": "localm",
9
- "version": "1.1.12",
10
  "license": "ISC",
11
  "dependencies": {
12
  "@huggingface/transformers": "^3.7.2",
 
1
  {
2
  "name": "localm",
3
+ "version": "1.1.15",
4
  "lockfileVersion": 3,
5
  "requires": true,
6
  "packages": {
7
  "": {
8
  "name": "localm",
9
+ "version": "1.1.15",
10
  "license": "ISC",
11
  "dependencies": {
12
  "@huggingface/transformers": "^3.7.2",
package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "localm",
3
- "version": "1.1.15",
4
  "description": "Chat application",
5
  "scripts": {
6
  "build": "esbuild src/index.js --target=es6 --bundle --sourcemap --outfile=./index.js --format=iife --external:fs --external:path --external:child_process --external:ws --external:katex/dist/katex.min.css",
 
1
  {
2
  "name": "localm",
3
+ "version": "1.1.16",
4
  "description": "Chat application",
5
  "scripts": {
6
  "build": "esbuild src/index.js --target=es6 --bundle --sourcemap --outfile=./index.js --format=iife --external:fs --external:path --external:child_process --external:ws --external:katex/dist/katex.min.css",
src/app/init-milkdown.js CHANGED
@@ -97,21 +97,20 @@ export async function initMilkdown({
97
  image: null,
98
  table: null,
99
  math: null,
100
- // Add model commands to advanced group
101
- ...Object.fromEntries(
102
- availableModels.map(model => [
103
- model.slashCommand,
104
- {
105
- label: `${model.name} (${model.size})`,
106
- icon: '🤖',
107
- command: () => {
108
- if (onSlashCommand) {
109
- onSlashCommand(model.id);
110
- }
111
- }
112
  }
113
- ])
114
- )
115
  }
116
  }
117
  }
 
97
  image: null,
98
  table: null,
99
  math: null,
100
+ },
101
+ // Use buildMenu API to inject dynamic items supported by Crepe
102
+ buildMenu: (groupBuilder) => {
103
+ // Put models under a dedicated group to avoid clashing with built-ins
104
+ const modelsGroup = groupBuilder.addGroup('models', 'Models');
105
+ availableModels.forEach((model) => {
106
+ modelsGroup.addItem(model.slashCommand, {
107
+ label: `${model.name} (${model.size})`,
108
+ icon: '🤖',
109
+ onRun: () => {
110
+ if (onSlashCommand) onSlashCommand(model.id);
 
111
  }
112
+ });
113
+ });
114
  }
115
  }
116
  }