Skip to content
Draft
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
63 changes: 63 additions & 0 deletions .replit
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
modules = ["nodejs-20", "web", "python-3.11"]
[agent]
expertMode = true

[nix]
channel = "stable-25_05"

[workflows]
runButton = "Project"

[[workflows.workflow]]
name = "Project"
mode = "parallel"
author = "agent"

[[workflows.workflow.tasks]]
task = "workflow.run"
args = "Frontend Development Server"

[[workflows.workflow.tasks]]
task = "workflow.run"
args = "GPTME Backend Server"

[[workflows.workflow]]
name = "Frontend Development Server"
author = "agent"

[[workflows.workflow.tasks]]
task = "shell.exec"
args = "npm run dev"
waitForPort = 5000

[workflows.workflow.metadata]
outputType = "webview"

[[workflows.workflow]]
name = "GPTME Backend Server"
author = "agent"

[workflows.workflow.metadata]
outputType = "console"

[[workflows.workflow.tasks]]
task = "shell.exec"
args = "gptme-server serve --host 0.0.0.0 --port 8000 --cors-origin='https://7f6ff8a1-1713-4a98-b07c-f60efde412fa-00-2wa8f9apyn8my.worf.replit.dev'"
waitForPort = 8000

[[ports]]
localPort = 5000
externalPort = 80

[[ports]]
localPort = 5001
externalPort = 3001

[[ports]]
localPort = 8000
externalPort = 8000

[deployment]
deploymentTarget = "autoscale"
run = ["npx", "vite", "preview", "--port", "5000", "--host", "0.0.0.0"]
build = ["npm", "run", "build"]
44 changes: 44 additions & 0 deletions replit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# gptme-webui Project

## Overview
This is a React-based web UI for gptme, providing a fancy interface for chatting with LLMs. It's built with Vite, TypeScript, React, shadcn-ui, and Tailwind CSS. The project was successfully imported from GitHub and configured for the Replit environment.

## Current Status
- ✅ Dependencies installed successfully
- ✅ Development server configured for Replit (port 5000, host 0.0.0.0, allowedHosts: true)
- ✅ Frontend workflow running successfully
- ✅ All TypeScript/LSP errors resolved

## Architecture
- **Frontend**: React + TypeScript + Vite
- **UI Framework**: shadcn-ui + Radix UI components
- **Styling**: Tailwind CSS
- **State Management**: @legendapp/state + @tanstack/react-query
- **Routing**: React Router v6
- **Testing**: Jest + Playwright for E2E

## Project Structure
- `src/` - Main source directory
- `components/` - React components including UI library components
- `pages/` - Main application pages
- `contexts/` - React contexts for state management
- `hooks/` - Custom React hooks
- `utils/` - Utility functions
- `types/` - TypeScript type definitions
- `public/` - Static assets
- `e2e/` - End-to-end tests

## Development
- Development server runs on port 5000 with host 0.0.0.0
- Configured to work with Replit's proxy environment
- Uses hot module replacement for fast development

## Dependencies
- Main dependencies include React 18, various Radix UI components, TanStack Query, React Router
- Development dependencies include TypeScript, ESLint, Prettier, Jest, Playwright

## Recent Changes
- 2025-09-15: Initial import and Replit environment setup
- Updated vite.config.ts to use port 5000 and allow all hosts for Replit proxy
- Configured workflow for frontend development server
- Installed all npm dependencies
20 changes: 18 additions & 2 deletions src/utils/connectionConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const DEFAULT_API_URL = 'http://127.0.0.1:5700';
const DEFAULT_API_URL = 'https://7f6ff8a1-1713-4a98-b07c-f60efde412fa-00-2wa8f9apyn8my.worf.replit.dev:8000';

Check warning on line 1 in src/utils/connectionConfig.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `⏎·`

export interface ConnectionConfig {
baseUrl: string;
Expand Down Expand Up @@ -30,8 +30,24 @@
const storedBaseUrl = localStorage.getItem('gptme_baseUrl');
const storedUserToken = localStorage.getItem('gptme_userToken');

// Check if stored baseUrl is using old localhost URLs and update to use Replit domain
if (storedBaseUrl && (storedBaseUrl.includes('127.0.0.1') || storedBaseUrl.includes('localhost'))) {

Check warning on line 34 in src/utils/connectionConfig.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `storedBaseUrl·&&·(storedBaseUrl.includes('127.0.0.1')·||·storedBaseUrl.includes('localhost'))` with `⏎····storedBaseUrl·&&⏎····(storedBaseUrl.includes('127.0.0.1')·||·storedBaseUrl.includes('localhost'))⏎··`
const updatedUrl = DEFAULT_API_URL;
localStorage.setItem('gptme_baseUrl', updatedUrl);
console.log('[connectionConfig] Updated cached baseUrl from localhost to Replit domain');
}

// Determine the final baseUrl with domain correction
let finalBaseUrl = fragmentBaseUrl || storedBaseUrl || import.meta.env.VITE_API_URL || DEFAULT_API_URL;

Check warning on line 41 in src/utils/connectionConfig.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `⏎···`

Check warning on line 42 in src/utils/connectionConfig.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Delete `··`
// Force correction of any URLs still pointing to localhost
if (finalBaseUrl.includes('127.0.0.1') || finalBaseUrl.includes('localhost')) {
finalBaseUrl = DEFAULT_API_URL;
console.log('[connectionConfig] Corrected baseUrl from localhost to Replit domain');
}

return {
baseUrl: fragmentBaseUrl || storedBaseUrl || import.meta.env.VITE_API_URL || DEFAULT_API_URL,
baseUrl: finalBaseUrl,
authToken: fragmentUserToken || storedUserToken || null,
useAuthToken: Boolean(fragmentUserToken || storedUserToken),
};
Expand Down
10 changes: 8 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ export default defineConfig(({ mode }) => ({
server:
mode === 'development'
? {
host: '::',
port: 5701,
host: '0.0.0.0',
port: 5000,
allowedHosts: true,
watch: {
usePolling: true,
interval: 1000,
},
}
: undefined,
plugins: [react(), mode === 'development' && componentTagger()].filter(Boolean),
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@assets': fileURLToPath(new URL('./attached_assets', import.meta.url)),
},
},
}));
Loading