Skip to content

Commit 7996e3a

Browse files
Refactor HealthCheckResponse in Ask Arie API
- Removed mandatory fields and made several properties optional in the HealthCheckResponse interface. - Updated health check logic to reflect changes in the response structure, focusing on chat availability instead of database and OpenAI key checks.
1 parent 47d51e2 commit 7996e3a

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/lib/ask-arie.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ export interface HealthEndpoint {
1313

1414
export interface HealthCheckResponse {
1515
status: "ok" | "error";
16-
db_exists: boolean;
17-
openai_api_key_configured: boolean;
18-
duckdb_available: boolean;
19-
openai_available: boolean;
20-
live_pricing_available: boolean;
16+
chat_available?: boolean;
17+
duckdb_available?: boolean;
18+
openai_available?: boolean;
19+
live_pricing_available?: boolean;
2120
endpoints: HealthEndpoint[];
2221
}
2322

@@ -205,15 +204,14 @@ export async function checkAskArieHealth(): Promise<boolean> {
205204

206205
const data: HealthCheckResponse = await response.json();
207206
const serviceOk = data.status === "ok";
208-
const hasDatabase = data.db_exists === true;
209-
const hasOpenAI = data.openai_api_key_configured === true;
207+
const chatAvailable = data.chat_available === true;
210208

211209
const technicalEndpoint = data.endpoints?.find(
212210
(ep) => ep.path === "/technical/ask" && ep.method === "POST"
213211
);
214212
const endpointReady = technicalEndpoint?.status === "registered";
215213

216-
if (!(serviceOk && hasDatabase && hasOpenAI && endpointReady)) return false;
214+
if (!(serviceOk && chatAvailable && endpointReady)) return false;
217215
return (await checkTechnicalAccess()) === true;
218216
} catch {
219217
return false;

0 commit comments

Comments
 (0)