Skip to content

Support rendering function calls and responses when sharing chat to markdown#8693

Merged
agmsb merged 2 commits intogoogle-gemini:mainfrom
rramkumar1:chat-share-updates
Sep 19, 2025
Merged

Support rendering function calls and responses when sharing chat to markdown#8693
agmsb merged 2 commits intogoogle-gemini:mainfrom
rramkumar1:chat-share-updates

Conversation

@rramkumar1
Copy link
Copy Markdown
Contributor

@rramkumar1 rramkumar1 commented Sep 18, 2025

TLDR

Support rendering function calls and responses when sharing chat to markdown and also add cool looking icons for the user and gemini roles.

Dive Deeper

This was not added in the initial implementation but is definitely a gap.

Reviewer Test Plan

Run /chat share foo.md and examine the outputs of the file

Testing Matrix

🍏 🪟 🐧
npm run x
npx
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

Resolves #8030

@rramkumar1 rramkumar1 requested a review from a team as a code owner September 18, 2025 14:37
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @rramkumar1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the utility and readability of shared chat histories by extending the Markdown serialization feature. It ensures that complex interactions involving function calls and their subsequent responses are clearly represented, and introduces visual cues for chat participants, making the shared content more comprehensive and user-friendly.

Highlights

  • Function Call and Response Rendering: The chat history serialization to Markdown now correctly renders function calls and their responses, presenting them as formatted JSON code blocks.
  • Role Icons: Emoji icons (🧑‍💻 for user, ✨ for model) have been added to the Markdown output for chat roles, enhancing visual distinction.
  • Test Coverage: New test cases have been introduced to validate the correct serialization of function calls and responses, and existing tests were updated to reflect the new icon formatting.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for rendering function calls and responses when sharing a chat to markdown, and also introduces icons for user and model roles. The implementation is mostly correct, but I've identified a potential UX issue in how function responses are labeled in the markdown output. My review includes a suggestion to improve the clarity and accuracy of the generated markdown by using a 'tool' role for function responses instead of 'user'.

Comment on lines +304 to +305
const roleIcon = item.role === 'user' ? '🧑‍💻' : '✨';
return `${roleIcon} **${item.role}**:\n\n${text}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While this correctly implements the feature according to the tests, labeling a functionResponse as coming from the user role in the markdown output can be misleading for the reader. A tool's response is not direct user input.

To improve clarity, I suggest we detect when a history item is a function response and label its role as tool in the output, perhaps with a corresponding icon like 🛠️. This provides a more accurate representation of the conversation flow.

Note that this change will require updating the corresponding test case in chatCommand.test.ts to expect 🛠️ **tool**: for function responses.

      const isFunctionResponse =
        item.parts?.length === 1 && !!item.parts[0].functionResponse;
      if (isFunctionResponse) {
        return `🛠️ **tool**:\n\n${text}`;
      }
      const roleIcon = item.role === 'user' ? '🧑‍💻' : '✨';
      return `${roleIcon} **${item.role}**:\n\n${text}`;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, I can send a follow up PR for this later.

@rramkumar1
Copy link
Copy Markdown
Contributor Author

/assign @cornmander

@rramkumar1
Copy link
Copy Markdown
Contributor Author

@scidomino Are the e2e tests stuck or are they still running?

@agmsb agmsb added this pull request to the merge queue Sep 19, 2025
Merged via the queue into google-gemini:main with commit 5be2a9d Sep 19, 2025
34 of 44 checks passed
nagendrareddy10 pushed a commit to nagendrareddy10/gemini-cli that referenced this pull request Sep 22, 2025
…arkdown (google-gemini#8693)

Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
yashv6655 added a commit to yashv6655/gemini-cli that referenced this pull request Sep 22, 2025
…arkdown (google-gemini#8693)

Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
thacio added a commit to thacio/auditaria that referenced this pull request Oct 3, 2025
giraffe-tree pushed a commit to giraffe-tree/gemini-cli that referenced this pull request Oct 10, 2025
…arkdown (google-gemini#8693)

Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants