mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
# Description of Changes Redesign AI engine so that it autogenerates the `tool_models.py` file from the OpenAPI spec so the Python has access to the Java API parameters and the full list of Java tools that it can run. CI ensures that whenever someone modifies a tool endpoint that the AI enigne tool models get updated as well (the dev gets told to run `task engine:tool-models`). There's loads of advantages to having the Java be the one that actually executes the tools, rather than the frontend as it was previously set up to theoretically use: - The AI gets much better descriptions of the params from the API docs - It'll be usable headless in the future so a Java daemon could run to execute ops on files in a folder without the need for the UI to run - The Java already has all the logic it needs to execute the tools - We don't need to parse the TypeScript to find the API (which is hard because the TS wasn't designed to be computer-read to extract the API) I've also hooked up the prototype frontend to ensure it's working properly, and have built it in a way that all the tool names can be translated properly, which was always an issue with previous prototypes of this. --------- Co-authored-by: Anthony Stirling <[email protected]> Co-authored-by: EthanHealy01 <[email protected]>
129 lines
2.8 KiB
YAML
129 lines
2.8 KiB
YAML
version: '3'
|
|
|
|
tasks:
|
|
install:
|
|
desc: "Install engine dependencies"
|
|
run: once
|
|
cmds:
|
|
- uv python install 3.13.8
|
|
- uv sync
|
|
sources:
|
|
- uv.lock
|
|
- pyproject.toml
|
|
status:
|
|
- test -d .venv
|
|
|
|
prepare:
|
|
desc: "Set up engine .env from template"
|
|
deps: [install]
|
|
cmds:
|
|
- uv run scripts/setup_env.py
|
|
sources:
|
|
- scripts/setup_env.py
|
|
- config/.env.example
|
|
generates:
|
|
- .env
|
|
|
|
run:
|
|
desc: "Run engine server"
|
|
deps: [prepare]
|
|
ignore_error: true
|
|
dir: src
|
|
env:
|
|
PYTHONUNBUFFERED: "1"
|
|
cmds:
|
|
- uv run uvicorn stirling.api.app:app --host 0.0.0.0 --port 5001
|
|
|
|
dev:
|
|
desc: "Start engine dev server with hot reload"
|
|
deps: [prepare]
|
|
ignore_error: true
|
|
dir: src
|
|
env:
|
|
PYTHONUNBUFFERED: "1"
|
|
cmds:
|
|
- uv run uvicorn stirling.api.app:app --host 0.0.0.0 --port 5001 --reload
|
|
|
|
lint:
|
|
desc: "Run linting"
|
|
deps: [install]
|
|
cmds:
|
|
- uv run ruff check .
|
|
|
|
lint:fix:
|
|
desc: "Auto-fix lint issues"
|
|
deps: [install]
|
|
cmds:
|
|
- uv run ruff check . --fix
|
|
|
|
format:
|
|
desc: "Auto-fix code formatting"
|
|
deps: [install]
|
|
cmds:
|
|
- uv run ruff format .
|
|
|
|
format:check:
|
|
desc: "Check code formatting"
|
|
deps: [install]
|
|
cmds:
|
|
- uv run ruff format . --diff
|
|
|
|
typecheck:
|
|
desc: "Run type checking"
|
|
deps: [install]
|
|
cmds:
|
|
- uv run pyright . --warnings
|
|
|
|
test:
|
|
desc: "Run tests"
|
|
deps: [prepare]
|
|
cmds:
|
|
- uv run pytest tests
|
|
|
|
fix:
|
|
desc: "Auto-fix lint + format"
|
|
cmds:
|
|
- task: lint:fix
|
|
- task: format
|
|
|
|
check:
|
|
desc: "Full engine quality gate"
|
|
cmds:
|
|
- task: typecheck
|
|
- task: lint
|
|
- task: format:check
|
|
- task: test
|
|
|
|
tool-models:
|
|
desc: "Generate tool_models.py from Java OpenAPI spec (SwaggerDoc.json)"
|
|
deps: [install, ":backend:swagger"]
|
|
cmds:
|
|
- uv run python scripts/generate_tool_models.py --spec ../SwaggerDoc.json --output src/stirling/models/tool_models.py
|
|
sources:
|
|
- ../SwaggerDoc.json
|
|
- scripts/generate_tool_models.py
|
|
generates:
|
|
- src/stirling/models/tool_models.py
|
|
|
|
clean:
|
|
desc: "Clean build artifacts"
|
|
cmds:
|
|
- task: '{{if eq .OS "Windows_NT"}}clean-windows{{else}}clean-unix{{end}}'
|
|
|
|
clean-unix:
|
|
internal: true
|
|
desc: "Clean build artifacts"
|
|
cmds:
|
|
- rm -rf .venv data logs output
|
|
|
|
# On Windows, use PowerShell as bash failed to delete some dependencies
|
|
clean-windows:
|
|
internal: true
|
|
desc: "Clean build artifacts"
|
|
ignore_error: true
|
|
cmds:
|
|
- powershell rm -Recurse -Force -ErrorAction SilentlyContinue .venv
|
|
- powershell rm -Recurse -Force -ErrorAction SilentlyContinue data
|
|
- powershell rm -Recurse -Force -ErrorAction SilentlyContinue logs
|
|
- powershell rm -Recurse -Force -ErrorAction SilentlyContinue output
|