Skip to content

Commit 96f6f79

Browse files
committed
Add conditional logic to handle different environments in Topic component
1 parent 4520dc3 commit 96f6f79

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/views/components/InputMessage/Topic.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default function Topic({ styleName, disabled }) {
2323
useDisclosure(false);
2424
const [loading, setLoading] = useState(false);
2525
const [topicList, setTopicList] = useState<any>([]);
26+
const isVscode = process.env.platform === "vscode";
2627

2728
useEffect(() => {
2829
messageUtil.registerHandler("listTopics", ({ list }: { list: any }) => {
@@ -46,14 +47,17 @@ export default function Topic({ styleName, disabled }) {
4647

4748
const showTopic = (root_prompt: any) => {
4849
closeDrawer();
49-
// messageUtil.sendMessage({
50-
// command: "getTopicDetail",
51-
// topicHash: root_prompt.hash,
52-
// });
53-
messageUtil.sendMessage({
54-
command: "historyMessages",
55-
topicId: root_prompt.hash,
56-
});
50+
if (isVscode) {
51+
messageUtil.sendMessage({
52+
command: "historyMessages",
53+
topicId: root_prompt.hash,
54+
});
55+
} else {
56+
messageUtil.sendMessage({
57+
command: "getTopicDetail",
58+
topicHash: root_prompt.hash,
59+
});
60+
}
5761
};
5862

5963
const refreshTopicList = () => {

0 commit comments

Comments
 (0)