-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding model downloader to llmserver and load apikey dynamically (
#94) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Sma1lboy <[email protected]>
- Loading branch information
1 parent
71937dd
commit f86fae8
Showing
82 changed files
with
18,093 additions
and
17,367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: codefox | ||
root: <%= ENV["PWD"] %> | ||
|
||
on_project_start: tmux set-option -g prefix C-a | ||
|
||
windows: | ||
- backend: | ||
root: <%= ENV["PWD"] %>/backend | ||
panes: | ||
- backend: | ||
- echo "Backend Server (Ctrl+a 1 to focus, Ctrl+a r to restart)" | ||
- pnpm dev | ||
- frontend: | ||
root: <%= ENV["PWD"] %>/frontend | ||
layout: main-vertical | ||
panes: | ||
- frontend: | ||
- echo "Frontend Server (Ctrl+a 2 to focus, Ctrl+a r to restart)" | ||
- pnpm dev | ||
- codegen: | ||
- echo "Codegen Watch (Ctrl+a 2 to focus, Ctrl+a r to restart)" | ||
- pnpm generate:watch | ||
- llm: | ||
root: <%= ENV["PWD"] %>/llm-server | ||
panes: | ||
- llm: | ||
- echo "LLM Server (Ctrl+a 3 to focus, Ctrl+a r to restart)" | ||
- pnpm dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,125 @@ graph TD | |
classDef layerStyle fill:#f4f4f4,stroke:#666,stroke-width:1px,stroke-dasharray: 5 5 | ||
class Project_Generate_Layer layerStyle | ||
``` | ||
|
||
# CodeFox Development Guide | ||
|
||
## Prerequisites | ||
|
||
Before you begin, ensure you have the following installed: | ||
|
||
- Node.js >= 18.0.0 | ||
- PNPM 9.1.2 (`npm install -g [email protected]`) | ||
- Tmux >= 3.2 | ||
- Tmuxinator >= 3.0.0 (`gem install tmuxinator`) | ||
|
||
## Project Structure | ||
|
||
The project consists of three main components: | ||
|
||
``` | ||
codefox/ | ||
├── backend/ # NestJS backend server | ||
├── frontend/ # Next.js frontend application | ||
└── llm-server/ # LLM service | ||
``` | ||
|
||
## Installation | ||
|
||
1. Clone the repository: | ||
|
||
```bash | ||
git clone <repository-url> | ||
cd codefox | ||
``` | ||
|
||
2. Install dependencies: | ||
|
||
```bash | ||
pnpm install | ||
``` | ||
|
||
3. Set up environment variables: | ||
|
||
```bash | ||
# Copy and configure environment files for each service | ||
cp backend/.env.template backend/.env | ||
cp frontend/.env.template frontend/.env | ||
cp llm-server/.env.template llm-server/.env | ||
``` | ||
|
||
## Development | ||
|
||
### Using Tmuxinator (Recommended) | ||
|
||
The project includes a Tmuxinator configuration for easy development. This will start all services in separate windows with proper layouts: | ||
|
||
```bash | ||
pnpm dev:tmux | ||
``` | ||
|
||
This command will create: | ||
|
||
- Window 1: Backend server | ||
- Window 2: Frontend development server (left) and GraphQL codegen watcher (right) | ||
- Window 3: LLM server | ||
|
||
Tmux Navigation: | ||
|
||
- `Ctrl+a 1/2/3` - Switch between windows | ||
- `Ctrl+a r` - Restart current pane's service | ||
- `Ctrl+a d` - Detach from session | ||
|
||
### Manual Development | ||
|
||
If you prefer to run services individually: | ||
|
||
```bash | ||
# Start all services | ||
pnpm dev | ||
|
||
# Or start services individually | ||
pnpm dev:backend # Start backend only | ||
cd frontend && pnpm dev # Start frontend only | ||
cd llm-server && pnpm dev # Start LLM server only | ||
``` | ||
|
||
## Additional Commands | ||
|
||
```bash | ||
pnpm build # Build all packages | ||
pnpm lint # Run linting | ||
pnpm format # Format code | ||
pnpm test # Run tests | ||
``` | ||
|
||
## GraphQL Code Generation | ||
|
||
The frontend uses GraphQL with automatic type generation. The codegen watcher is automatically started in the Tmuxinator setup, but you can also run it manually: | ||
|
||
```bash | ||
cd frontend | ||
pnpm generate:watch | ||
``` | ||
|
||
## Troubleshooting | ||
|
||
If you encounter any issues: | ||
|
||
1. Ensure all environment variables are properly set | ||
2. Check if all required services are running | ||
3. Clear node_modules and reinstall dependencies: | ||
|
||
```bash | ||
pnpm clean | ||
pnpm install | ||
``` | ||
|
||
4. For Tmuxinator issues: | ||
- Ensure Tmux is running version 3.2 or higher | ||
- Check if the session is already running: `tmux ls` | ||
- Kill existing session if needed: `tmux kill-session -t codefox` | ||
|
||
## License | ||
|
||
ISC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
PORT=8080 | ||
JWT_SECRET="JACKSONCHENNAHEULALLEN" | ||
SALT_ROUNDS=123 | ||
SALT_ROUNDS=123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
PORT=8080 | ||
JWT_SECRET="JACKSONCHENNAHEULALLEN" | ||
SALT_ROUNDS=123 | ||
SALT_ROUNDS=123 | ||
OPENAI_BASE_URI="http://localhost:3001" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ lerna-debug.log* | |
|
||
# OS | ||
.DS_Store | ||
*.db | ||
|
||
# Tests | ||
/coverage | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
moduleFileExtensions: ['js', 'json', 'ts'], | ||
rootDir: 'src', | ||
testRegex: '.*\\.spec\\.ts$', | ||
transform: { | ||
'^.+\\.(t|j)s$': 'ts-jest', | ||
'^.+\\.(t|j)s$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: { | ||
allowJs: true, | ||
module: 'ESNext', | ||
}, | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
collectCoverageFrom: ['**/*.(t|j)s'], | ||
coverageDirectory: '../coverage', | ||
testEnvironment: 'node', | ||
moduleNameMapper: { | ||
'^src/(.*)$': '<rootDir>/$1', | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
}, | ||
modulePaths: ['<rootDir>'], | ||
moduleDirectories: ['node_modules', 'src'], | ||
testPathIgnorePatterns: ['/template'], | ||
transformIgnorePatterns: [ | ||
'node_modules/(?!(strip-json-comments|other-esm-packages)/)', | ||
], | ||
preset: 'ts-jest/presets/default-esm', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,16 @@ | |
"license": "UNLICENSED", | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"build": "nest build", | ||
"build": "pnpm run build:common && nest build", | ||
"build:common": "pnpm --filter codefox-common run build", | ||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"lint": "ts-prune \"{src,apps,libs,test}/**/*.ts\" && eslint \"{src,apps,libs,test}/**/*.ts\" --fix ", | ||
"start": "nest start --watch", | ||
"start:dev": "nest start --watch", | ||
"dev": "pnpm start:dev", | ||
"start:dev": "NODE_OPTIONS=\"--experimental-specifier-resolution=node\" nest start --watch", | ||
"dev": "pnpm run build:common && pnpm start:dev", | ||
"dev:backend": "pnpm start:dev", | ||
"start:debug": "nest start --debug --watch", | ||
"start:prod": "node dist/main", | ||
"start:prod": "node --experimental-specifier-resolution=node dist/main", | ||
"test": "jest --passWithNoTests", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage", | ||
|
@@ -55,6 +56,7 @@ | |
"markdown-to-txt": "^2.0.1", | ||
"normalize-path": "^3.0.0", | ||
"openai": "^4.77.0", | ||
"p-queue-es5": "^6.0.2", | ||
"reflect-metadata": "^0.2.2", | ||
"rxjs": "^7.8.1", | ||
"sqlite3": "^5.1.7", | ||
|
@@ -74,6 +76,7 @@ | |
"@types/supertest": "^6.0.0", | ||
"@typescript-eslint/eslint-plugin": "^8.0.0", | ||
"@typescript-eslint/parser": "^8.0.0", | ||
"codefox-common": "workspace:*", | ||
"eslint": "^8.57.1", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
|
@@ -89,4 +92,4 @@ | |
"tsconfig-paths": "^4.2.0", | ||
"typescript": "^5.1.3" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
backend/src/build-system/__tests__/test.copy-project-template.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { BuildSequence } from '../types'; | ||
import { executeBuildSequence, objectToMarkdown, writeToFile } from './utils'; | ||
|
||
describe('Build Sequence Test', () => { | ||
it('should execute build sequence successfully', async () => { | ||
const sequence: BuildSequence = { | ||
id: 'test-backend-sequence', | ||
version: '1.0.0', | ||
name: 'Spotify-like Music Web', | ||
description: 'Users can play music', | ||
databaseType: 'SQLite', | ||
steps: [ | ||
{ | ||
id: 'step-0', | ||
name: 'Project Initialization', | ||
parallel: false, | ||
nodes: [ | ||
{ | ||
id: 'op:PROJECT::STATE:SETUP', | ||
name: 'Project Folders Setup', | ||
}, | ||
], | ||
}, | ||
{ | ||
id: 'step-1', | ||
name: 'Initial Analysis', | ||
parallel: false, | ||
nodes: [ | ||
{ | ||
id: 'op:PRD', | ||
name: 'Project Requirements Document Node', | ||
}, | ||
], | ||
}, | ||
{ | ||
id: 'step-2', | ||
name: 'UX Base Document Generation', | ||
parallel: false, | ||
nodes: [ | ||
{ | ||
id: 'op:UX:SMD', | ||
name: 'UX Sitemap Document Node', | ||
requires: ['op:PRD'], | ||
}, | ||
], | ||
}, | ||
{ | ||
id: 'step-3', | ||
name: 'Parallel UX Processing', | ||
parallel: true, | ||
nodes: [ | ||
{ | ||
id: 'op:UX:SMS', | ||
name: 'UX Sitemap Structure Node', | ||
requires: ['op:UX:SMD'], | ||
}, | ||
{ | ||
id: 'op:UX:DATAMAP:DOC', | ||
name: 'UX DataMap Document Node', | ||
requires: ['op:UX:SMD'], | ||
}, | ||
], | ||
}, | ||
{ | ||
id: 'step-4', | ||
name: 'Parallel Project Structure', | ||
parallel: true, | ||
nodes: [ | ||
{ | ||
id: 'op:UX:SMS:LEVEL2', | ||
name: 'Level 2 UX Sitemap Structure Node details', | ||
requires: ['op:UX:SMS'], | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
const result = await executeBuildSequence('fullstack-code-gen', sequence); | ||
expect(result.success).toBe(true); | ||
expect(result.metrics).toBeDefined(); | ||
console.log(`Logs saved to: ${result.logFolderPath}`); | ||
}, 300000); | ||
}); |
Oops, something went wrong.