Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Gemini-1.5-pro-latest Stream Chat with history, Generate Git Commit message with Gemini, Add a Gemini Extension webview window, Chat mesage with Highlight Code #373

Closed
wants to merge 48 commits into from

Conversation

JasonQWJ
Copy link

@JasonQWJ JasonQWJ commented Apr 18, 2024

Description of the change

This pull request introduces a comprehensive set of enhancements to the Pipet Code Agent, focusing on user interface improvements, interaction refinements, and expanded functionality.
Key changes include:

  • Refined Chat Interface: The chat interface has been redesigned for better clarity and user experience. This includes visual improvements and adjustments to the layout for a more intuitive interaction.
  • Enhanced Interaction: The interaction flow within the chat has been streamlined. This includes improvements to message handling, code highlighting, and overall responsiveness.
  • Custom Commit Messages: Users now have the flexibility to provide custom commit messages when utilizing the agent's Git commit generation feature. This allows for more personalized and informative commit history.
  • Updated Gemini Model: The underlying Gemini model has been updated to gemini-1.5-pro-latest to leverage the latest advancements and capabilities.
  • API Updates: The codebase has been adapted to utilize the v1beta API and incorporates systemInstruction for improved control and interaction with the model.
  • Bug Fixes and Optimizations: Several bug fixes and optimizations have been implemented to ensure a smooth and reliable user experience.

Motivation

These changes are driven by the goal of providing a more user-friendly, efficient, and feature-rich experience for Pipet Code Agent users. The refined interface and interaction aim to make the agent more intuitive and enjoyable to use. The addition of custom commit messages empowers users with greater control and flexibility over their Git workflow. Updating the Gemini model and API ensures the agent benefits from the latest advancements in AI technology. Bug fixes and optimizations contribute to a more stable and reliable user experience.

Type of change

Feature request

Checklist

  • I have performed a self-review of my code.
  • I have added detailed comments to my code where applicable.
  • I have verified that my change does not break existing code.
  • My PR is based on the latest changes of the main branch (if unsure, please run git pull --rebase upstream main).
  • I am familiar with the Google Style Guide for the language I have coded in.
  • I have read through the Contributing Guide and signed the Contributor License Agreement.

JasonQWJ and others added 30 commits April 3, 2024 19:24
add getCommentperfixes
modified:   examples/gemini/node/pipet-code-agent/src/review.ts
modified:   examples/gemini/node/pipet-code-agent/src/review.ts
modified:   examples/gemini/node/pipet-code-agent/src/extension.ts
new file:   examples/gemini/node/pipet-code-agent/webview.html

add Chat stat
modified:   examples/gemini/node/pipet-code-agent/src/getCommentprefixes.ts
This commit adds a new command to the Pipet Code Agent extension that allows users to generate git commit messages based on the git diff.

The command uses the Gemini large language model to generate a commit message that is relevant to the changes made in the code.
The generated commit message is then copied to the clipboard and pasted into the commit box.
This can save users time and effort when committing their changes.
modified:   examples/gemini/node/pipet-code-agent/media/main.css
modified:   examples/gemini/node/pipet-code-agent/media/main.js
modified:   examples/gemini/node/pipet-code-agent/media/prism.css
modified:   examples/gemini/node/pipet-code-agent/media/vscode.css
modified:   examples/gemini/node/pipet-code-agent/src/chat.ts
modified:   examples/gemini/node/pipet-code-agent/src/extension.ts
modified:   examples/gemini/node/pipet-code-agent/src/getCommentprefixes.ts
renamed:    examples/gemini/node/pipet-code-agent/src/gitdiff.ts -> examples/gemini/node/pipet-code-agent/src/gitCommit.ts
modified:   examples/gemini/node/pipet-code-agent/src/review.ts
This commit addresses several updates to the Pipet Code Agent's configuration and functionality. The changes include:

1. Adjustments to the `package.json` file, where the properties for `google.gemini.apiKey` and `google.gemini.systemInstruction` have been modified to include default values and markdown descriptions for better user guidance.

2. Updates to the `chat.ts` file, which now includes a new function `startchat()` and retrieves the API key and system instruction from user configuration. The role and parts have been updated to reflect the latest instructions and model names.

3. Modifications to the `comments.ts` file, with the introduction of a new constant `SYSTEMINSTRUCTION` and a revised `generateComment()` function that generates comments using doxygen style, as per the updated system instruction.

4. Changes to the `gitCommit.ts` file, updates the `generateCommit()` function to handle the new content structure and system instruction.

5. Alterations to the `review.ts` file, including a new system instruction and an updated `generateReview()` function that generates code reviews according to the provided guidelines.

These updates aim to improve the user experience by providing clearer instructions and more efficient handling of API keys and system instructions. Additionally, they ensure compatibility with the latest models and best practices for code comments and reviews.
The review prompt now explicitly asks for a code review and adds a "(generated)" tag to the output.

Additionally, the VS Code extension now outputs the VSIX file to a `build` directory.
This commit introduces the ability to provide custom commit messages when using the Pipet code agent.

The generated commit message will now be copied to the clipboard, allowing users to easily paste it into the commit box and make any necessary modifications before committing their changes.
This commit enhances the custom commit message functionality by incorporating details from the Git Diff, providing a more comprehensive and informative message.
This commit introduces several enhancements to the chat interface and its underlying logic:

- **UI Refinements:**
    - Removed redundant CSS comments for brevity.
    - Added border radius to input fields for a polished look.
- **Logic Enhancements:**
    - Enabled sending messages by pressing Enter, streamlining interaction.
    - Incorporated selected code into prompts, providing context to the AI.
@JasonQWJ JasonQWJ requested a review from a team as a code owner April 18, 2024 07:58
@github-actions github-actions bot added the status:awaiting review PR awaiting review from a maintainer label Apr 18, 2024
JasonQWJ added 13 commits April 18, 2024 16:00
This commit introduces the ability to select text in the editor and have it automatically populate the chat prompt. This makes it easier to ask questions or get help with specific sections of code.

The following changes were made:

- Added a new function `onSelection` to the `main.js` file to handle text selection events.
- Added an event listener to the `ChatViewProvider` class to listen for changes in the text editor selection.
- When a selection is made, the selected text is sent to the webview as a message with the command `onSelection`.
- The `onSelection` message is handled in the `main.js` file, which updates the placeholder text in the user input field with the selected text.
- When the user sends a message, the selected code is prepended to the message text before it is sent to the chat session.
This commit enhances the user interface and overall experience of the Pipet Code Agent extension by addressing several key areas:

- **Streamlined UI:** Removed unnecessary padding and adjusted element styling for a cleaner and more modern look.
- **Dynamic Textarea:** The user input textarea now automatically adjusts its height to accommodate the content, providing a more intuitive typing experience.
- **Improved Scrolling:** The chat window now smoothly scrolls to keep the latest messages in view, ensuring users don't miss any important information.
- **Chat History Persistence:** Chat history is now preserved between sessions, allowing users to easily refer back to previous conversations.
- **Code Selection Integration:** The extension now seamlessly integrates with code selection, automatically populating the chat prompt with the selected code for a more efficient workflow.
Add keyboard shortcuts and commands to generate code using Pipet.
@JasonQWJ JasonQWJ closed this Apr 27, 2024
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Apr 27, 2024
@MarkDaoust
Copy link
Member

@joefernandez @shilpakancharla @markmcd - Codeowners says this should have gone to you, looks like we need to update it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants