feat: Add reported context offset functionality and update related configurations

This commit is contained in:
extio-de
2026-05-15 22:37:57 +02:00
parent b5a98f5f27
commit 721986106c
6 changed files with 100 additions and 12 deletions

View File

@@ -25,6 +25,7 @@ The application is configured via `src/main/resources/application.properties`.
| `server.port` | `11434` | The port on which the bridge runs. |
| `bridge.upstream-base-url` | `http://localhost:5001` | The base URL of the upstream LLM server. |
| `bridge.version` | `0.24.0` | The ollama version to report. |
| `bridge.reported-context-offset` | `0` | Tokens to subtract from the downstream context length before reporting it to clients. |
## API Endpoints
@@ -68,11 +69,23 @@ This project is licensed under the Apache License 2.0. See the `LICENSE` file fo
./mvnw spring-boot:run
```
You can also override any of the bridge settings with JVM system properties, for example:
```bash
java -Dserver.port=11435 -Dbridge.upstream-base-url=http://localhost:5002 -Dbridge.version=0.24.1 -Dbridge.reported-context-offset=5000 -jar target/ollama-oai-bridge.jar
```
If you use VS Code GitHub Copilot BYOK, configure the Ollama provider to point at the bridge endpoint and keep the upstream server behind it.
Or, after building, you can use the provided `start.sh` script. Copy the generated `.jar` file from the `target/` directory and `start.sh` into the same directory, then run:
```bash
./start.sh
```
The `start.sh` launcher also accepts JVM `-D` options directly, so this works too:
```bash
./start.sh -Dserver.port=11435 -Dbridge.upstream-base-url=http://localhost:5002 -Dbridge.version=0.24.1 -Dbridge.reported-context-offset=5000
```
## Architecture
- **`GatewayProxyConfiguration`**: Sets up the Spring Cloud Gateway routes to proxy requests.