Skip to content

Commit 0bee37e

Browse files
committed
Add recommend property to command items and update ChatStore workflow commands
1 parent 5349f1f commit 0bee37e

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

src/util/ideaBridge.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ class IdeaBridge {
446446
name: item.name,
447447
pattern: item.name,
448448
description: item.description,
449+
recommend: item.recommend,
449450
}));
450451
this.executeHandlers("regCommandList", {
451452
result,

src/views/stores/ChatStore.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,21 @@ export const ChatStore = types
108108
const helpWorkflowCommands = () => {
109109
const rootStore = getParent<RootInstance>(self);
110110

111+
const recommendCommands = rootStore.input.commandMenus.filter(
112+
(item) => item.recommend > -1
113+
);
114+
115+
if (recommendCommands.length > 0) {
116+
return recommendCommands
117+
.map((item) => {
118+
if (item.name === "help") {
119+
return "";
120+
}
121+
return `<a class="workflow_command" href="${item.pattern}">/${item.name}: <span style="color:var(--vscode-editor-foreground)"> ${item.description} </span></a>`;
122+
})
123+
.join("\n\n");
124+
}
125+
111126
return rootStore.input.commandMenus
112127
.map((item) => {
113128
if (item.name === "help") {

src/views/stores/InputStore.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface Item {
66
name: string;
77
pattern: string;
88
description: string;
9+
recommend: number;
910
}
1011

1112
const regContextMenus = async () => {
@@ -67,6 +68,14 @@ export const MenuItem = types.model({
6768
name: types.string,
6869
pattern: types.maybe(types.string),
6970
description: types.string,
71+
recommend: types.number,
72+
});
73+
74+
export const ContextMenuItem = types.model({
75+
icon: types.maybe(types.string),
76+
name: types.string,
77+
pattern: types.maybe(types.string),
78+
description: types.string,
7079
});
7180

7281
export const InputStore = types
@@ -77,7 +86,7 @@ export const InputStore = types
7786
menuOpend: false,
7887
currentMenuIndex: 0,
7988
commandMenus: types.array(MenuItem),
80-
contextMenus: types.array(MenuItem),
89+
contextMenus: types.array(ContextMenuItem),
8190
modelMenus: types.array(types.string),
8291
})
8392
.actions((self) => ({
@@ -128,6 +137,7 @@ export const InputStore = types
128137
name: "help",
129138
description: "View the DevChat documentation.",
130139
pattern: "help",
140+
recommend: -1,
131141
});
132142
},
133143
}));

0 commit comments

Comments
 (0)