+
+
+
+ {preview && (
+
+ К импорту: {preview.count} документ(ов){preview.product ? `, продукт «${preview.product}»` : ", глобально"}.
+
+ )}
+ {result && (
+
+
+ Создано: {result.created} · Обновлено: {result.updated} · Без изменений: {result.unchanged}
+
+ {result.failed.length > 0 && (
+
+ {result.failed.map((item, index) => (
+ - {item.code ? `«${item.code}»: ` : ""}{item.detail}
+ ))}
+
+ )}
+
+ )}
+ {error && {error}
}
+
+
+
+
+
+ );
+}
diff --git a/apps/internal-ui/src/features/ai/detail/docApi.ts b/apps/internal-ui/src/features/ai/detail/docApi.ts
index 704b715..dfcc196 100644
--- a/apps/internal-ui/src/features/ai/detail/docApi.ts
+++ b/apps/internal-ui/src/features/ai/detail/docApi.ts
@@ -59,6 +59,21 @@ export type CreateDocInput = {
inclusionMode?: "MANDATORY" | "RETRIEVAL";
};
+export type ImportDocInput = {
+ code: string;
+ title: string;
+ category: string;
+ content: string;
+ inclusionMode?: "MANDATORY" | "RETRIEVAL";
+};
+
+export type ImportResult = {
+ created: number;
+ updated: number;
+ unchanged: number;
+ failed: Array<{ code: string; detail: string }>;
+};
+
function slugCode(title: string): string {
// SlugField хранит ASCII; кириллица отбрасывается → fallback на "doc".
const slug = title
@@ -75,3 +90,10 @@ export async function createDoc(kind: DocKind, input: CreateDocInput): Promise