-
Notifications
You must be signed in to change notification settings - Fork 1
Added AI chat view #33
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds a comprehensive AI chat assistant feature to the PostgreSQL Explorer extension, along with significant refactoring of notebook creation commands to use reusable markdown utilities. The changes introduce modular services for chat functionality, improve error handling consistency, and enhance the user experience with rich notebook templates.
Key changes:
- New AI Chat View with support for multiple AI providers (VS Code LM, OpenAI, Anthropic, Gemini, custom)
- Database object mention system (@mentions) with schema introspection
- Chat session management with history and persistence
- Refactored notebook commands using new
MarkdownUtilshelper for consistent formatting - Centralized error handling across all commands
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/providers/chat/webviewHtml.ts | 2359-line webview HTML template with embedded CSS and JavaScript for chat UI |
| src/providers/chat/types.ts | Type definitions for chat messages, file attachments, DB mentions, and sessions |
| src/providers/chat/index.ts | Module exports for chat functionality |
| src/providers/chat/SessionService.ts | Service for managing chat session storage and persistence |
| src/providers/chat/DbObjectService.ts | Service for fetching and caching database object metadata |
| src/providers/chat/AiService.ts | Service for AI provider integration with multiple backends |
| src/providers/ChatViewProvider.ts | Main controller for the chat view with message handling |
| src/extension.ts | Integration of chat view and error handling updates |
| src/commands/helper.ts | New utilities for markdown generation and error handling (imported, not shown in diff) |
| Multiple command files | Refactored to use MarkdownUtils and centralized error handling |
| package.json | Version bump to 0.4.0 and main entry point change |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| FormatHelpers, | ||
| ErrorHandlers, | ||
| SQL_TEMPLATES, | ||
| ObjectUtils |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused imports FormatHelpers, ObjectUtils, SQL_TEMPLATES.
| FormatHelpers, | |
| ErrorHandlers, | |
| SQL_TEMPLATES, | |
| ObjectUtils | |
| ErrorHandlers |
| FormatHelpers, | ||
| ErrorHandlers, | ||
| SQL_TEMPLATES, | ||
| ObjectUtils |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused imports FormatHelpers, ObjectUtils, SQL_TEMPLATES.
| FormatHelpers, | |
| ErrorHandlers, | |
| SQL_TEMPLATES, | |
| ObjectUtils | |
| ErrorHandlers |
| FormatHelpers, | ||
| ErrorHandlers, | ||
| SQL_TEMPLATES, | ||
| ObjectUtils |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused imports FormatHelpers, ObjectUtils, SQL_TEMPLATES.
| FormatHelpers, | |
| ErrorHandlers, | |
| SQL_TEMPLATES, | |
| ObjectUtils | |
| ErrorHandlers |
This pull request refactors the notebook creation commands for PostgreSQL extensions and foreign tables to improve maintainability and user experience. The main changes introduce a new
MarkdownUtilshelper for generating markdown content, replace hardcoded HTML with reusable markdown utilities, enhance error handling, and expand the foreign table creation notebook with more comprehensive templates and guidelines.Markdown and Notebook Content Refactoring
Replaced hardcoded HTML strings in notebook markdown cells with reusable functions from the new
MarkdownUtilshelper, making the code more maintainable and markdown output more consistent. This affects commands for enabling extensions, extension operations, dropping extensions, and all foreign table operations. (src/commands/extensions.ts,src/commands/foreignTables.ts) [1] [2] [3] [4] [5] [6] [7] [8] [9]Expanded the foreign table creation notebook to include multiple templates (basic, PostgreSQL-to-PostgreSQL, file-based), design guidelines, common patterns, and management operations, providing users with richer documentation and ready-to-use code snippets. (
src/commands/foreignTables.ts)Error Handling Improvements
vscode.window.showErrorMessagewith a centralized error handler (ErrorHandlers.handleCommandError) for all notebook creation commands, ensuring consistent error reporting and easier maintenance. (src/commands/extensions.ts,src/commands/foreignTables.ts) [1] [2] [3] [4] [5] [6]Foreign Table Operations Enhancements
Added a new markdown cell for "Drop Foreign Table" in the foreign table operations notebook for clearer separation and documentation of destructive actions. (
src/commands/foreignTables.ts)Updated the operations table in the foreign table operations notebook to use the new markdown utility, improving readability and maintainability. (
src/commands/foreignTables.ts)These changes collectively improve code clarity, maintainability, and the quality of the notebook experience for users.