Browse Source

Add AI service health check and improve layout

pull/6828/head
Thomas Kaul 2 weeks ago
parent
commit
81d27df90d
  1. 2
      apps/api/src/app/health/health.controller.ts
  2. 6
      apps/client/src/app/pages/api/api-page.component.ts

2
apps/api/src/app/health/health.controller.ts

@ -52,7 +52,7 @@ export class HealthController {
): Promise<Response<AiServiceHealthResponse>> {
try {
const { text } = await this.aiService.generateText({
prompt: 'Reply with the word "OK" and nothing else.'
prompt: `Reply with the word "OK" and nothing else.`
});
if (text === 'OK') {

6
apps/client/src/app/pages/api/api-page.component.ts

@ -77,9 +77,11 @@ export class GfApiPageComponent implements OnInit {
private catchFetchFailure<T>(): OperatorFunction<T, T | FetchFailure> {
return catchError(({ error }: HttpErrorResponse) => {
const body = error as { status?: string };
const body = error as { message?: string; status?: string };
const status = body?.status ?? 'Error';
const fetchError = body?.message ? `${status}: ${body.message}` : status;
return of<FetchFailure>({ fetchError: body?.status ?? 'Error' });
return of<FetchFailure>({ fetchError });
}) as OperatorFunction<T, T | FetchFailure>;
}

Loading…
Cancel
Save