948 Commits

Author SHA1 Message Date
Rankin Zheng
6a0744515b Refactor MessageContainer to use Redux selectors
- Replace generating and responsed props with useSelector.
- Import selectGenerating and selectResponsed from chatSlice.
- Update MessageBlink component to use Redux selectors.
2023-06-08 19:28:15 +08:00
Rankin Zheng
b8e53f60c7 Implement chatSlice and refactor ChatPanel
- Create chatSlice with generating, responsed, currentMessage, and errorMessage states.
- Refactor ChatPanel to use Redux selectors and actions from chatSlice.
- Update store.ts to include chatReducer.
2023-06-08 19:27:51 +08:00
Rankin Zheng
cbfb4ed744 Remove console.log from inputSlice
- Remove unnecessary console.log statement from setValue reducer in inputSlice.ts.
2023-06-08 18:29:39 +08:00
Rankin Zheng
51a2e66053 Update dependencies and integrate Redux
- Update react-redux to ^8.0.7.
- Add remote-redux-devtools ^0.5.16 and @reduxjs/toolkit ^1.9.5.
- Implement Redux store and inputSlice for managing input state.
- Refactor InputMessage and ChatPanel components to use Redux.
2023-06-08 17:32:57 +08:00
Rankin Zheng
62a7542690 Remove unused imports from App.tsx
- Remove useState, Navbar, Header, Footer, Aside, Text, MediaQuery, and Burger imports.
2023-06-08 10:55:19 +08:00
Rankin Zheng
b1b707b512 Uncomment onScrollPositionChange in ChatPanel
- Re-enable onScrollPositionChange event handler in ChatPanel.
2023-06-08 10:47:24 +08:00
bobo.yang
4d483a2096 Refactor topicManager.ts to use firstMessageHash
- Added condition to check for currentTopicId.
- Updated currentTopicId to use firstMessageHash.
2023-06-08 09:06:53 +08:00
bobo.yang
3b35a8e03c Update historyMessagesBase.ts to use firstMessageHash
- Added check for topic existence and firstMessageHash.
- Replaced topicId with topic.firstMessageHash in logOptions.
2023-06-07 21:58:33 +08:00
bobo.yang
59ba922472 add git log context fore relase note command 2023-06-07 08:16:22 +08:00
boob.yang
69837e88a5
Merge pull request #167 from covespace/refactor_topic_method
Refactor topic method
2023-06-06 21:17:33 +08:00
bobo.yang
2afe176895 Add double dash to DevChat arguments
- Update devchat.ts to include a double dash in the chat() method.
- Ensure proper separation of options and content in the chat() method.
2023-06-06 21:11:15 +08:00
boob.yang
34ae3923f9
Merge pull request #165 from covespace/update_devchat_proxy_url
update url for DevChat proxy
2023-06-06 18:47:55 +08:00
bobo.yang
b5b9574ba7 update url for DevChat proxy 2023-06-06 18:47:22 +08:00
Rankin Zheng
a8af5e09bb
Merge pull request #164 from covespace/113-refill-the-input-with-a-previous-prompt
113 refill the input with a previous prompt
2023-06-06 18:13:54 +08:00
Rankin Zheng
58230455df Add refill prompt action icon to user messages 2023-06-06 18:13:26 +08:00
bobo.yang
80d72ad04d Improve error handling and code quality
- Replace '==' with '===' in contextManager.ts and sendMessageBase.ts.
- Add try-catch block in devchat.ts to handle JSON parsing errors.
- Remove unused import in topicManager.ts.
- Use .flat() method for iterating logEntries in topicManager.ts.
2023-06-06 17:53:00 +08:00
bobo.yang
3ec578c7be load topic from DevChat 2023-06-06 17:52:31 +08:00
Rankin Zheng
80d91518f2 feat: Add refill prompt action icon to user messages 2023-06-06 15:13:49 +08:00
bobo.yang
c58c72ab25 Improve error handling and display in UI
- Add UiUtilWrapper.showErrorMessage() method in uiUtil.ts.
- Update contextManager.ts to display error messages using UiUtilWrapper.
- Refactor CommandRun error handling in commonUtil.ts.
- Implement showErrorMessage() in uiUtil_vscode.ts.
2023-06-06 11:31:57 +08:00
Rankin Zheng
5786bb1086 Refactor: Sort context menu items in InputMessage component
In this commit, we updated the InputMessage component to sort the context menu items alphabetically, with the exception of the <custom command> item, which is placed at the end of the list. This change improves the user experience by providing a more organized and predictable order for the context menu items. The sorting logic was added to the contextMenusNode constant using the sort() and localeCompare() methods.
2023-06-06 11:31:52 +08:00
boob.yang
8964103afc
Merge pull request #161 from covespace/159-the-user-manually-stops-without-returning-an-error
Refactor handlerResponseText condition check
2023-06-06 11:15:33 +08:00
bobo.yang
568c7d1255 Refactor handlerResponseText condition check
- Remove unnecessary empty string check in sendMessageBase.ts.
- Simplify condition to only check for chatResponse.isError.
2023-06-06 11:14:36 +08:00
Rankin Zheng
4a6ff075a7 Fix: Clear error message when generating a new response in ChatPanel
In this commit, we updated the ChatPanel component to clear the error message when generating a new response. This change ensures that any previous error messages are removed from the UI, providing a clean slate for the new response. The setHasError('') function call was added to the onClick event handler of the RegenerationButton component.
2023-06-06 11:06:19 +08:00
Rankin Zheng
4aea940676
Merge pull request #160 from covespace/115-wrong-context-format-in-sent-messages
115 wrong context format in sent messages
2023-06-06 11:01:18 +08:00
Rankin Zheng
54b2d4d44f Fix: Preserve whitespace in ChatPanel message content
In this commit, we updated the ChatPanel's MessageContainer component to preserve whitespace in the message content. This change improves the display of code snippets and other content that relies on whitespace formatting. The content is now wrapped in a <pre> tag with the overflowWrap style set to 'normal'.
2023-06-06 11:00:52 +08:00
Rankin Zheng
97688d3687 Refactor: Move RegenerationButton and StopButton components outside chatPanel
In this commit, we moved the RegenerationButton and StopButton components outside the chatPanel component and passed the onClick event handlers as props. This change improves the readability and maintainability of the code by separating the components and their logic.
2023-06-06 10:55:14 +08:00
bobo.yang
af3038dbd1 Add parseDateStringToTimestamp function
- Update sendMessageBase.ts with the new function.
- Replace Date.parse with parseDateStringToTimestamp.
- Fix string comparison with strict equality.
2023-06-06 10:51:38 +08:00
Rankin Zheng
add9e10945 Enhancement: Display error messages in ChatPanel using Alert component
In this commit, we updated the ChatPanel component to display error messages using the Alert component from the Mantine library. This change improves the user experience by providing a clear and consistent way to display error messages in the chat interface. The error message is now stored as a string in the hasError state, and the Alert component is conditionally rendered based on the presence of an error message.
2023-06-05 22:18:51 +08:00
Rankin Zheng
011ecb0e81 Refactor: Simplify icon rendering in InputMessage component
In this commit, we simplified the icon rendering logic in the InputMessage component by removing the unnecessary condition for the <custom command> name. This change makes the code more concise and easier to understand.
2023-06-05 21:25:12 +08:00
Rankin Zheng
dd90ced309 Refactor: Simplify width prop handling in ChatPanel components
In this commit, we simplified the width prop handling in the ChatPanel components by directly passing the width value instead of the entire chatContainerRect object. This change makes the code more readable and easier to maintain.
2023-06-05 21:13:06 +08:00
Rankin Zheng
2d6692ff39 Update: Replace react-syntax-highlighter with Prism in CodeBlock component
In this commit, we replaced the react-syntax-highlighter package with the Prism component from the same package. This change improves the syntax highlighting performance and provides better support for various programming languages. The okaidia theme is also imported for a consistent look and feel.
2023-06-05 20:44:50 +08:00
Rankin Zheng
70d1668e6c Refactor: Remove unnecessary state and improve message handling in ChatPanel
In this commit, we removed the unnecessary registed state from the ChatPanel component and improved the message handling by moving the messageUtil.registerHandler calls to the useEffect hook. This change simplifies the code and ensures that the handlers are registered only once during the component's lifecycle.
2023-06-05 20:41:37 +08:00
Rankin Zheng
77898b8294 Refactor: Extract MessageContainer component from ChatPanel
Created a new MessageContainer.tsx file and moved the MessageContainer component from ChatPanel/index.tsx to the new file.
Imported the MessageContainer component in ChatPanel/index.tsx and removed the previous inline implementation.
MessageContainer component handles the display and management of messages in the chat panel, including message avatars, message contexts, and message blinking.
2023-06-05 19:27:25 +08:00
Rankin Zheng
2ad72ed857 Refactor: Extract CodeBlock component from ChatPanel
Created a new CodeBlock.tsx file and moved the CodeBlock component from ChatPanel/index.tsx to the new file.
Imported the CodeBlock component in ChatPanel/index.tsx and removed the previous inline implementation.
CodeBlock component handles the display and management of code blocks in the chat panel, including language corner, code buttons, and syntax highlighting.
2023-06-05 19:24:08 +08:00
Rankin Zheng
e6f2e926db Refactor: Extract InputMessage component in ChatPanel 2023-06-05 19:21:10 +08:00
Rankin Zheng
43853de82a Refactor: Extract InputMessage component in ChatPanel 2023-06-05 19:12:58 +08:00
Rankin Zheng
cee7c0eac6 Refactor: Extract InputMessage component in ChatPanel
Extracted the InputMessage component from the chatPanel function in the ChatPanel/index.tsx file.
Replaced the previous inline implementation with the new InputMessage component.
InputMessage component handles the display and management of the input message area, including the command menu and context menu.
2023-06-05 18:42:45 +08:00
Rankin Zheng
ba32f21082 Refactor: Extract InputContexts component in ChatPanel
Extracted the InputContexts component from the chatPanel function in the ChatPanel/index.tsx file.
Replaced the previous inline implementation with the new InputContexts component.
InputContexts component handles the display and management of input contexts in the chat panel.
2023-06-05 18:40:07 +08:00
Rankin Zheng
d500fe63f1 Refactor: Extract RegenerationButton and StopButton components in ChatPanel
Extracted the RegenerationButton and StopButton components from the chatPanel function in the ChatPanel/index.tsx file.
Replaced the previous inline implementation with the new RegenerationButton and StopButton components.
RegenerationButton and StopButton components handle the regeneration and stopping of message generation, respectively.
2023-06-05 18:35:21 +08:00
Rankin Zheng
a835755439 Refactor: Extract MessageContainer component in ChatPanel
Extracted the MessageContainer component from the chatPanel function in the ChatPanel/index.tsx file.
Replaced the previous inline implementation with the new MessageContainer component.
MessageContainer component includes MessageAvatar, MessageContext, and MessageBlink subcomponents.
2023-06-05 18:20:08 +08:00
Rankin Zheng
b170623bce Refactor: Extract CodeButtons component in ChatPanel
Extracted the CodeButtons component from the chatPanel function in the ChatPanel/index.tsx file.
Replaced the previous inline implementation with the new CodeButtons component.
CodeButtons component includes CommitButton, DiffButton, CodeApplyButton, FileApplyButton, and CodeCopyButton.
2023-06-05 17:25:47 +08:00
Rankin Zheng
3bda063a2e Refactor: Extract LanguageCorner component in CodeBlock
Extracted the LanguageCorner component from the CodeBlock function in the ChatPanel/index.tsx file.
Replaced the previous inline implementation with the new LanguageCorner component.
2023-06-05 17:15:28 +08:00
Rankin Zheng
32af336585 Refactor: Extract CodeBlock component in ChatPanel
Extracted the CodeBlock component from the chatPanel function in the ChatPanel/index.tsx file.
Replaced the previous inline implementation with the new CodeBlock component.
2023-06-05 17:09:40 +08:00
bobo.yang
34066c5597 Add logger to TopicManager for better error handling
- Imported logger from '../util/logger' in topicManager.ts.
- Added logger.channel()?.info() for "Topic not found" cases.
2023-06-05 14:05:55 +08:00
bobo.yang
06afafb937 Fix message header assignment condition
- Changed condition in parseMessageAndSetOptions function.
- Now correctly assigns chatOptions.header based on message.text.
2023-06-05 11:37:14 +08:00
bobo.yang
9546cfb7ba Add wait flag for topic creation and update UI
- Added WaitCreateTopic flag to prevent UI updates during topic creation.
- Updated DevChatViewProvider to check for WaitCreateTopic flag.
- Added onSelectChanged method in TopicTreeDataProvider.
- Enabled setCurrentTopic in TopicManager.
2023-06-05 11:36:45 +08:00
bobo.yang
3c63fb4c61 Fix history message repeat 2023-06-05 11:25:04 +08:00
bobo.yang
2aca2d3db5 don't append partial response before error 2023-06-05 09:17:58 +08:00
bobo.yang
f91abd1002 fix log miss in history messages 2023-06-02 14:07:20 +08:00
bobo.yang
1c6e002373 Add args property to Command interface and update regCommandList
- Added args property to Command interface in commandManager.ts and customCommand.ts.
- Updated regCommandList handler to convert command patterns with args.
- Replaced {{prompt}} with an array of empty strings based on the args count.
2023-06-02 13:45:12 +08:00