Skip to content

feat: enhance error messaging in chat and update README with new features#57

Merged
hoangsonww merged 4 commits into
masterfrom
feat/enhance-user-experience
Mar 23, 2026
Merged

feat: enhance error messaging in chat and update README with new features#57
hoangsonww merged 4 commits into
masterfrom
feat/enhance-user-experience

Conversation

@hoangsonww
Copy link
Copy Markdown
Owner

This pull request focuses on improving error handling and user experience in the chat and article retrieval features, as well as enhancing project documentation. The main changes ensure that users always receive helpful, actionable responses instead of generic or technical error messages, and that the README accurately reflects the project's capabilities.

Error Handling & User Experience Improvements:

  • The chat API (app/api/chat/route.ts) now always returns a friendly, actionable message to users when an error occurs, instead of an error status or technical message.
  • The chat UI (app/chat/page.tsx) displays a user-friendly message if it cannot reach the server, encouraging users to check their connection or browse articles directly.
  • The RAG pipeline (lib/rag.ts) has improved error handling: if article retrieval or answer generation fails, users receive clear explanations and, if possible, a direct list of relevant sources instead of a generic failure.

Documentation Enhancements:

  • The README.md has been updated with additional feature highlights, including SEO optimization, RSS/Atom feeds, image optimization, PWA support, user authentication, favorites, view counts, responsive design, and more. The language describing the landing page was also made more positive.

…nd fallback responses

- Enhance RAG answer generation to handle retrieval and generation failures gracefully, providing helpful fallback messages and direct source links when needed
- Update API route to always return user-friendly responses instead of errors
- Expand README with details on contextual answers, citation linking, chat history, and graceful degradation features
@hoangsonww hoangsonww self-assigned this Mar 23, 2026
@hoangsonww hoangsonww added bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Mar 23, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
dev-verse-swe-blog Ignored Ignored Mar 23, 2026 2:41am

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 enhances the user experience by improving error handling across the chat and article retrieval functionalities, ensuring users always receive helpful and actionable feedback. Concurrently, the project's documentation has been updated to accurately reflect a broader range of features, providing a more complete and positive overview of the application's capabilities.

Highlights

  • Enhanced Error Handling in Chat API: The chat API now consistently returns user-friendly, actionable messages with a 200 status code, even when internal errors occur, preventing generic technical error displays.
  • Improved Chat UI Error Messaging: The chat user interface provides a more informative message to users if it cannot connect to the server, guiding them to check their connection or explore articles directly.
  • Refined RAG Pipeline Error Management: Error handling within the RAG pipeline has been improved to offer clearer explanations. If article retrieval or answer generation fails, users receive specific fallback messages or a direct list of relevant sources.
  • Comprehensive README Update: The README.md file has been significantly updated to highlight numerous new features, including SEO optimization, RSS/Atom feeds, PWA support, user authentication, and more, along with a more positive description of the landing page.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

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.

@hoangsonww hoangsonww merged commit ec85bed into master Mar 23, 2026
3 checks passed
Copy link
Copy Markdown

@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 significantly improves error handling in the chat features by providing more user-friendly and actionable messages. The changes in lib/rag.ts are particularly well-done, offering graceful degradation when parts of the RAG pipeline fail. The README has also been substantially updated to reflect the project's features. I have two suggestions: one to improve the objectivity of the README documentation, and a more significant architectural suggestion for the chat API to adhere to HTTP standards for error reporting, which will improve monitoring and maintainability.

Comment thread app/api/chat/route.ts
Comment on lines 39 to 46
return NextResponse.json(
{ error: "Failed to generate a response." },
{ status: 500 },
{
answer:
"I'm having trouble connecting to my knowledge base right now. Please try again in a moment, or browse the articles directly from the home page.",
sources: [],
},
{ status: 200 },
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Returning a 200 OK status for a server-side error, while user-friendly, violates HTTP semantics. This can make API health monitoring based on status codes unreliable and complicates client-side logic if it ever needs to programmatically distinguish between a valid answer and a server error message.

A more robust approach is to use an appropriate 5xx status code (e.g., 503 Service Unavailable) to signal a server failure. The client can then check for response.ok and handle the error case explicitly, extracting the friendly error message from the response body.

Suggested change
return NextResponse.json(
{ error: "Failed to generate a response." },
{ status: 500 },
{
answer:
"I'm having trouble connecting to my knowledge base right now. Please try again in a moment, or browse the articles directly from the home page.",
sources: [],
},
{ status: 200 },
);
return NextResponse.json(
{
answer:
"I'm having trouble connecting to my knowledge base right now. Please try again in a moment, or browse the articles directly from the home page.",
sources: [],
},
{ status: 503 },
);

Comment thread README.md
### UI & Navigation

- **Redesigned Landing Page:** Gradient accent hero, two-column layout, stat cards with icons, and CTA buttons for exploring articles or chatting with the AI.
- **Great Landing Page:** Gradient accent hero, two-column layout, stat cards with icons, and CTA buttons for exploring articles or chatting with the AI.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The term 'Great Landing Page' is subjective and less descriptive than the previous 'Redesigned Landing Page'. Consider using a more objective term that highlights the features or the action taken, such as 'Modern Landing Page' or reverting to 'Redesigned Landing Page', to maintain a professional and informative tone in the documentation.

Suggested change
- **Great Landing Page:** Gradient accent hero, two-column layout, stat cards with icons, and CTA buttons for exploring articles or chatting with the AI.
- **Redesigned Landing Page:** Gradient accent hero, two-column layout, stat cards with icons, and CTA buttons for exploring articles or chatting with the AI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Projects

Development

Successfully merging this pull request may close these issues.

1 participant