Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [0.8.4] - 2026-02-19
## [0.8.4...0.8.5] - 2026-02-19

### Added
- **Visual Table Designer**: A robust, interactive UI for creating tables. Define columns, data types, constraints, and foreign keys visually without writing SQL.
Expand All @@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Improved
- **Stability**: Fixed dashboard template loading issues to ensure reliable rendering on all platforms.

### Fixed
- https://github.com/dev-asterix/PgStudio/issues/56 - Resolved local AI model API implementation with support for http and custom port.

---

## [0.8.3] - 2026-02-14
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "postgres-explorer",
"displayName": "PgStudio (PostgreSQL Explorer)",
"version": "0.8.4",
"version": "0.8.5",
"description": "PostgreSQL database explorer for VS Code with notebook support",
"publisher": "ric-v",
"private": false,
Expand Down
18 changes: 14 additions & 4 deletions src/providers/chat/AiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import * as vscode from 'vscode';
import * as https from 'https';
import * as http from 'http';
import { ChatMessage } from './types';

export class AiService {
Expand Down Expand Up @@ -212,16 +213,23 @@ Make these questions relevant to the topic discussed and progressively more adva

async callDirectApi(provider: string, userMessage: string, config: vscode.WorkspaceConfiguration, customSystemPrompt?: string): Promise<{ text: string, usage?: string }> {
const apiKey = config.get<string>('aiApiKey');
if (!apiKey) {

// API key is required for most providers, but optional for custom endpoints
if (!apiKey && provider !== 'custom') {
throw new Error(`API Key is required for ${provider} provider. Please configure postgresExplorer.aiApiKey.`);
}

let endpoint = '';
let model = config.get<string>('aiModel');
let headers: any = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
'Content-Type': 'application/json'
};

// Only add Authorization header if API key is provided
if (apiKey) {
headers['Authorization'] = `Bearer ${apiKey}`;
}

let body: any = {};

const systemPrompt = customSystemPrompt !== undefined ? customSystemPrompt : this.buildSystemPrompt();
Expand Down Expand Up @@ -311,6 +319,7 @@ Make these questions relevant to the topic discussed and progressively more adva

const options: https.RequestOptions = {
hostname: url.hostname,
port: url.port || (url.protocol === 'https:' ? 443 : 80),
path: url.pathname + url.search,
method: 'POST',
headers: {
Expand All @@ -319,7 +328,8 @@ Make these questions relevant to the topic discussed and progressively more adva
}
};

const req = https.request(options, (res) => {
const protocol = url.protocol === 'https:' ? https : http;
const req = protocol.request(options, (res) => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
Expand Down
Loading