-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env.example
More file actions
94 lines (85 loc) · 4.09 KB
/
.env.example
File metadata and controls
94 lines (85 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# ============================================================
# CodeTrans — Environment Configuration
# ============================================================
# Backend port
BACKEND_PORT=5001
# ============================================================
# Inference Provider
# ============================================================
# "remote" — Cloud or enterprise OpenAI-compatible API (e.g. CodeLlama via gateway)
# "ollama" — Local Ollama running natively on the host machine (recommended for Mac)
INFERENCE_PROVIDER=remote
# ============================================================
# Option A: Remote OpenAI-compatible API (INFERENCE_PROVIDER=remote)
# ============================================================
# INFERENCE_API_ENDPOINT: Base URL of your inference service (no /v1 suffix)
# - GenAI Gateway: https://genai-gateway.example.com
# - APISIX Gateway: https://apisix-gateway.example.com/CodeLlama-34b-Instruct-hf
INFERENCE_API_ENDPOINT=https://your-api-endpoint.com/deployment
INFERENCE_API_TOKEN=your-pre-generated-token-here
INFERENCE_MODEL_NAME=codellama/CodeLlama-34b-Instruct-hf
# ============================================================
# Option B: Ollama — native host inference (INFERENCE_PROVIDER=ollama)
# ============================================================
#
# IMPORTANT — Why Ollama runs on the host, NOT in Docker:
# On macOS (Apple Silicon / M-series), running Ollama as a Docker container
# bypasses Metal GPU acceleration. The model falls back to CPU-only inference
# which is dramatically slower. Ollama must be installed natively so the Metal
# Performance Shaders (MPS) backend is used for hardware-accelerated inference.
#
# Setup:
# 1. Install Ollama: https://ollama.com/download
# 2. Pull your model (see options below)
# 3. Ollama starts automatically; confirm it is running:
# curl http://localhost:11434/api/tags
# 4. Set the variables below in your .env
#
# The backend container reaches host-side Ollama via the special DNS name
# `host.docker.internal` which Docker Desktop resolves to the Mac host.
# (On Linux with Docker Engine this requires the extra_hosts entry in docker-compose.yaml,
# which is already configured.)
#
# --- Production / high-quality translation ---
# INFERENCE_PROVIDER=ollama
# INFERENCE_API_ENDPOINT=http://host.docker.internal:11434
# INFERENCE_MODEL_NAME=codellama:34b
# ollama pull codellama:34b # ~20 GB, best quality
#
# --- Testing / SLM performance benchmarking ---
# INFERENCE_PROVIDER=ollama
# INFERENCE_API_ENDPOINT=http://host.docker.internal:11434
# INFERENCE_MODEL_NAME=codellama:7b
# ollama pull codellama:7b # ~4 GB, fast — use this for gauging SLM perf
#
# --- Other recommended code models ---
# ollama pull deepseek-coder:6.7b # ~4 GB, strong at code tasks
# ollama pull qwen2.5-coder:7b # ~4 GB, excellent multilingual code
# ollama pull codellama:13b # ~8 GB, good balance of speed vs quality
#
# Note: INFERENCE_API_TOKEN is not required when using Ollama.
# ============================================================
# LLM Settings
# ============================================================
LLM_TEMPERATURE=0.2
LLM_MAX_TOKENS=4096
# ============================================================
# Code Translation Settings
# ============================================================
MAX_CODE_LENGTH=8000
MAX_FILE_SIZE=10485760
# ============================================================
# CORS Configuration
# ============================================================
CORS_ALLOW_ORIGINS=["http://localhost:5173", "http://localhost:3000"]
# ============================================================
# Local URL Endpoint
# ============================================================
# Only needed if your remote API endpoint is a private domain mapped in /etc/hosts.
# Otherwise leave as "not-needed".
LOCAL_URL_ENDPOINT=not-needed
# ============================================================
# SSL Verification
# ============================================================
# Set to false only for development with self-signed certificates.
VERIFY_SSL=true