Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/UI finalize #211

Merged
merged 2 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ 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:
- "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
2 changes: 1 addition & 1 deletion playground/src/store/reducers/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getInitialState = (): InitialState => {
roomConnected: false,
agentConnected: false,
language: "en-US",
voiceType: "female",
voiceType: "male",
chatItems: [],
graphName: "va.openai.azure"
}
Expand Down