search and ai stabilization work, localization stablized.
This commit is contained in:
@@ -22,6 +22,7 @@ using StellaOps.Auth.ServerIntegration.Tenancy;
|
||||
using System.Collections.Immutable;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using static StellaOps.Localization.T;
|
||||
|
||||
namespace StellaOps.AdvisoryAI.WebService.Endpoints;
|
||||
|
||||
@@ -134,13 +135,13 @@ public static class ChatEndpoints
|
||||
if (!options.Value.Enabled)
|
||||
{
|
||||
return Results.Json(
|
||||
new ErrorResponse { Error = "Advisory chat is disabled", Code = "CHAT_DISABLED" },
|
||||
new ErrorResponse { Error = _t("advisoryai.error.chat_disabled"), Code = "CHAT_DISABLED" },
|
||||
statusCode: StatusCodes.Status503ServiceUnavailable);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.Query))
|
||||
{
|
||||
return Results.BadRequest(new ErrorResponse { Error = "Query cannot be empty", Code = "INVALID_QUERY" });
|
||||
return Results.BadRequest(new ErrorResponse { Error = _t("advisoryai.error.query_empty"), Code = "INVALID_QUERY" });
|
||||
}
|
||||
|
||||
tenantId ??= "default";
|
||||
@@ -235,7 +236,7 @@ public static class ChatEndpoints
|
||||
{
|
||||
httpContext.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
|
||||
await httpContext.Response.WriteAsJsonAsync(
|
||||
new ErrorResponse { Error = "Advisory chat is disabled", Code = "CHAT_DISABLED" },
|
||||
new ErrorResponse { Error = _t("advisoryai.error.chat_disabled"), Code = "CHAT_DISABLED" },
|
||||
ct);
|
||||
return;
|
||||
}
|
||||
@@ -244,7 +245,7 @@ public static class ChatEndpoints
|
||||
{
|
||||
httpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
|
||||
await httpContext.Response.WriteAsJsonAsync(
|
||||
new ErrorResponse { Error = "Query cannot be empty", Code = "INVALID_QUERY" },
|
||||
new ErrorResponse { Error = _t("advisoryai.error.query_empty"), Code = "INVALID_QUERY" },
|
||||
ct);
|
||||
return;
|
||||
}
|
||||
@@ -427,7 +428,7 @@ public static class ChatEndpoints
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(request.Query))
|
||||
{
|
||||
return Results.BadRequest(new ErrorResponse { Error = "Query cannot be empty", Code = "INVALID_QUERY" });
|
||||
return Results.BadRequest(new ErrorResponse { Error = _t("advisoryai.error.query_empty"), Code = "INVALID_QUERY" });
|
||||
}
|
||||
|
||||
var result = await intentRouter.RouteAsync(request.Query, ct);
|
||||
|
||||
Reference in New Issue
Block a user