Skip to content

Commit

Permalink
fix: finalize ui (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
plutoless authored Aug 14, 2024
1 parent 0cab63f commit 7b39348
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 25 deletions.
19 changes: 10 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions playground/src/common/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions playground/src/platform/mobile/chat/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down
27 changes: 14 additions & 13 deletions playground/src/platform/mobile/chat/index.tsx
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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<IChatItem[]>([])
Expand All @@ -36,21 +37,21 @@ const Chat = () => {
dispatch(setLanguage(val))
}

const onGraphNameChange = (val: any) => {
dispatch(setGraphName(val))
}


return <section className={styles.chat}>
<div className={styles.header}>
<div>
<Select className={styles.languageSelect}
options={LANGUAGE_OPTIONS}
disabled={agentConnected}
value={language} onChange={onLanguageChange}></Select>
</div>
<div style={{
marginTop: "12px"
}}>
<PdfSelect></PdfSelect>
</div>
<Select className={styles.graphName}
disabled={agentConnected} options={GRAPH_OPTIONS}
value={graphName} onChange={onGraphNameChange}></Select>
<Select className={styles.languageSelect}
options={LANGUAGE_OPTIONS}
disabled={agentConnected}
value={language} onChange={onLanguageChange}></Select>
{isRagGraph(graphName) ? <PdfSelect></PdfSelect> : null}
</div>
<div className={`${styles.content}`} >
{chatItems.map((item, index) => {
Expand Down
3 changes: 2 additions & 1 deletion playground/src/platform/pc/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -50,7 +51,7 @@ const Chat = () => {
<Select className={styles.languageSelect}
disabled={agentConnected} options={LANGUAGE_OPTIONS}
value={language} onChange={onLanguageChange}></Select>
<PdfSelect></PdfSelect>
{isRagGraph(graphName) ? <PdfSelect></PdfSelect> : null}
</span>
</div>
<div className={`${styles.content}`} ref={chatRef}>
Expand Down

0 comments on commit 7b39348

Please sign in to comment.