diff --git a/.env.example b/.env.example index c38bf88bfb9..c788abc2fbe 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,11 @@ +# OPEN_WEBUI ENV VARS + # Ollama URL for the backend to connect # The path '/ollama' will be redirected to the specified backend URL -OLLAMA_BASE_URL='http://localhost:11434' +OLLAMA_BASE_URL='https://-3000.2.codesphere.com' # insert your workspace ID + +ENABLE_OLLAMA_API='True' +ENABLE_WEBSOCKET_SUPPORT='True' OPENAI_API_BASE_URL='' OPENAI_API_KEY='' @@ -10,4 +15,17 @@ OPENAI_API_KEY='' # DO NOT TRACK SCARF_NO_ANALYTICS=true DO_NOT_TRACK=true -ANONYMIZED_TELEMETRY=false \ No newline at end of file +ANONYMIZED_TELEMETRY=false + + +# OLLAMA ENV VARS +OLLAMA_HOST='0.0.0.0:3000' +OLLAMA_MODELS='/home/user/app/models' + + +# UV ENV VARS +UV_BIN_DIR='/home/user/app/.codesphere-internal/.uv' +UV_PYTHON_INSTALL_DIR='/home/user/app/.codesphere-internal/.uv/python' + + + diff --git a/.gitignore b/.gitignore index 32271f8087e..1cb4db18d7c 100644 --- a/.gitignore +++ b/.gitignore @@ -307,3 +307,6 @@ dist cypress/videos cypress/screenshots .vscode/settings.json + +# Ollama +models/ diff --git a/ci.yml b/ci.yml new file mode 100644 index 00000000000..794d1b13dd7 --- /dev/null +++ b/ci.yml @@ -0,0 +1,76 @@ +schemaVersion: v0.2 +prepare: + steps: + - name: Install codesphere-cli + command: nix build --extra-experimental-features nix-command + --extra-experimental-features flakes github:datata1/codesphere-cli && + nix-env -i ./result && rm -rf ./result + - name: Copy .env.codesphere to .env when .env not exists + command: cp -n .env.codesphere .env + - name: Set EnvVars + command: codesphere-cli set-env-vars + - name: Install Ollama + command: nix-env -iA nixpkgs.ollama + - name: Download llms + command: nohup ollama serve & sleep 5 && ollama pull llama3.2 + - name: Install uv and create Python venv + command: cd backend && if [ ! -d ".venv" ]; then nix-env -iA nixpkgs.uv && uv + venv --python 3.11; fi; + - name: Install Python dependencies + command: cd backend && uv pip install -r requirements.txt + - name: Update node + command: sudo n 22.10 + - name: Install node dependencies + command: npm i + - name: Build frontend + command: true || (export NODE_OPTIONS="--max-old-space-size=4096" && npm run + build) +test: + steps: [] +run: + frontend: + steps: + - name: update node + command: sudo n 22.10 && node --version + - name: Start frontend + command: export NODE_OPTIONS="--max-old-space-size=4096" && npm run preview -- + --host 0.0.0.0 --port 3000 + plan: 22 + replicas: 1 + isPublic: true + network: + path: / + stripPath: false + backend: + steps: + - name: Start Backend + command: npx serve & cd backend && source .venv/bin/activate && ./start.sh + plan: 22 + replicas: 1 + isPublic: true + network: + ports: + - port: 3000 + isPublic: true + - port: 8080 + isPublic: true + paths: + - port: 8080 + path: /api + stripPath: false + - port: 8080 + path: /ws + stripPath: false + - port: 8080 + path: /ollama + stripPath: false + - port: 8080 + path: /openai + stripPath: false + ollama: + steps: + - name: Run ollama + command: ollama serve + plan: 22 + replicas: 1 + isPublic: false diff --git a/vite.config.ts b/vite.config.ts index ed690f5023b..270b7f965cf 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -30,6 +30,9 @@ export default defineConfig({ ] }) ], + preview: { + allowedHosts: ['.2.codesphere.com'], + }, define: { APP_VERSION: JSON.stringify(process.env.npm_package_version), APP_BUILD_HASH: JSON.stringify(process.env.APP_BUILD_HASH || 'dev-build')