Add conditional logic to handle different environments in Topic component

This commit is contained in:
小石头 2024-02-20 17:11:29 +08:00
parent 4520dc307e
commit 96f6f79d3c

View File

@ -23,6 +23,7 @@ export default function Topic({ styleName, disabled }) {
useDisclosure(false);
const [loading, setLoading] = useState(false);
const [topicList, setTopicList] = useState<any>([]);
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,
// });
if (isVscode) {
messageUtil.sendMessage({
command: "historyMessages",
topicId: root_prompt.hash,
});
} else {
messageUtil.sendMessage({
command: "getTopicDetail",
topicHash: root_prompt.hash,
});
}
};
const refreshTopicList = () => {