Skip to content

Commit

Permalink
Enhance robustness, optimize speed
Browse files Browse the repository at this point in the history
Replace error information by traceback information
Enhance robustness by
- adding restart option in parameters fill-in
- fix bugs in GPT answer generation
- initialize dialogs in each sub functions, ensure cards representation
- set logo as lib logo, present clearer dialog to user
- set result_{counter} as a flexible way, as GPT also generate result_{num} as variables
Optimize speed by:
- use cache for unchanged file loading
- use asyncIO for file loading
- remove repeated data
- reduce unnecessary logging
  • Loading branch information
DoraDong-2023 committed May 22, 2024
1 parent aeea5f0 commit feb4eae
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 205 deletions.
11 changes: 10 additions & 1 deletion chatbot_ui_biomania/components/Chat/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import rehypeMathjax from 'rehype-mathjax';
import remarkGfm from 'remark-gfm';
import remarkMath from 'remark-math';
import ProgressCardController from "@/components/Chat/ProgressCards/ProgressCardController";
import { libImages } from '@/components/Chat/LibCardSelect';

export interface Props {
message: Message;
messageIndex: number;
Expand Down Expand Up @@ -100,6 +102,13 @@ export const ChatMessage: FC<Props> = memo(({ message, messageIndex, onEdit}) =>
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
}
}, [isEditing]);
// const libIconSrc = selectedConversation && selectedConversation.Lib && libImages[selectedConversation.Lib] ? libImages[selectedConversation.Lib] : IconRobot;
const [libIconSrc, setLibIconSrc] = useState(IconRobot);
useEffect(() => {
if (selectedConversation && selectedConversation.Lib && libImages[selectedConversation.Lib]) {
setLibIconSrc(libImages[selectedConversation.Lib]);
}
}, []);
return (
<>
<div
Expand All @@ -113,7 +122,7 @@ export const ChatMessage: FC<Props> = memo(({ message, messageIndex, onEdit}) =>
<div className="relative m-auto flex px-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={22} />
<img src={libIconSrc} alt={selectedConversation?.Lib || 'Default'} style={{ width: 22, height: 22 }} />
) : (
<IconUser size={22} />
)}
Expand Down
Loading

0 comments on commit feb4eae

Please sign in to comment.