957 Commits

Author SHA1 Message Date
Rankin Zheng
447ae59088 Refactor MessageBody component and enhance ChatStore
- Extracted Markdown rendering logic from MessageBody into a new MessageMarkdown component.
- Moved CodeButtons component into the new MessageMarkdown directory.
- Updated MessageBody to use the new MessageMarkdown component.
- Added value attributes to buttons in the initial bot message in ChatStore.
2023-08-22 16:14:43 +08:00
Rankin Zheng
4641b97700 Update package.json and MessageBody component, enhance ChatStore
- Corrected indentation in package.json for DevChat.PythonVirtualEnv.
- Added 'rehype-raw' to dependencies in package.json.
- Imported 'rehype-raw' in MessageBody component and added it to ReactMarkdown as a rehypePlugin.
- Enhanced initial bot message in ChatStore with additional information and buttons.
2023-08-22 15:35:32 +08:00
Rankin Zheng
1e092e23cf Move initial messages creation from MessageList to ChatStore
- Removed useEffect hook in MessageList that was adding initial messages.
- Added logic in ChatStore to add initial messages when messages length is 0.
2023-08-22 14:46:06 +08:00
Rankin Zheng
bcbd399794 Refactor CurrentMessage component and update MessageList
- Refactored CurrentMessage component to destructure properties from chat.
- Added useEffect hooks to handle message generation and updating in CurrentMessage.
- Updated MessageList to use useEffect to add initial messages to chat.
2023-08-22 14:34:43 +08:00
Rankin Zheng
79ad3531dc Add addMessages function to ChatStore
- Added a new function 'addMessages' to ChatStore that accepts an array of IMessage objects and pushes them to the 'messages' array.
2023-08-22 14:22:49 +08:00
Rankin Zheng
54cd6768e9 Refactor MessageAvatar and MessageBody components
- Removed unused 'key' prop from MessageAvatar component.
- Converted MessageBody component to use observer from mobx-react-lite.
- Added 'messageText' and 'messageType' to MessageBody props interface.
- Removed extra line breaks in MessageBody component.
2023-08-22 14:22:23 +08:00
Rankin Zheng
2975bd0c5f Refactor MessageAvatar component and update ChatStore
- Expanded MessageAvatar props to include avatarType, copyMessage, messageContexts, and deleteHash.
- Updated MessageAvatar to use new props instead of item prop.
- Updated MessageList to pass new props to MessageAvatar.
- Refactored deleteMessage function in ChatStore to accept messageHash instead of item.
- Updated setContexts function in InputStore to accept IChatContext array.
2023-08-21 15:28:19 +08:00
Rankin Zheng
b7c16f709f Rename CodeBlock to MessageBody
- Renamed CodeBlock component to MessageBody for better clarity.
- Updated all references of CodeBlock to MessageBody in the codebase.
- Moved CodeBlock related files to MessageBody directory.
2023-08-21 14:07:11 +08:00
Rankin Zheng
d514446666 Extract MessageContext component from MessageList
- Created a new file for MessageContext component.
- Removed MessageContext related code from MessageList.
- Imported MessageContext in MessageList.
2023-08-21 14:00:34 +08:00
Rankin Zheng
051fc4a371 Rename MessageHeader to MessageAvatar
- Renamed MessageHeader component to MessageAvatar for better clarity.
- Updated all references of MessageHeader to MessageAvatar in the codebase.
- Moved avatar images from MessageHeader directory to MessageAvatar directory.
2023-08-21 13:56:42 +08:00
Rankin Zheng
e0487015d6 Rename MessageContainer to MessageList
- Renamed MessageContainer component to MessageList for better clarity.
- Updated all references of MessageContainer to MessageList in the codebase.
2023-08-21 13:53:32 +08:00
bobo.yang
6713a98df9 Add commands for DevChat
- Added commands for adding context and summary to DevChat.
- Updated the package.json file to include the new commands.
- Added command handlers for indexing and describing codebase summaries.
- Created a new file, askcode_summary_index.py, for indexing and describing codebase summaries.
- Added a new setting file, _setting_.json, for the summary action in the auto_command workflow.
- Added a new handler file, handler.py, for the summary action in the auto_command workflow.
2023-08-21 11:52:00 +08:00
bobo.yang
3bf09924d7 Refactor commands.ts
- Update the registerAskCodeIndexStartCommand function to pass the progressBar object to the installAskCode and indexCode functions.
- Update the installAskCode function to accept the progressBar object as a parameter.
- Update the indexCode function to accept the progressBar object as a parameter.
- Update the progress bar messages in the registerAskCodeIndexStartCommand function.
2023-08-21 11:52:00 +08:00
bobo.yang
4f70944a92 Refactor contextRefDefs.ts
- Update the logic for parsing the response from the devchat prompt command.
- Handle different response formats, including JSON, array, and plain text.
- Extract symbols from the response and return them as an array.
- Log the response for debugging purposes.
2023-08-21 11:52:00 +08:00
bobo.yang
9a6a8ea8db Add ProgressBar class
- Create a new ProgressBar class to handle progress reporting.
- Initialize the progress bar with a title and location.
- Implement the init() method to start the progress bar.
- Implement the update() method to update the progress message.
- Implement the end() method to end the progress bar.
- Implement the endWithError() method to end the progress bar with an error message.
2023-08-21 11:52:00 +08:00
bobo.yang
c074f97fd5 Refactor package_install.ts
- Add errorOut variable to capture stderr data.
- Use logger to output stderr data.
- Show logger channel.
- Check if code is not 0 and errorOut is not empty to resolve with false.
2023-08-21 11:52:00 +08:00
bobo.yang
90bfb5b32f Refactor status bar view and UI utility
- Refactored the createStatusBarItem function in statusBarView.ts to use vscode.window.withProgress for a better user experience.
- Added a progress indicator while checking the devchat dependency environment.
- Updated the status bar item text, tooltip, and command based on the dependency and API key status.
- Added error handling for any exceptions that occur during the dependency check.
- Updated the updateConfiguration function in uiUtil_vscode.ts to include error handling.
2023-08-21 11:52:00 +08:00
bobo.yang
100aacb6e6 Add hasLoadTopics flag and loadTopics() call
- Added a new boolean flag 'hasLoadTopics' to track whether topics have been loaded.
- If the devchat package has been installed and the API access key is valid, the 'loadTopics()' method of the TopicManager class is called.
- This ensures that topics are only loaded once when the dependencies are satisfied.
2023-08-21 11:52:00 +08:00
bobo.yang
e6b48a9681 Reimplement Python package installation. 2023-08-21 11:52:00 +08:00
bobo.yang
90126a9d48 install devchat by conda 2023-08-21 11:52:00 +08:00
bobo.yang
46a70a15ac remove no reference function 2023-08-21 11:52:00 +08:00
bobo.yang
986848fea9 install askcode by conda 2023-08-21 11:52:00 +08:00
bobo.yang
bd430c6d8a Refactor environment variable setup for new processes
- Extracted the creation and setup of environment variables into a separate async function `createOpenAiKeyEnv`.
- This function copies the current environment variables and modifies the `OPENAI_API_KEY` and `OPENAI_API_BASE` as needed.
- Replaced the inline environment variable setup in `runCommandAndWriteOutput`, `runCommandStringAndWriteOutput`, and `runCommandStringArrayAndWriteOutput` with a call to `createOpenAiKeyEnv`.
2023-08-21 11:52:00 +08:00
bobo.yang
b837365427 Add PythonVirtualEnv configuration and improve error handling
- Added PythonVirtualEnv configuration to customAction.ts.
- Improved error handling in doCommand.ts by using logger instead of console.error.
- Updated sendMessage.ts to handle askCode command and improved error handling.
- Added environment variables for OPENAI_API_KEY and OPENAI_API_BASE in commonUtil.ts.
- Created new action 'query_data' in _setting_.json and its handler in handler.py.
2023-08-21 11:52:00 +08:00
bobo.yang
df679ea613 Implement function to execute VSCode commands
- Added a new function 'doCommand' in 'doCommand.ts' to execute VSCode commands.
- The function takes a message and a panel as arguments, and uses the 'executeCommand' method from the 'vscode' module.
- Updated 'commandManager.ts' to return an empty string instead of undefined.
- Registered the new 'doCommand' handler in 'loadHandlers.ts'.
2023-08-21 11:52:00 +08:00
bobo.yang
6b96d911f0 Implement updateLastModifyTime function and status bar item
- Added a new function updateLastModifyTime in askCodeUtil.ts to update the last modification time of files.
- The function ignores hidden files and directories (those starting with '.').
- The function creates the directory if it does not exist before writing the file.
- Added a new status bar item for AskCode in statusBarView.ts.
- The status bar item checks the indexing status every 10 seconds and updates its tooltip and command accordingly.
2023-08-21 11:52:00 +08:00
bobo.yang
1f7bd4ac03 Implemented AskCode Indexing Commands
- Added new functions to register AskCode Index start and stop commands in commands.ts.
- Implemented functions to install AskCode and index code.
- Added function to get configuration settings for Python virtual environment and supported file types.
- Updated sendMessage.ts to handle 'askCode' command and execute AskCode query.
2023-08-21 11:52:00 +08:00
bobo.yang
fd011ee265 Added AskCode functionality to DevChat
- Added new settings for Python virtual environment and supported file types in package.json.
- Added new commands for starting and stopping AskCode Index in package.json.
- Registered new 'ask-code' command in CommandManager.
- Registered AskCode Index start and stop commands in extension.ts.
- Added 'askCode' handler in loadHandlers.ts and messageHandler.ts.
- Updated messageHandler to check for '/ask-code' in message text and call 'askCode' command.
2023-08-21 11:52:00 +08:00
bobo.yang
1f5cf7ebbe Clear contextInfo in sendMessage
- Modified the sendMessage function in the sendMessage.ts file.
- Added code to clear the message.contextInfo property before sending the message.
2023-08-21 08:31:52 +08:00
Rankin Zheng
63694c7306 Add 'path' property to ChatContext model and update components
- Added 'path' property to ChatContext model in InputStore.ts.
- Updated InputMessage and MessageContainer components to use 'path' instead of 'file' for display.
- Updated ChatStore to include 'path' in the context object.
2023-08-18 16:28:43 +08:00
Rankin Zheng
36615f1366 Update MessageContainer and MessageHeader components
- Made 'contexts' prop optional in MessageContainer component.
- Refactored MessageContainer component to return a fragment.
- Made 'showEdit' prop optional in MessageHeader component.
2023-08-18 16:21:51 +08:00
Rankin Zheng
d680385445 Refactor ChatStore to improve context handling
- Updated the startGenerating action to include both command and content in the context object.
- Refactored the loadHistory action to parse the content of each context before creating a new message.
2023-08-18 16:13:52 +08:00
Rankin Zheng
14bb7ba17b Refactor InputMessage component and ChatStore
- Imported the Message model from ChatStore in InputMessage/index.tsx.
- Updated the handleSendClick function to create a new Message object before calling the newMessage action.
- Updated the startGenerating action in ChatStore.ts to accept an array of chat contexts.
- Updated the map function in the loadHistory action to directly use the context field of each item.
2023-08-18 13:00:54 +08:00
Rankin Zheng
6290436bb7 Refactor InputMessage component and InputStore
- Imported the ChatContext model from InputStore in InputMessage/index.tsx.
- Updated the handleSendClick function to create a new ChatContext object before calling the newContext action.
- Updated the newContext action in InputStore.ts to accept an IChatContext object.
2023-08-18 12:21:19 +08:00
Rankin Zheng
5eefb6b32c Refactor CurrentMessage component and ChatStore
- Updated the CurrentMessage component to use the Message model from ChatStore.
- Replaced chat.lastMessage with the last message in the chat.messages array.
- Updated the useEffect hooks to create a new Message object and pass it to the newMessage and updateLastMessage actions.
- Updated the chatPanel function in ChatPanel.tsx to create a new Message object before calling the newMessage action.
- Removed the lastMessage field from the ChatStore model.
- Updated the startResponsing action to accept a string parameter.
- Updated the updateLastMessage action to accept a string parameter and update the message field of the last message in the chat.messages array.
2023-08-18 12:11:12 +08:00
Rankin Zheng
1fe45ef5e0 Refactor InputMessage component and ChatStore
- Simplified the handleSendClick function in InputMessage/index.tsx to directly use input.value.
- Made 'contexts' an optional field in the Message model in ChatStore.ts.
- Updated the newMessage and updateLastMessage actions in ChatStore.ts to accept an IMessage object.
2023-08-18 11:48:19 +08:00
Rankin Zheng
13a80ba67f Refactor MessageHeader component and related stores
- Added IProps interface and updated the MessageHeader component to use typed props in MessageHeader/index.tsx.
- Updated the deleteMessage function in ChatStore.ts to accept an IMessage object instead of a params object.
- Added an export for the IMessage type in ChatStore.ts.
- Updated the setContexts action in InputStore.ts to accept an array of IChatContext objects and to push a copy of each context object to self.contexts.
- Added an export for the IChatContext type in InputStore.ts.
2023-08-18 11:43:26 +08:00
Rankin Zheng
7c9edd9261 Refactor MessageContainer component and related stores
- Added IProps interface and updated the MessageContext component to use destructured props in MessageContainer/index.tsx.
- Refactored the map function in MessageContext to destructure the item object.
- Updated the display text in the Accordion.Control component to use destructured values.
- Replaced 'context.content' with 'content' in the Accordion.Panel component.
- In ChatStore.ts, updated the Message model to use the ChatContext model from InputStore for the 'contexts' field.
- Refactored the map function in the 'load' action of ChatStore to destructure and return the parsed context object.
- Made 'file' an optional string in the ChatContext model in InputStore.ts.
- Added an export for the IInputStore type in InputStore.ts.
2023-08-18 11:25:28 +08:00
Rankin Zheng
b99ab0262a Refactor InputContexts component and related files
- Imported ChatContext from InputStore in InputContexts.tsx.
- Refactored the map function in InputContexts to destructure the context object.
- Updated the display text in the Accordion.Control component to use destructured values.
- Replaced 'context.content' with 'content' in the Accordion.Panel component.
- In InputMessage/index.tsx, updated the newContext method call to use 'context.content'.
- Added 'command' as an optional string to the ChatContext model in InputStore.ts.
2023-08-18 08:47:09 +08:00
Rankin Zheng
8c5c06af69 Add 'type' field to Message model in ChatStore
- Added 'type' field to Message model in ChatStore.
- The 'type' field is an enumeration with possible values 'user', 'bot', and 'system'.
2023-08-18 00:33:04 +08:00
Rankin Zheng
916b45f54d Refactor async actions in ChatStore to use MobX flow
- Refactored fetchHistoryMessages and deleteMessage actions in ChatStore to use MobX flow for handling async operations.
- Updated calls to these actions in MessageHeader and ChatPanel components to handle promises returned by these actions.
2023-08-18 00:29:03 +08:00
Rankin Zheng
2c144c4d5f Refactor MessageContainer and MessageHeader components to use MobX
- Replaced Redux hooks with MobX hooks in MessageContainer and MessageHeader components.
- Removed Redux actions and replaced them with equivalent MobX actions.
- Updated event handlers to use MobX actions instead of Redux actions.
- Replaced Redux selectors with equivalent MobX observables.
- Converted MessageContainer and MessageHeader components to observer components.
2023-08-18 00:24:10 +08:00
Rankin Zheng
8e944b4958 Refactor CurrentMessage component to use MobX
- Replaced Redux hooks with MobX hooks in CurrentMessage component.
- Removed Redux actions and replaced them with equivalent MobX actions.
- Updated useEffect hooks to use MobX actions instead of Redux actions.
- Replaced Redux selectors with equivalent MobX observables.
- Converted CurrentMessage and MessageBlink components to observer components.
2023-08-18 00:23:41 +08:00
Rankin Zheng
5bbe9963b8 Refactor InputMessage and InputContexts components to use MobX
- Replaced Redux hooks with MobX hooks in InputMessage and InputContexts components.
- Removed Redux actions and replaced them with equivalent MobX actions.
- Updated event handlers and useEffect hooks to use MobX actions instead of Redux actions.
- Replaced Redux selectors with equivalent MobX observables.
2023-08-18 00:23:18 +08:00
Rankin Zheng
26e363f5ee Refactor RegenerationButton and StopButton components to use MobX
- Replaced Redux hooks with MobX hooks in RegenerationButton and StopButton components.
- Removed Redux actions and replaced them with equivalent MobX actions.
- Updated onClick handlers to use MobX actions instead of Redux actions.
2023-08-18 00:22:43 +08:00
Rankin Zheng
fcc0bf9584 Refactor ChatPanel.tsx to use MobX instead of Redux
- Replaced Redux hooks with MobX hooks for state management.
- Removed Redux actions and replaced them with equivalent MobX actions.
- Updated useEffect hook to use MobX actions instead of Redux actions.
- Replaced Redux selectors with equivalent MobX observables.
2023-08-18 00:22:16 +08:00
Rankin Zheng
d92339e1b3 Remove Redux and related slices
- Deleted Redux store configuration file (store.ts).
- Removed inputSlice.ts and chatSlice.ts which contained Redux slices for managing chat and input state.
- Deleted index.ts which contained Redux hooks for dispatching actions and selecting state.
2023-08-18 00:21:44 +08:00
Rankin Zheng
672021b852 Add MobX and refactor state management
- Added MobX, mobx-react, and mobx-state-tree to package.json.
- Refactored state management in index.tsx to use MobX instead of Redux.
- Created new MobX stores: ChatStore, InputStore, and RootStore.
- Implemented async actions in ChatStore and InputStore using mobx-state-tree's flow.
- Updated RootStore to include instances of ChatStore and InputStore.
2023-08-18 00:21:05 +08:00
bobo.yang
4c34d06b33 Add check for duplicate action registration
- Added a check in the registerAction method to prevent duplicate actions from being registered.
- Removed the line that clears the actions array in the loadCustomActions method.
2023-08-09 18:36:30 +08:00
bobo.yang
e0c638e3c0 remove duplicated contexts 2023-08-09 15:58:15 +08:00