feat: add Russian localization and independent STT languages
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
"use client";
|
||||
import { useI18n } from "@/components/i18n";
|
||||
|
||||
|
||||
import { DispatchCard } from "@/components/artifacts/dispatch-card";
|
||||
import { MessageResponse } from "@/components/ai-elements/message";
|
||||
@@ -35,15 +37,15 @@ export function PdfJobCard({ part }: ArtifactPartProps) {
|
||||
* the same expand-on-demand idiom as research.
|
||||
*/
|
||||
export function PdfBriefCard({ output }: { output: unknown }) {
|
||||
const { t } = useI18n();
|
||||
const result = output as PdfResult | undefined;
|
||||
if (!result || typeof result.brief !== "string") {
|
||||
return (
|
||||
<div className="rounded-xl border bg-card p-4 text-sm text-muted-foreground">
|
||||
PDF reading completed, but the result could not be displayed.
|
||||
</div>
|
||||
{t("PDF reading completed, but the result could not be displayed.")}</div>
|
||||
);
|
||||
}
|
||||
const failed = result.brief.startsWith("PDF failed");
|
||||
const failed = result.brief.startsWith(t("PDF failed"));
|
||||
// Read = extract/render output entered the loop; consulted = every page
|
||||
// incl. search hits (the full audit set — the brief's citations may point
|
||||
// there). The ?? fallbacks tolerate pre-split persisted records.
|
||||
@@ -52,20 +54,19 @@ export function PdfBriefCard({ output }: { output: unknown }) {
|
||||
return (
|
||||
<div className="rounded-xl border bg-card p-4 text-card-foreground" data-testid="pdf-brief-card">
|
||||
<div className="mb-1 flex items-center gap-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
||||
PDF brief
|
||||
{failed && <span className="rounded bg-red-500/15 px-1.5 py-0.5 text-red-500">failed</span>}
|
||||
{t("PDF brief")}{failed && <span className="rounded bg-red-500/15 px-1.5 py-0.5 text-red-500">{t("failed")}</span>}
|
||||
</div>
|
||||
<div className="text-sm [&_p:first-child]:mt-0 [&_p:last-child]:mb-0">
|
||||
<MessageResponse>{result.brief}</MessageResponse>
|
||||
</div>
|
||||
{!failed && readList.length > 0 && (
|
||||
<div className="mt-3 border-t pt-2 text-xs text-muted-foreground">
|
||||
Pages read: {readList.join(", ")}
|
||||
{t("Pages read:")}{" "}{readList.join(", ")}
|
||||
</div>
|
||||
)}
|
||||
{!failed && consultedList.length > readList.length && (
|
||||
<div className="mt-3 border-t pt-2 text-xs text-muted-foreground">
|
||||
Pages consulted: {consultedList.join(", ")}
|
||||
{t("Pages consulted:")}{" "}{consultedList.join(", ")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -77,27 +78,26 @@ export function PdfBriefCard({ output }: { output: unknown }) {
|
||||
* the steer card (sub-agent result delivery) renders the same artifact.
|
||||
*/
|
||||
export function ResearchBriefCard({ output }: { output: unknown }) {
|
||||
const { t } = useI18n();
|
||||
const result = output as ResearchResult | undefined;
|
||||
if (!result || typeof result.brief !== "string") {
|
||||
return (
|
||||
<div className="rounded-xl border bg-card p-4 text-sm text-muted-foreground">
|
||||
Research completed, but the result could not be displayed.
|
||||
</div>
|
||||
{t("Research completed, but the result could not be displayed.")}</div>
|
||||
);
|
||||
}
|
||||
const failed = result.brief.startsWith("Research failed");
|
||||
const failed = result.brief.startsWith(t("Research failed"));
|
||||
return (
|
||||
<div className="rounded-xl border bg-card p-4 text-card-foreground" data-testid="research-brief-card">
|
||||
<div className="mb-1 flex items-center gap-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
||||
Research brief
|
||||
{failed && <span className="rounded bg-red-500/15 px-1.5 py-0.5 text-red-500">failed</span>}
|
||||
{t("Research brief")}{failed && <span className="rounded bg-red-500/15 px-1.5 py-0.5 text-red-500">{t("failed")}</span>}
|
||||
</div>
|
||||
<div className="text-sm [&_p:first-child]:mt-0 [&_p:last-child]:mb-0">
|
||||
<MessageResponse>{result.brief}</MessageResponse>
|
||||
</div>
|
||||
{result.sources.length > 0 && (
|
||||
<div className="mt-3 border-t pt-2">
|
||||
<div className="mb-1 text-xs font-medium uppercase tracking-wide text-muted-foreground">Sources</div>
|
||||
<div className="mb-1 text-xs font-medium uppercase tracking-wide text-muted-foreground">{t("Sources")}</div>
|
||||
<ul className="flex flex-col gap-0.5 text-xs">
|
||||
{result.sources.map((s) => (
|
||||
<li key={s.url} className="truncate">
|
||||
|
||||
Reference in New Issue
Block a user