Skip to content

Commit cfab0cf

Browse files
feat(web): add isLanguageModelConfigured to service ping (#1296)
* feat(web): add isLanguageModelConfigured to service ping Fixes SOU-1278 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: add CHANGELOG entry for #1296 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 279bbb8 commit cfab0cf

5 files changed

Lines changed: 18 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111
- [EE] Added prompt caching for Ask Sourcebot. For Anthropic models, the static prompt prefix (tool definitions, system prompt, and conversation history) is marked with a cache breakpoint so it is billed at the provider's discounted cache-read rate on subsequent agent steps and follow-up turns. Toggle with `SOURCEBOT_CHAT_PROMPT_CACHING_ENABLED` (default `true`). [#1278](https://github.com/sourcebot-dev/sourcebot/pull/1278)
1212
- [EE] Added a cached-token breakdown to the Ask Sourcebot message details, showing what share of the input tokens were served from the model provider's prompt cache. [#1278](https://github.com/sourcebot-dev/sourcebot/pull/1278)
13+
- Added `isLanguageModelConfigured` to the service ping, indicating whether at least one language model is configured. [#1296](https://github.com/sourcebot-dev/sourcebot/pull/1296)
1314

1415
### Changed
1516
- Anthropic thinking mode (adaptive vs. extended) is now resolved from the model's capabilities via the Anthropic Models API instead of a hardcoded model list. [#1294](https://github.com/sourcebot-dev/sourcebot/pull/1294)

docs/docs/misc/service-ping.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The data contained within the Service Ping is limited to:
2323
| `mauCount` | `integer` | Monthly active users. |
2424
| `deploymentType` | `string` | Deployment flavor (e.g. `docker`, `helm`). |
2525
| `isTelemetryEnabled` | `boolean` | Whether anonymous product telemetry is enabled. |
26+
| `isLanguageModelConfigured` | `boolean` | Whether at least one language model is configured. |
2627
| `activationCode` | `string` | Activation code, if your instance has one bound. |
2728

2829

@@ -57,6 +58,7 @@ body: {
5758
"mauCount": 1,
5859
"deploymentType": "other",
5960
"isTelemetryEnabled": true,
61+
"isLanguageModelConfigured": true,
6062
"activationCode": "sb_act_3a925f51...."
6163
}
6264
```

packages/web/src/features/billing/CLAUDE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,13 @@ This applies to:
1616
- Adding, removing, or renaming fields on any `*RequestSchema` / `*ResponseSchema`.
1717
- Changing a field's type, nullability, or validation (e.g. `.optional()`, `.nullable()`, `.datetime()`).
1818
- Adding new route schemas.
19+
20+
## Keeping the Service Ping docs in sync
21+
22+
Whenever you change the `servicePingRequestSchema` (the `/ping` request payload) in `types.ts`, you MUST also update the user-facing Service Ping documentation:
23+
24+
```
25+
docs/docs/misc/service-ping.mdx
26+
```
27+
28+
This includes updating the field reference table and the example payload to reflect any added, removed, or renamed fields.

packages/web/src/features/billing/servicePing.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { createLogger, decryptActivationCode, env, SOURCEBOT_VERSION } from "@so
66
import { client } from "./client";
77
import { ServicePingRequest } from "./types";
88
import { ServiceErrorException } from "@/lib/serviceError";
9+
import { getConfiguredLanguageModels } from "@/features/chat/utils.server";
910

1011
const logger = createLogger('service-ping');
1112

@@ -65,6 +66,8 @@ export const syncWithLighthouse = async (orgId: number) => {
6566
? decryptActivationCode(license.activationCode)
6667
: undefined;
6768

69+
const isLanguageModelConfigured = (await getConfiguredLanguageModels()).length > 0;
70+
6871
const payload: ServicePingRequest = {
6972
installId: env.SOURCEBOT_INSTALL_ID,
7073
version: SOURCEBOT_VERSION,
@@ -76,6 +79,7 @@ export const syncWithLighthouse = async (orgId: number) => {
7679
mauCount,
7780
deploymentType: inferDeploymentType(),
7881
isTelemetryEnabled: env.SOURCEBOT_TELEMETRY_DISABLED === 'false',
82+
isLanguageModelConfigured,
7983
...(activationCode && { activationCode }),
8084
};
8185

packages/web/src/features/billing/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const servicePingRequestSchema = z.object({
1111
mauCount: z.number().int().nonnegative(),
1212
deploymentType: z.string(),
1313
isTelemetryEnabled: z.boolean(),
14+
isLanguageModelConfigured: z.boolean(),
1415
activationCode: z.string().optional(),
1516
});
1617
export type ServicePingRequest = z.infer<typeof servicePingRequestSchema>;

0 commit comments

Comments
 (0)