Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- [EE] Improved Ask Sourcebot prompt caching by splitting static and dynamic prompt sections and advancing cache breakpoints after every agent step instead of only after each message. [#1366](https://github.com/sourcebot-dev/sourcebot/pull/1366)
- Refactored Ask Sourcebot user message text extraction into a shared helper that robustly handles non-text message parts. [#1371](https://github.com/sourcebot-dev/sourcebot/pull/1371)
- Made the backend worker API address configurable via the `WORKER_API_URL` environment variable (default `http://localhost:3060`) instead of being hardcoded. [#1409](https://github.com/sourcebot-dev/sourcebot/pull/1409)

### Added
- Added per-step token cost tracking and estimated tool call token usage to Ask Sourcebot chat history. [#1353](https://github.com/sourcebot-dev/sourcebot/pull/1353)
Expand Down
4 changes: 3 additions & 1 deletion packages/backend/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import { SINGLE_TENANT_ORG_ID } from './constants.js';
import z from 'zod';

const logger = createLogger('api');
const PORT = 3060;

const workerApiUrl = new URL(env.WORKER_API_URL);
const PORT = Number(workerApiUrl.port) || (workerApiUrl.protocol === "https:" ? 443 : 80);

export class Api {
private server: http.Server;
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/env.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ const options = {
// Zoekt
ZOEKT_WEBSERVER_URL: z.string().url().default("http://localhost:6070"),

WORKER_API_URL: z.string().url().default("http://localhost:3060"),

// Auth
AUTH_SECRET: z.string(),
AUTH_URL: z.string().url(),
Expand Down
3 changes: 2 additions & 1 deletion packages/web/src/features/workerApi/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { unexpectedError } from "@/lib/serviceError";
import { withAuth, withOptionalAuth } from "@/middleware/withAuth";
import { withMinimumOrgRole } from "@/middleware/withMinimumOrgRole";
import { OrgRole } from "@sourcebot/db";
import { env } from "@sourcebot/shared";
import z from "zod";

const WORKER_API_URL = 'http://localhost:3060';
const WORKER_API_URL = env.WORKER_API_URL;

export const syncConnection = async (connectionId: number) => sew(() =>
withAuth(({ role }) =>
Expand Down
Loading