diff --git a/docker-compose.yml b/docker-compose.yml index e9beaba9..bbc45845 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,15 +23,16 @@ services: ports: - "3000:3000" - astra_playground_dev: - image: node:20-alpine - container_name: astra_playground_dev - restart: always - command: sh -c "cd /app/playground && npm i && npm run dev" #build && npm run start" - ports: - - "3002:3000" - volumes: - - ./:/app + # use this when you want to run the playground in local development mode + # astra_playground_dev: + # image: node:20-alpine + # container_name: astra_playground_dev + # restart: always + # command: sh -c "cd /app/playground && npm i && npm run dev" #build && npm run start" + # ports: + # - "3002:3000" + # volumes: + # - ./:/app astra_graph_designer: image: agoraio/astra_graph_designer:0.3.0 container_name: astra_graph_designer diff --git a/playground/src/common/constant.ts b/playground/src/common/constant.ts index a04435ca..8b5efd90 100644 --- a/playground/src/common/constant.ts +++ b/playground/src/common/constant.ts @@ -33,6 +33,11 @@ export const GRAPH_OPTIONS: GraphOptionItem[] = [ value: "va.qwen.rag" }, ] + +export const isRagGraph = (graphName: string) => { + return graphName === "va.qwen.rag" +} + export const VOICE_OPTIONS: VoiceOptionItem[] = [ { label: "Male", diff --git a/playground/src/platform/mobile/chat/index.module.scss b/playground/src/platform/mobile/chat/index.module.scss index 8fa6d901..f682ce3f 100644 --- a/playground/src/platform/mobile/chat/index.module.scss +++ b/playground/src/platform/mobile/chat/index.module.scss @@ -8,8 +8,10 @@ overflow: hidden; .header { - align-items: center; - align-self: stretch; + display: flex; + flex-direction: column; + align-items: stretch; + row-gap: 10px; border-bottom: 1px solid #272A2F; diff --git a/playground/src/platform/mobile/chat/index.tsx b/playground/src/platform/mobile/chat/index.tsx index e18c0558..bb071d4e 100644 --- a/playground/src/platform/mobile/chat/index.tsx +++ b/playground/src/platform/mobile/chat/index.tsx @@ -1,8 +1,8 @@ import { ReactElement, useEffect, useContext, useState } from "react" import ChatItem from "./chatItem" import { IChatItem } from "@/types" -import { useAppDispatch, useAutoScroll, LANGUAGE_OPTIONS, useAppSelector } from "@/common" -import { setLanguage } from "@/store/reducers/global" +import { useAppDispatch, useAutoScroll, LANGUAGE_OPTIONS, useAppSelector, GRAPH_OPTIONS, isRagGraph } from "@/common" +import { setGraphName, setLanguage } from "@/store/reducers/global" import { Select, } from 'antd'; import { MenuContext } from "../menu/context" import PdfSelect from "@/components/pdfSelect" @@ -14,6 +14,7 @@ const Chat = () => { const chatItems = useAppSelector(state => state.global.chatItems) const language = useAppSelector(state => state.global.language) const agentConnected = useAppSelector(state => state.global.agentConnected) + const graphName = useAppSelector(state => state.global.graphName) const dispatch = useAppDispatch() // genRandomChatList // const [chatItems, setChatItems] = useState([]) @@ -36,21 +37,21 @@ const Chat = () => { dispatch(setLanguage(val)) } + const onGraphNameChange = (val: any) => { + dispatch(setGraphName(val)) + } return
-
- -
-
- -
+ + + {isRagGraph(graphName) ? : null}
{chatItems.map((item, index) => { diff --git a/playground/src/platform/pc/chat/index.tsx b/playground/src/platform/pc/chat/index.tsx index 9a8238e8..64dea171 100644 --- a/playground/src/platform/pc/chat/index.tsx +++ b/playground/src/platform/pc/chat/index.tsx @@ -6,6 +6,7 @@ import { genRandomChatList, useAppDispatch, useAutoScroll, LANGUAGE_OPTIONS, useAppSelector, GRAPH_OPTIONS, + isRagGraph, } from "@/common" import { setGraphName, setLanguage } from "@/store/reducers/global" import { Select, } from 'antd'; @@ -50,7 +51,7 @@ const Chat = () => { - + {isRagGraph(graphName) ? : null}