From 96f6f79d3c41d2920adcd5bafab06aa95c93de99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=9F=B3=E5=A4=B4?= Date: Tue, 20 Feb 2024 17:11:29 +0800 Subject: [PATCH] Add conditional logic to handle different environments in Topic component --- src/views/components/InputMessage/Topic.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/views/components/InputMessage/Topic.tsx b/src/views/components/InputMessage/Topic.tsx index 363bad3..abed43e 100644 --- a/src/views/components/InputMessage/Topic.tsx +++ b/src/views/components/InputMessage/Topic.tsx @@ -23,6 +23,7 @@ export default function Topic({ styleName, disabled }) { useDisclosure(false); const [loading, setLoading] = useState(false); const [topicList, setTopicList] = useState([]); + const isVscode = process.env.platform === "vscode"; useEffect(() => { messageUtil.registerHandler("listTopics", ({ list }: { list: any }) => { @@ -46,14 +47,17 @@ export default function Topic({ styleName, disabled }) { const showTopic = (root_prompt: any) => { closeDrawer(); - // messageUtil.sendMessage({ - // command: "getTopicDetail", - // topicHash: root_prompt.hash, - // }); - messageUtil.sendMessage({ - command: "historyMessages", - topicId: root_prompt.hash, - }); + if (isVscode) { + messageUtil.sendMessage({ + command: "historyMessages", + topicId: root_prompt.hash, + }); + } else { + messageUtil.sendMessage({ + command: "getTopicDetail", + topicHash: root_prompt.hash, + }); + } }; const refreshTopicList = () => {