From d55b8f0e38cd04ca3897038cd8392b81ea604840 Mon Sep 17 00:00:00 2001 From: zhangqianze Date: Wed, 14 Aug 2024 23:45:38 +0800 Subject: [PATCH 1/2] fix: finalize ui --- docker-compose.yml | 19 ++++++------- playground/src/common/constant.ts | 5 ++++ .../platform/mobile/chat/index.module.scss | 6 +++-- playground/src/platform/mobile/chat/index.tsx | 27 ++++++++++--------- playground/src/platform/pc/chat/index.tsx | 3 ++- 5 files changed, 35 insertions(+), 25 deletions(-) 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}
From 56a3d9be9ecb1db412ef7f251315cf190e8cdd86 Mon Sep 17 00:00:00 2001 From: zhangqianze Date: Thu, 15 Aug 2024 00:03:56 +0800 Subject: [PATCH 2/2] feat: set default voice type to male; update playground image --- docker-compose.yml | 2 +- playground/src/store/reducers/global.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index bbc45845..a61df21b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: env_file: - .env astra_playground: - image: ghcr.io/rte-design/astra_playground:v0.2.0-35-g0ecbc41 + image: ghcr.io/rte-design/astra_playground:v0.3.0-rc1-1-g7b39348 container_name: astra_playground restart: always ports: diff --git a/playground/src/store/reducers/global.ts b/playground/src/store/reducers/global.ts index dff67e62..5c08e514 100644 --- a/playground/src/store/reducers/global.ts +++ b/playground/src/store/reducers/global.ts @@ -20,7 +20,7 @@ const getInitialState = (): InitialState => { roomConnected: false, agentConnected: false, language: "en-US", - voiceType: "female", + voiceType: "male", chatItems: [], graphName: "va.openai.azure" }