mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
Refactor ClientChatStore
into separate stores for modularity and improve maintainability.
This commit is contained in:

committed by
Geoff Seemueller

parent
ebbfd4d31a
commit
df6e18bbdf
@@ -25,8 +25,8 @@ const Chat = observer(({ height, width }) => {
|
||||
width={width}
|
||||
gap={0}
|
||||
>
|
||||
<GridItem alignSelf="center" hidden={!(chatStore.messages.length < 1)}>
|
||||
<WelcomeHome visible={chatStore.messages.length < 1} />
|
||||
<GridItem alignSelf="center" hidden={!(chatStore.items.length < 1)}>
|
||||
<WelcomeHome visible={chatStore.items.length < 1} />
|
||||
</GridItem>
|
||||
|
||||
<GridItem
|
||||
|
@@ -71,7 +71,7 @@ const InputMenu: React.FC<{ isDisabled?: boolean }> = observer(
|
||||
|
||||
const handleCopyConversation = useCallback(() => {
|
||||
navigator.clipboard
|
||||
.writeText(formatConversationMarkdown(ClientChatStore.messages))
|
||||
.writeText(formatConversationMarkdown(ClientchatStore.items))
|
||||
.then(() => {
|
||||
window.alert(
|
||||
"Conversation copied to clipboard. \n\nPaste it somewhere safe!",
|
||||
|
@@ -27,8 +27,8 @@ const ChatMessages: React.FC<ChatMessagesProps> = observer(({ scrollRef }) => {
|
||||
boxShadow="md"
|
||||
whiteSpace="pre-wrap"
|
||||
>
|
||||
{chatStore.messages.map((msg, index) => {
|
||||
if (index < chatStore.messages.length - 1) {
|
||||
{chatStore.items.map((msg, index) => {
|
||||
if (index < chatStore.items.length - 1) {
|
||||
return (
|
||||
<GridItem key={index}>
|
||||
<MessageBubble x scrollRef={scrollRef} msg={msg} />
|
||||
|
@@ -63,12 +63,12 @@ const MessageBubble = observer(({ msg, scrollRef }) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
clientChatStore.messages.length > 0 &&
|
||||
clientChatStore.items.length > 0 &&
|
||||
clientChatStore.isLoading &&
|
||||
UserOptionsStore.followModeEnabled
|
||||
) {
|
||||
console.log(
|
||||
`${clientChatStore.messages.length}/${clientChatStore.isLoading}/${UserOptionsStore.followModeEnabled}`,
|
||||
`${clientChatStore.items.length}/${clientChatStore.isLoading}/${UserOptionsStore.followModeEnabled}`,
|
||||
);
|
||||
scrollRef.current?.scrollTo({
|
||||
top: scrollRef.current.scrollHeight,
|
||||
|
Reference in New Issue
Block a user