-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
33 lines (24 loc) · 1.3 KB
/
config.py
File metadata and controls
33 lines (24 loc) · 1.3 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
"""PyCodeFlow configuration variables. Each value can be overridden by its environment variable."""
import os
# Absolute path of the directory containing this project.
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# Ollama server endpoint used for code generation.
# OLLAMA_URL = os.environ.get("OLLAMA_URL", "http://localhost:11434/api/generate")
# bartek
OLLAMA_URL = os.environ.get("OLLAMA_URL", "http://192.168.1.15:11434/api/generate")
# Default Ollama model used when generating code.
#DEFAULT_MODEL = os.environ.get("OLLAMA_MODEL", "qwen2.5:7b")
# bartek
DEFAULT_MODEL = os.environ.get("OLLAMA_MODEL", "qwen2.5-coder:3b")
# Directory where generated files are saved; relative paths resolve from BASE_DIR.
OUTPUT_DIR = os.environ.get("PYCODEFLOW_OUTPUT_DIR", "output")
# File that every session appends its log to; relative paths resolve from BASE_DIR.
LOG_FILE = os.environ.get("PYCODEFLOW_LOG_FILE", "pycodeflow.log")
# Seconds to wait for the Ollama response before giving up; falls back to 600 if invalid.
try:
REQUEST_TIMEOUT = int(os.environ.get("PYCODEFLOW_TIMEOUT", "600"))
except ValueError:
REQUEST_TIMEOUT = 600
def resolve(path):
"""Return path as-is if absolute, otherwise resolve it relative to BASE_DIR."""
return path if os.path.isabs(path) else os.path.join(BASE_DIR, path)