From 11903bbd644a526d473be3965105f7e16a42cbdd Mon Sep 17 00:00:00 2001 From: zhangqianze Date: Wed, 25 Dec 2024 22:13:48 +0800 Subject: [PATCH] feat: support non-edit mode --- playground/.env | 3 ++- playground/src/common/constant.ts | 3 +-- playground/src/components/Chat/ChatCard.tsx | 4 ++-- playground/src/store/reducers/global.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/playground/.env b/playground/.env index 8739b9b0..ed603803 100644 --- a/playground/.env +++ b/playground/.env @@ -1,2 +1,3 @@ AGENT_SERVER_URL=http://localhost:8080 -TEN_DEV_SERVER_URL=http://localhost:49483 \ No newline at end of file +TEN_DEV_SERVER_URL=http://localhost:49483 +EDIT_GRAPH_MODE=true \ No newline at end of file diff --git a/playground/src/common/constant.ts b/playground/src/common/constant.ts index b27692fb..2257ccdb 100644 --- a/playground/src/common/constant.ts +++ b/playground/src/common/constant.ts @@ -130,5 +130,4 @@ export const isLLM = (extensionName: string) => { return extensionName === "llm" || extensionName === "v2v"; } -// export const isProduction = process.env.NODE_ENV === "production"; -export const isProduction = true; \ No newline at end of file +export const isEditModeOn = process.env.EDIT_GRAPH_MODE === "true"; \ No newline at end of file diff --git a/playground/src/components/Chat/ChatCard.tsx b/playground/src/components/Chat/ChatCard.tsx index 9940a18d..f63e2344 100644 --- a/playground/src/components/Chat/ChatCard.tsx +++ b/playground/src/components/Chat/ChatCard.tsx @@ -14,7 +14,7 @@ import { useAppSelector, GRAPH_OPTIONS, isRagGraph, - isProduction, + isEditModeOn, } from "@/common"; import { setRtmConnected, @@ -113,7 +113,7 @@ export default function ChatCard(props: { className?: string }) {
{ - !isProduction ? ( + isEditModeOn ? ( <> diff --git a/playground/src/store/reducers/global.ts b/playground/src/store/reducers/global.ts index 77bb8aa1..a94dca13 100644 --- a/playground/src/store/reducers/global.ts +++ b/playground/src/store/reducers/global.ts @@ -9,7 +9,7 @@ import { EMobileActiveTab, DEFAULT_OPTIONS, COLOR_LIST, - isProduction + isEditModeOn } from "@/common/constant"; import { apiReloadPackage, @@ -177,7 +177,7 @@ let initializeGraphData; // Fetch graph details let fetchGraphDetails; -if (!isProduction) { +if (isEditModeOn) { // only for development, below requests depend on dev-server initializeGraphData = createAsyncThunk( "global/initializeGraphData",