Skip to content

Commit

Permalink
fasten the UI page starting, condensing information on UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
DoraDong-2023 committed Dec 21, 2023
1 parent 8015f48 commit 6557922
Show file tree
Hide file tree
Showing 52 changed files with 84 additions and 84 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ We also offer some demo chat, you can find them in [`./examples`](https://github
This is compatible with Node.js version 19.
```bash
# Under folder BioMANIA/chatbot_ui_biomania
npm install
npm install && npm run build
```

### Inference with pretrained models
Expand Down
Binary file modified chatbot_ui_biomania/components/Chat/.DS_Store
Binary file not shown.
10 changes: 5 additions & 5 deletions chatbot_ui_biomania/components/Chat/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ export const ChatMessage: FC<Props> = memo(({ message, messageIndex, onEdit}) =>
}`}
style={{ overflowWrap: 'anywhere' }}
>
<div className="relative m-auto flex p-4 text-base md:max-w-2xl md:gap-6 md:py-6 lg:max-w-2xl lg:px-0 xl:max-w-3xl">
<div className="min-w-[40px] text-right font-bold">
<div className="relative m-auto flex p-4 text-xs md:max-w-2xl md:gap-6 md:py-2 lg:max-w-2xl lg:px-0 xl:max-w-3xl">
<div className="min-w-[40px] text-right">
{message.role === 'assistant' ? (
<IconRobot size={30} />
<IconRobot size={22} />
) : (
<IconUser size={30} />
<IconUser size={22} />
)}
</div>
<div className="flex flex-col w-full">
Expand Down Expand Up @@ -169,7 +169,7 @@ export const ChatMessage: FC<Props> = memo(({ message, messageIndex, onEdit}) =>
</div>
</div>
) : (
<div className="prose whitespace-pre-wrap dark:prose-invert flex-1">
<div className="prose whitespace-pre-wrap dark:prose-invert flex-1" style={{ fontSize: '15px' }}>
{message.content}
</div>
)}
Expand Down
48 changes: 23 additions & 25 deletions chatbot_ui_biomania/components/Chat/LibCardSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import { useEffect, useContext, useState } from 'react';
import HomeContext from '@/pages/api/home/home.context';

export const libImages: { [key: string]: string } = {
'scanpy': '/apps/scanpy.jpg',
'squidpy': '/apps/squidpy.jpg',
'pyteomics': '/apps/pyteomics.jpg',
'qiime2': '/apps/qiime2.png',
'scikit-bio': '/apps/scikitbio.jpg',
'scanpy': '/apps/scanpy.webp',
'squidpy': '/apps/squidpy.webp',
'pyteomics': '/apps/pyteomics.webp',
'qiime2': '/apps/qiime2.webp',
'scikit-bio': '/apps/scikitbio.webp',
'biopython': '/apps/biopython.png',
'biotite': '/apps/biotite.png',
'deap': '/apps/deap.png',
'eletoolkit': '/apps/eletoolkit.jpg',
'pyopenms': '/apps/pyopenms.jpg',
'scenicplus': '/apps/SCENIC.png',
'scvi-tools': '/apps/scvitools.svg',
'sonata': '/apps/SONATA.jpg',
'MIOSTONE': '/apps/MIOSTONE.jpg',
'ehrapy': '/apps/ehrapy.jpg',
//'custom': '/apps/customize.jpg',
'eletoolkit': '/apps/eletoolkit.webp',
'pyopenms': '/apps/pyopenms.webp',
'scenicplus': '/apps/SCENIC.webp',
'scvi-tools': '/apps/scvitools.webp',
'sonata': '/apps/SONATA.webp',
'MIOSTONE': '/apps/MIOSTONE.webp',
'ehrapy': '/apps/ehrapy.webp',
//'custom': '/apps/customize.webp',
};

export const LibCardSelect = () => {
Expand Down Expand Up @@ -188,23 +188,26 @@ export const LibCardSelect = () => {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
max-width: 2000px;
width: 600px;
justify-content: flex-start;
max-width: 800px;
gap: 10px;
}
.card {
cursor: pointer;
width: 160px;
height: 150px;
padding: 10px;
width: calc(25% - 15px);
height: 130px;
margin-bottom: 10px;
border: 1px solid gray;
margin: 10px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
}
.card img {
max-width: 100%;
max-height: 80%;
margin-bottom: 5px;
}
.card-selected {
background-color: lightblue;
color: #333333;
Expand All @@ -217,11 +220,6 @@ export const LibCardSelect = () => {
padding: 5px;
background-color: rgba(255, 255, 255, 0.8);
}
.card img {
max-width: 100%;
max-height: calc(100% - 5px);
margin-bottom: -20px;
}
.custom-input-container div {
display: flex;
align-items: center;
Expand Down
53 changes: 27 additions & 26 deletions chatbot_ui_biomania/components/Chat/ProgressCards/CodeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ interface CodeCardProps {
function CodeCard({ codeString, language, fullContent }: CodeCardProps) {
const [isCollapsed, setIsCollapsed] = useState(true); // new state for collapse control

const collapseStyle = {
maxHeight: isCollapsed ? '0' : '1000px',
overflow: 'hidden',
transition: 'max-height 0.3s ease-in-out',
};
// const collapseStyle = {
// maxHeight: isCollapsed ? '0' : '1000px',
// overflow: 'hidden',
// transition: 'max-height 0.3s ease-in-out',
// };

const codeStyle = {
whiteSpace: 'pre-wrap',
Expand Down Expand Up @@ -53,29 +53,30 @@ function CodeCard({ codeString, language, fullContent }: CodeCardProps) {

{fullContent && (
<>
<Paper elevation={3} style={{ backgroundColor: 'white', padding: '1px', borderRadius: '1px', marginTop: '10px' , height: '30px'}}>
{/* <Paper elevation={3} style={{ backgroundColor: 'white', padding: '0px', borderRadius: '0px', marginTop: '-2px' , height: '30px'}}> */}
<Typography paragraph>
<Button
variant="text"
sx={{
color: 'black',
textTransform: 'none',
fontSize: '0.8rem',
fontWeight: 'normal',
ml: 0,
'&:hover': {
backgroundColor: 'transparent',
textDecoration: 'underline',
}
}}
onClick={() => setIsCollapsed(!isCollapsed)}
>
{isCollapsed ? "Show Full Content" : "Hide Full Content"} {isCollapsed ? "↓" : "↑"}
</Button>
<Button
variant="text"
sx={{
color: 'black',
textTransform: 'none',
fontSize: '0.8rem',
fontWeight: 'normal',
ml: 0,
'&:hover': {
backgroundColor: 'transparent',
textDecoration: 'underline',
}
}}
onClick={() => setIsCollapsed(!isCollapsed)}
>
{isCollapsed ? "Show Full Content" : "Hide Full Content"} {isCollapsed ? "↓" : "↑"}
</Button>
</Typography>
</Paper>
{/* </Paper> */}

<Collapse in={!isCollapsed} timeout="auto" unmountOnExit style={collapseStyle}>
{/* <Collapse in={!isCollapsed} timeout="auto" unmountOnExit style={collapseStyle}> */}
{/* <Collapse in={!isCollapsed} timeout="auto" unmountOnExit> */}
<MemoizedReactMarkdown
remarkPlugins={[remarkGfm]}
components={{
Expand All @@ -98,7 +99,7 @@ function CodeCard({ codeString, language, fullContent }: CodeCardProps) {
>
{`\`\`\`${language}\n${fullContent}\n\`\`\``}
</MemoizedReactMarkdown>
</Collapse>
{/* </Collapse> */}
</>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ const LoggingCard = ({ title, logString, tableData, logColor = 'black', imageDat
};

return (
<Paper elevation={2} sx={{ width: '200', position: 'relative', padding: '16px', margin: '16px 0', backgroundColor: 'white', overflow: 'hidden' }}>
<Paper elevation={2} sx={{ width: '200', height: 'fit-content',position: 'relative', padding: '8px', margin: '8px 0', backgroundColor: 'white', overflow: 'hidden' }}>
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
<Typography variant="caption" component="div" sx={{ fontFamily: 'monospace', fontSize: theme.typography.body1.fontSize }}>
<span style={{ color: titleColor }}>{title}</span>
</Typography>
<Typography variant="caption" component="div" sx={{ fontFamily: 'monospace', fontSize: '0.9rem', lineHeight: '1.2', marginBottom: '0px' }}>
<span style={{ color: titleColor }}>{title}</span>
</Typography>
<Divider sx={{ my: 1 }} />
{imageData && (
<ImageProgressCard
Expand All @@ -61,9 +61,11 @@ const LoggingCard = ({ title, logString, tableData, logColor = 'black', imageDat
{tableData && tableData.trim() !== '' && <TableCard data={tableData} />}
<Box sx={{ width: '200' }}>
<Collapse in={!isCollapsed} timeout="auto" unmountOnExit sx={{ width: '200' }}>
<Typography variant="body1" sx={{ fontFamily: 'monospace', color: logColor }}>
<div style={{ margin: '-10px 0' }}>
<Typography variant="body1" sx={{ fontFamily: 'monospace', color: logColor, fontSize: '0.9rem', lineHeight: '1.2' }}>
<ReactMarkdown>{formattedLogString}</ReactMarkdown>
</Typography>
</div>
</Collapse>
</Box>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,13 @@ const generateCards = (progressJson: any) => {
}
return (
<Box sx={{
my: 0,
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-start',
width: "100%",
'&:hover': {
backgroundColor: 'rgba(0, 0, 0, 0.2)',
backgroundColor: 'rgba(0, 0, 0, 0.1)',
'& > *': {
backgroundColor: 'transparent',
},
Expand Down Expand Up @@ -375,11 +376,10 @@ const ProgressCardController = (props: ProgressCardControllerProps) => {
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-start',
minWidth: "600px",
width: "600px"
minWidth: "100%",
width: "100%"
}}>
{toolRecommendations}
<Box sx={{ height: '16px' }}></Box>
<Box sx={{ height: '6px' }}></Box>
{cards}
</Box>
<SnackbarError open={snackbarOpen} handleClose={handleSnackbarClose} content={snackbarContent} />
Expand Down
2 changes: 1 addition & 1 deletion chatbot_ui_biomania/components/Markdown/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const CodeBlock: FC<Props> = memo(({ language, value }) => {
URL.revokeObjectURL(url);
};
return (
<div className="codeblock relative font-sans text-[16px]">
<div className="codeblock relative font-sans text-[16px]" style={{ margin: 0, padding: 0 }}>
<div className="flex items-center justify-between py-1.5 px-4">
<span className="text-xs lowercase text-white">{language}</span>
<div className="flex items-center">
Expand Down
Binary file removed chatbot_ui_biomania/public/apps/MIOSTONE.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/MIOSTONE.webp
Binary file not shown.
Binary file removed chatbot_ui_biomania/public/apps/SCENIC.png
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/SCENIC.webp
Binary file not shown.
Binary file removed chatbot_ui_biomania/public/apps/SONATA.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/SONATA.webp
Binary file not shown.
Binary file modified chatbot_ui_biomania/public/apps/biopython.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified chatbot_ui_biomania/public/apps/biotite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed chatbot_ui_biomania/public/apps/customize.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/customize.webp
Binary file not shown.
Binary file modified chatbot_ui_biomania/public/apps/deap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed chatbot_ui_biomania/public/apps/ehrapy.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/ehrapy.webp
Binary file not shown.
Binary file removed chatbot_ui_biomania/public/apps/eletoolkit.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/eletoolkit.webp
Binary file not shown.
Binary file removed chatbot_ui_biomania/public/apps/pyopenms.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/pyopenms.webp
Binary file not shown.
Binary file removed chatbot_ui_biomania/public/apps/pyteomics.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/pyteomics.webp
Binary file not shown.
Binary file removed chatbot_ui_biomania/public/apps/qiime2.png
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/qiime2.webp
Binary file not shown.
Binary file removed chatbot_ui_biomania/public/apps/scanpy.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/scanpy.webp
Binary file not shown.
Binary file removed chatbot_ui_biomania/public/apps/scikitBio.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/scikitbio.webp
Binary file not shown.
1 change: 0 additions & 1 deletion chatbot_ui_biomania/public/apps/scvitools.svg

This file was deleted.

Binary file added chatbot_ui_biomania/public/apps/scvitools.webp
Binary file not shown.
Binary file removed chatbot_ui_biomania/public/apps/squidpy.jpg
Binary file not shown.
Binary file added chatbot_ui_biomania/public/apps/squidpy.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion docker_utils/MIOSTONE/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/biopython/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/biotite/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/deap/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/eletoolkit/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/pyopenms/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/pyteomics/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/qiime2/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/scanpy/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/scenicplus/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/scikit-bio/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/scvi-tools/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/sonata/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion docker_utils/squidpy/docker_start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python3 deploy/inference_dialog_server.py &
backend_pid=$!

cd /app/chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down
2 changes: 1 addition & 1 deletion start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ python deploy/inference_dialog_server.py &
backend_pid=$!

cd ../chatbot_ui_biomania/
npm run dev &
npm start &
frontend_pid=$!

# Keep the script running to keep the processes alive
Expand Down

0 comments on commit 6557922

Please sign in to comment.