@iblai/iblai-js 2.22.0 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -98407,7 +98407,9 @@ var datasetsTabAddResourceModal$3 = {
|
|
|
98407
98407
|
title: "Add Resources",
|
|
98408
98408
|
description: "Add knowledge to help your agent provide more relevant insights. Others with edit access can reuse these sources for more topics.",
|
|
98409
98409
|
googleDrivePickerError: "Google Drive Picker Error",
|
|
98410
|
-
forceClosePicker: "Force Close Picker"
|
|
98410
|
+
forceClosePicker: "Force Close Picker",
|
|
98411
|
+
notConfigured: "Not configured for this tenant",
|
|
98412
|
+
scrollRegionAriaLabel: "Resource types"
|
|
98411
98413
|
};
|
|
98412
98414
|
var datasetsTabDatasetItem$3 = {
|
|
98413
98415
|
scheduleRetrain: "Schedule retrain",
|
|
@@ -100325,7 +100327,11 @@ var resourceModalGithubFileUploadModal$3 = {
|
|
|
100325
100327
|
errorAddingDocument: "Error adding training document",
|
|
100326
100328
|
githubRepoUrlPlaceholder: "Github Repo URL",
|
|
100327
100329
|
selectBranchPlaceholder: "Select Branch",
|
|
100328
|
-
submit: "Submit"
|
|
100330
|
+
submit: "Submit",
|
|
100331
|
+
description: "Add a GitHub repository and pick a branch to train your agent on.",
|
|
100332
|
+
scrollRegionAriaLabel: "Repository details",
|
|
100333
|
+
repoUrlLabel: "Repository URL",
|
|
100334
|
+
branchLabel: "Branch"
|
|
100329
100335
|
};
|
|
100330
100336
|
var resourceModalLocalFileUploadModal$3 = {
|
|
100331
100337
|
fileNotFound: "File not found",
|
|
@@ -100339,7 +100345,9 @@ var resourceModalLocalFileUploadModal$3 = {
|
|
|
100339
100345
|
descriptionOptional: "Description (optional)",
|
|
100340
100346
|
descriptionPlaceholder: "Add a description for this image...",
|
|
100341
100347
|
submitting: "Submitting",
|
|
100342
|
-
submit: "Submit"
|
|
100348
|
+
submit: "Submit",
|
|
100349
|
+
description: "Upload a file to train your agent on its contents.",
|
|
100350
|
+
scrollRegionAriaLabel: "File upload"
|
|
100343
100351
|
};
|
|
100344
100352
|
var resourceModalUrlUploadModal$3 = {
|
|
100345
100353
|
urlPlaceholder: "URL",
|
|
@@ -100348,11 +100356,15 @@ var resourceModalUrlUploadModal$3 = {
|
|
|
100348
100356
|
invalidYoutubeUrl: "Invalid YouTube URL",
|
|
100349
100357
|
invalidBlackboardUrl: "Invalid Blackboard URL",
|
|
100350
100358
|
invalidUrl: "Invalid URL",
|
|
100351
|
-
submit: "Submit"
|
|
100359
|
+
submit: "Submit",
|
|
100360
|
+
description: "Add a link to train your agent on its content.",
|
|
100361
|
+
scrollRegionAriaLabel: "Link details",
|
|
100362
|
+
urlLabel: "URL"
|
|
100352
100363
|
};
|
|
100353
100364
|
var resourceModalWebsiteCrawlModal$3 = {
|
|
100354
|
-
title: "Web Crawler Configuration",
|
|
100355
100365
|
description: "Configure your web crawler settings and URL patterns",
|
|
100366
|
+
infoBox: "Crawl a website and train your agent on its pages. Set how deep to follow links, how many pages to fetch, and which URLs to include.",
|
|
100367
|
+
scrollRegionAriaLabel: "Web crawler settings",
|
|
100356
100368
|
formAriaLabel: "Web crawler configuration form",
|
|
100357
100369
|
urlRequired: "URL is required",
|
|
100358
100370
|
invalidUrl: "Invalid URL",
|
|
@@ -100367,6 +100379,9 @@ var resourceModalWebsiteCrawlModal$3 = {
|
|
|
100367
100379
|
selectPatternTypeAriaLabel: "Select pattern type",
|
|
100368
100380
|
globPattern: "Glob Pattern",
|
|
100369
100381
|
regularExpression: "Regular Expression",
|
|
100382
|
+
userAgentLabel: "User-Agent (optional)",
|
|
100383
|
+
userAgentPlaceholder: "Iblai-bot/1.0 (+https://ibl.ai/bot)",
|
|
100384
|
+
userAgentHelpText: "Optional. Overrides the default crawler User-Agent for every request. Leave blank to use the default.",
|
|
100370
100385
|
crawlerMatchPatternsLabel: "Crawler Match Patterns",
|
|
100371
100386
|
globPlaceholder: "https://example.com/",
|
|
100372
100387
|
regexPlaceholder: "(http|https)://www.example.com/(.*)",
|
|
@@ -105896,7 +105911,9 @@ var datasetsTabAddResourceModal$2 = {
|
|
|
105896
105911
|
title: "Ajouter des ressources",
|
|
105897
105912
|
description: "Ajoutez des connaissances pour aider votre agent à fournir des informations plus pertinentes. Les autres utilisateurs avec accès en modification peuvent réutiliser ces sources pour d'autres sujets.",
|
|
105898
105913
|
googleDrivePickerError: "Erreur du sélecteur Google Drive",
|
|
105899
|
-
forceClosePicker: "Forcer la fermeture du sélecteur"
|
|
105914
|
+
forceClosePicker: "Forcer la fermeture du sélecteur",
|
|
105915
|
+
notConfigured: "Non configuré pour ce locataire",
|
|
105916
|
+
scrollRegionAriaLabel: "Types de ressources"
|
|
105900
105917
|
};
|
|
105901
105918
|
var datasetsTabDatasetItem$2 = {
|
|
105902
105919
|
scheduleRetrain: "Planifier le réentraînement",
|
|
@@ -107814,7 +107831,11 @@ var resourceModalGithubFileUploadModal$2 = {
|
|
|
107814
107831
|
errorAddingDocument: "Erreur lors de l'ajout du document d'entraînement",
|
|
107815
107832
|
githubRepoUrlPlaceholder: "URL du dépôt GitHub",
|
|
107816
107833
|
selectBranchPlaceholder: "Sélectionner une branche",
|
|
107817
|
-
submit: "Soumettre"
|
|
107834
|
+
submit: "Soumettre",
|
|
107835
|
+
description: "Ajoutez un dépôt GitHub et choisissez une branche pour entraîner votre agent.",
|
|
107836
|
+
scrollRegionAriaLabel: "Détails du dépôt",
|
|
107837
|
+
repoUrlLabel: "URL du dépôt",
|
|
107838
|
+
branchLabel: "Branche"
|
|
107818
107839
|
};
|
|
107819
107840
|
var resourceModalLocalFileUploadModal$2 = {
|
|
107820
107841
|
fileNotFound: "Fichier introuvable",
|
|
@@ -107828,7 +107849,9 @@ var resourceModalLocalFileUploadModal$2 = {
|
|
|
107828
107849
|
descriptionOptional: "Description (facultative)",
|
|
107829
107850
|
descriptionPlaceholder: "Ajoutez une description pour cette image...",
|
|
107830
107851
|
submitting: "Envoi en cours",
|
|
107831
|
-
submit: "Soumettre"
|
|
107852
|
+
submit: "Soumettre",
|
|
107853
|
+
description: "Importez un fichier pour entraîner votre agent sur son contenu.",
|
|
107854
|
+
scrollRegionAriaLabel: "Import de fichier"
|
|
107832
107855
|
};
|
|
107833
107856
|
var resourceModalUrlUploadModal$2 = {
|
|
107834
107857
|
urlPlaceholder: "URL",
|
|
@@ -107837,11 +107860,15 @@ var resourceModalUrlUploadModal$2 = {
|
|
|
107837
107860
|
invalidYoutubeUrl: "URL YouTube invalide",
|
|
107838
107861
|
invalidBlackboardUrl: "URL Blackboard invalide",
|
|
107839
107862
|
invalidUrl: "URL invalide",
|
|
107840
|
-
submit: "Soumettre"
|
|
107863
|
+
submit: "Soumettre",
|
|
107864
|
+
description: "Ajoutez un lien pour entraîner votre agent sur son contenu.",
|
|
107865
|
+
scrollRegionAriaLabel: "Détails du lien",
|
|
107866
|
+
urlLabel: "URL"
|
|
107841
107867
|
};
|
|
107842
107868
|
var resourceModalWebsiteCrawlModal$2 = {
|
|
107843
|
-
title: "Configuration du robot d'exploration web",
|
|
107844
107869
|
description: "Configurez les paramètres et les modèles d'URL de votre robot d'exploration web",
|
|
107870
|
+
infoBox: "Explorez un site web et entraînez votre agent sur ses pages. Définissez la profondeur des liens, le nombre de pages à récupérer et les URL à inclure.",
|
|
107871
|
+
scrollRegionAriaLabel: "Paramètres du robot d'exploration",
|
|
107845
107872
|
formAriaLabel: "Formulaire de configuration du robot d'exploration web",
|
|
107846
107873
|
urlRequired: "L'URL est requise",
|
|
107847
107874
|
invalidUrl: "URL invalide",
|
|
@@ -107856,6 +107883,9 @@ var resourceModalWebsiteCrawlModal$2 = {
|
|
|
107856
107883
|
selectPatternTypeAriaLabel: "Sélectionner le type de modèle",
|
|
107857
107884
|
globPattern: "Modèle Glob",
|
|
107858
107885
|
regularExpression: "Expression régulière",
|
|
107886
|
+
userAgentLabel: "User-Agent (facultatif)",
|
|
107887
|
+
userAgentPlaceholder: "Iblai-bot/1.0 (+https://ibl.ai/bot)",
|
|
107888
|
+
userAgentHelpText: "Facultatif. Remplace le User-Agent par défaut du robot d'exploration pour chaque requête. Laissez vide pour utiliser celui par défaut.",
|
|
107859
107889
|
crawlerMatchPatternsLabel: "Modèles de correspondance du robot",
|
|
107860
107890
|
globPlaceholder: "https://example.com/",
|
|
107861
107891
|
regexPlaceholder: "(http|https)://www.example.com/(.*)",
|
|
@@ -113219,7 +113249,9 @@ var datasetsTabAddResourceModal$1 = {
|
|
|
113219
113249
|
title: "Agregar recursos",
|
|
113220
113250
|
description: "Agregue conocimiento para ayudar a su agente a proporcionar información más relevante. Otros usuarios con acceso de edición pueden reutilizar estas fuentes para más temas.",
|
|
113221
113251
|
googleDrivePickerError: "Error del selector de Google Drive",
|
|
113222
|
-
forceClosePicker: "Forzar cierre del selector"
|
|
113252
|
+
forceClosePicker: "Forzar cierre del selector",
|
|
113253
|
+
notConfigured: "No configurado para este inquilino",
|
|
113254
|
+
scrollRegionAriaLabel: "Tipos de recursos"
|
|
113223
113255
|
};
|
|
113224
113256
|
var datasetsTabDatasetItem$1 = {
|
|
113225
113257
|
scheduleRetrain: "Programar reentrenamiento",
|
|
@@ -115137,7 +115169,11 @@ var resourceModalGithubFileUploadModal$1 = {
|
|
|
115137
115169
|
errorAddingDocument: "Error al agregar el documento de entrenamiento",
|
|
115138
115170
|
githubRepoUrlPlaceholder: "URL del repositorio de GitHub",
|
|
115139
115171
|
selectBranchPlaceholder: "Seleccionar rama",
|
|
115140
|
-
submit: "Enviar"
|
|
115172
|
+
submit: "Enviar",
|
|
115173
|
+
description: "Agrega un repositorio de GitHub y elige una rama para entrenar a tu agente.",
|
|
115174
|
+
scrollRegionAriaLabel: "Detalles del repositorio",
|
|
115175
|
+
repoUrlLabel: "URL del repositorio",
|
|
115176
|
+
branchLabel: "Rama"
|
|
115141
115177
|
};
|
|
115142
115178
|
var resourceModalLocalFileUploadModal$1 = {
|
|
115143
115179
|
fileNotFound: "Archivo no encontrado",
|
|
@@ -115151,7 +115187,9 @@ var resourceModalLocalFileUploadModal$1 = {
|
|
|
115151
115187
|
descriptionOptional: "Descripción (opcional)",
|
|
115152
115188
|
descriptionPlaceholder: "Añade una descripción para esta imagen...",
|
|
115153
115189
|
submitting: "Enviando",
|
|
115154
|
-
submit: "Enviar"
|
|
115190
|
+
submit: "Enviar",
|
|
115191
|
+
description: "Sube un archivo para entrenar a tu agente con su contenido.",
|
|
115192
|
+
scrollRegionAriaLabel: "Carga de archivo"
|
|
115155
115193
|
};
|
|
115156
115194
|
var resourceModalUrlUploadModal$1 = {
|
|
115157
115195
|
urlPlaceholder: "URL",
|
|
@@ -115160,11 +115198,15 @@ var resourceModalUrlUploadModal$1 = {
|
|
|
115160
115198
|
invalidYoutubeUrl: "URL de YouTube no válida",
|
|
115161
115199
|
invalidBlackboardUrl: "URL de Blackboard no válida",
|
|
115162
115200
|
invalidUrl: "URL no válida",
|
|
115163
|
-
submit: "Enviar"
|
|
115201
|
+
submit: "Enviar",
|
|
115202
|
+
description: "Agrega un enlace para entrenar a tu agente con su contenido.",
|
|
115203
|
+
scrollRegionAriaLabel: "Detalles del enlace",
|
|
115204
|
+
urlLabel: "URL"
|
|
115164
115205
|
};
|
|
115165
115206
|
var resourceModalWebsiteCrawlModal$1 = {
|
|
115166
|
-
title: "Configuración del rastreador web",
|
|
115167
115207
|
description: "Configure los ajustes de su rastreador web y los patrones de URL",
|
|
115208
|
+
infoBox: "Rastrea un sitio web y entrena a tu agente con sus páginas. Define la profundidad de los enlaces, cuántas páginas obtener y qué URL incluir.",
|
|
115209
|
+
scrollRegionAriaLabel: "Configuración del rastreador web",
|
|
115168
115210
|
formAriaLabel: "Formulario de configuración del rastreador web",
|
|
115169
115211
|
urlRequired: "La URL es obligatoria",
|
|
115170
115212
|
invalidUrl: "URL no válida",
|
|
@@ -115179,6 +115221,9 @@ var resourceModalWebsiteCrawlModal$1 = {
|
|
|
115179
115221
|
selectPatternTypeAriaLabel: "Seleccionar tipo de patrón",
|
|
115180
115222
|
globPattern: "Patrón Glob",
|
|
115181
115223
|
regularExpression: "Expresión regular",
|
|
115224
|
+
userAgentLabel: "User-Agent (opcional)",
|
|
115225
|
+
userAgentPlaceholder: "Iblai-bot/1.0 (+https://ibl.ai/bot)",
|
|
115226
|
+
userAgentHelpText: "Opcional. Sustituye el User-Agent predeterminado del rastreador en cada solicitud. Déjalo en blanco para usar el predeterminado.",
|
|
115182
115227
|
crawlerMatchPatternsLabel: "Patrones de coincidencia del rastreador",
|
|
115183
115228
|
globPlaceholder: "https://example.com/",
|
|
115184
115229
|
regexPlaceholder: "(http|https)://www.example.com/(.*)",
|
|
@@ -120542,7 +120587,9 @@ var datasetsTabAddResourceModal = {
|
|
|
120542
120587
|
title: "添加资源",
|
|
120543
120588
|
description: "添加知识以帮助您的代理提供更相关的见解。其他具有编辑权限的用户可以为更多主题重复使用这些来源。",
|
|
120544
120589
|
googleDrivePickerError: "Google Drive 选择器错误",
|
|
120545
|
-
forceClosePicker: "强制关闭选择器"
|
|
120590
|
+
forceClosePicker: "强制关闭选择器",
|
|
120591
|
+
notConfigured: "未为此租户配置",
|
|
120592
|
+
scrollRegionAriaLabel: "资源类型"
|
|
120546
120593
|
};
|
|
120547
120594
|
var datasetsTabDatasetItem = {
|
|
120548
120595
|
scheduleRetrain: "安排重新训练",
|
|
@@ -122460,7 +122507,11 @@ var resourceModalGithubFileUploadModal = {
|
|
|
122460
122507
|
errorAddingDocument: "添加训练文档时出错",
|
|
122461
122508
|
githubRepoUrlPlaceholder: "GitHub 仓库 URL",
|
|
122462
122509
|
selectBranchPlaceholder: "选择分支",
|
|
122463
|
-
submit: "提交"
|
|
122510
|
+
submit: "提交",
|
|
122511
|
+
description: "添加 GitHub 仓库并选择分支来训练您的智能体。",
|
|
122512
|
+
scrollRegionAriaLabel: "仓库详情",
|
|
122513
|
+
repoUrlLabel: "仓库 URL",
|
|
122514
|
+
branchLabel: "分支"
|
|
122464
122515
|
};
|
|
122465
122516
|
var resourceModalLocalFileUploadModal = {
|
|
122466
122517
|
fileNotFound: "未找到文件",
|
|
@@ -122474,7 +122525,9 @@ var resourceModalLocalFileUploadModal = {
|
|
|
122474
122525
|
descriptionOptional: "描述(可选)",
|
|
122475
122526
|
descriptionPlaceholder: "为此图片添加描述...",
|
|
122476
122527
|
submitting: "提交中",
|
|
122477
|
-
submit: "提交"
|
|
122528
|
+
submit: "提交",
|
|
122529
|
+
description: "上传文件,用其内容训练您的智能体。",
|
|
122530
|
+
scrollRegionAriaLabel: "文件上传"
|
|
122478
122531
|
};
|
|
122479
122532
|
var resourceModalUrlUploadModal = {
|
|
122480
122533
|
urlPlaceholder: "URL",
|
|
@@ -122483,11 +122536,15 @@ var resourceModalUrlUploadModal = {
|
|
|
122483
122536
|
invalidYoutubeUrl: "无效的 YouTube URL",
|
|
122484
122537
|
invalidBlackboardUrl: "无效的 Blackboard URL",
|
|
122485
122538
|
invalidUrl: "无效的 URL",
|
|
122486
|
-
submit: "提交"
|
|
122539
|
+
submit: "提交",
|
|
122540
|
+
description: "添加链接,用其内容训练您的智能体。",
|
|
122541
|
+
scrollRegionAriaLabel: "链接详情",
|
|
122542
|
+
urlLabel: "URL"
|
|
122487
122543
|
};
|
|
122488
122544
|
var resourceModalWebsiteCrawlModal = {
|
|
122489
|
-
title: "网络爬虫配置",
|
|
122490
122545
|
description: "配置您的网络爬虫设置和 URL 模式",
|
|
122546
|
+
infoBox: "抓取网站并用其页面训练您的智能体。设置链接跟踪深度、抓取页面数量以及要包含的网址。",
|
|
122547
|
+
scrollRegionAriaLabel: "网络爬虫设置",
|
|
122491
122548
|
formAriaLabel: "网络爬虫配置表单",
|
|
122492
122549
|
urlRequired: "URL 为必填项",
|
|
122493
122550
|
invalidUrl: "无效的 URL",
|
|
@@ -122502,6 +122559,9 @@ var resourceModalWebsiteCrawlModal = {
|
|
|
122502
122559
|
selectPatternTypeAriaLabel: "选择模式类型",
|
|
122503
122560
|
globPattern: "Glob 模式",
|
|
122504
122561
|
regularExpression: "正则表达式",
|
|
122562
|
+
userAgentLabel: "User-Agent(可选)",
|
|
122563
|
+
userAgentPlaceholder: "Iblai-bot/1.0 (+https://ibl.ai/bot)",
|
|
122564
|
+
userAgentHelpText: "可选。为每个请求覆盖默认的抓取工具 User-Agent。留空则使用默认值。",
|
|
122505
122565
|
crawlerMatchPatternsLabel: "爬虫匹配模式",
|
|
122506
122566
|
globPlaceholder: "https://example.com/",
|
|
122507
122567
|
regexPlaceholder: "(http|https)://www.example.com/(.*)",
|
|
@@ -265078,7 +265138,7 @@ const ProjectFilesModal$1 = lazy(() => Promise.resolve().then(function () { retu
|
|
|
265078
265138
|
const AddMentorToProjectModal$1 = lazy(() => Promise.resolve().then(function () { return addMentorToProjectModal; }).then((mod) => ({
|
|
265079
265139
|
default: mod.AddMentorToProjectModal,
|
|
265080
265140
|
})));
|
|
265081
|
-
function ProjectLandingPage({ project, sessionId, onSubmit, onScreenSharingClick, isScreenSharingModalOpen, onPhoneCallClick, stopGenerating, tenantKey, username, enableSafetyDisclaimer, enableWebBrowsing, isStreaming, updateSessionTools, setSessionTools, activeTools, screenSharing, deepResearch, studyMode, imageGeneration, codeInterpreter, promptsIsEnabled, isPreviewMode, setMessage, mentorId, mentorUniqueId, projectId, googleSlidesIsEnabled, googleDocumentIsEnabled, artifactsEnabled, userIsStudent, isPublicRoute, navigateToProject, showExploreMentors = false, }) {
|
|
265141
|
+
function ProjectLandingPage({ project, sessionId, onSubmit, onScreenSharingClick, isScreenSharingModalOpen, onPhoneCallClick, stopGenerating, tenantKey, username, enableSafetyDisclaimer, enableWebBrowsing, isStreaming, updateSessionTools, setSessionTools, activeTools, screenSharing, deepResearch, studyMode, imageGeneration, codeInterpreter, promptsIsEnabled, isPreviewMode, setMessage, mentorId, mentorUniqueId, projectId, googleSlidesIsEnabled, googleDocumentIsEnabled, artifactsEnabled, userIsStudent, isPublicRoute, navigateToProject, showExploreMentors = false, disabledResourceTypes, maxUploadSizeMb, dropboxExtensions, }) {
|
|
265082
265142
|
var _a;
|
|
265083
265143
|
const [isInstructionsModalOpen, setIsInstructionsModalOpen] = useState(false);
|
|
265084
265144
|
const [isFilesModalOpen, setIsFilesModalOpen] = useState(false);
|
|
@@ -265091,7 +265151,7 @@ function ProjectLandingPage({ project, sessionId, onSubmit, onScreenSharingClick
|
|
|
265091
265151
|
name: mentor.name,
|
|
265092
265152
|
avatar: mentor.profile_image,
|
|
265093
265153
|
description: mentor.description,
|
|
265094
|
-
})), onAddMentorClick: () => setIsAddMentorModalOpen(true), showTitle: true, tenantKey: tenantKey, mentorId: mentorId, projectId: projectId, username: username, navigateToProject: navigateToProject }))] })] })] }), isInstructionsModalOpen && (jsx(Suspense, { fallback: null, children: jsx(ProjectInstructionsModal$1, { isOpen: isInstructionsModalOpen, onClose: () => setIsInstructionsModalOpen(false), tenantKey: tenantKey, projectId: projectId, username: username }) })), isFilesModalOpen && (jsx(Suspense, { fallback: null, children: jsx(ProjectFilesModal$1, { isOpen: isFilesModalOpen, onClose: () => setIsFilesModalOpen(false), tenantKey: tenantKey, mentorId: mentorId, username: username }) })), isAddMentorModalOpen && (jsx(Suspense, { fallback: null, children: jsx(AddMentorToProjectModal$1, { isOpen: isAddMentorModalOpen, onClose: () => setIsAddMentorModalOpen(false), projectName: project.name, tenantKey: tenantKey, projectId: projectId, username: username, isPublicRoute: isPublicRoute }) }))] }));
|
|
265154
|
+
})), onAddMentorClick: () => setIsAddMentorModalOpen(true), showTitle: true, tenantKey: tenantKey, mentorId: mentorId, projectId: projectId, username: username, navigateToProject: navigateToProject }))] })] })] }), isInstructionsModalOpen && (jsx(Suspense, { fallback: null, children: jsx(ProjectInstructionsModal$1, { isOpen: isInstructionsModalOpen, onClose: () => setIsInstructionsModalOpen(false), tenantKey: tenantKey, projectId: projectId, username: username }) })), isFilesModalOpen && (jsx(Suspense, { fallback: null, children: jsx(ProjectFilesModal$1, { isOpen: isFilesModalOpen, onClose: () => setIsFilesModalOpen(false), tenantKey: tenantKey, mentorId: mentorId, username: username, disabledResourceTypes: disabledResourceTypes, maxUploadSizeMb: maxUploadSizeMb, dropboxExtensions: dropboxExtensions }) })), isAddMentorModalOpen && (jsx(Suspense, { fallback: null, children: jsx(AddMentorToProjectModal$1, { isOpen: isAddMentorModalOpen, onClose: () => setIsAddMentorModalOpen(false), projectName: project.name, tenantKey: tenantKey, projectId: projectId, username: username, isPublicRoute: isPublicRoute }) }))] }));
|
|
265095
265155
|
}
|
|
265096
265156
|
|
|
265097
265157
|
function MinimumMentorAlert({ open, onOpenChange }) {
|
|
@@ -265364,8 +265424,9 @@ const TrainOrDeleteModal$1 = dynamic(() => Promise.resolve().then(function () {
|
|
|
265364
265424
|
*/
|
|
265365
265425
|
function isCrawlableDocType(documentType) {
|
|
265366
265426
|
const docType = documentType === null || documentType === void 0 ? void 0 : documentType.toLowerCase();
|
|
265367
|
-
// Uploaded documents
|
|
265368
|
-
|
|
265427
|
+
// Uploaded documents: generic local files ('file') plus the local resource
|
|
265428
|
+
// types that send their own fileType as the document type.
|
|
265429
|
+
const uploadedFileTypes = ['file', 'image', 'audio', 'video', 'zip'];
|
|
265369
265430
|
if (uploadedFileTypes.some((type) => docType === null || docType === void 0 ? void 0 : docType.includes(type))) {
|
|
265370
265431
|
return false;
|
|
265371
265432
|
}
|
|
@@ -265376,6 +265437,12 @@ function isCrawlableDocType(documentType) {
|
|
|
265376
265437
|
}
|
|
265377
265438
|
return true;
|
|
265378
265439
|
}
|
|
265440
|
+
/**
|
|
265441
|
+
* The crawler User-Agent override only applies to web crawler documents.
|
|
265442
|
+
*/
|
|
265443
|
+
function isWebCrawlerDocType(documentType) {
|
|
265444
|
+
return !!(documentType === null || documentType === void 0 ? void 0 : documentType.toLowerCase().includes('webcrawler'));
|
|
265445
|
+
}
|
|
265379
265446
|
function DatasetItem({ dataset, onSelect, isSelected, labels }) {
|
|
265380
265447
|
var _a, _b, _c, _d, _e;
|
|
265381
265448
|
const t = useT();
|
|
@@ -265452,7 +265519,7 @@ function DatasetItem({ dataset, onSelect, isSelected, labels }) {
|
|
|
265452
265519
|
}
|
|
265453
265520
|
}, className: "text-gray-500 hover:text-gray-700", disabled: isEditTrainingDocumentLoading || disabled, children: dataset.access === 'private' ? (jsxs(Fragment$1, { children: [jsx(EyeOff, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: t('datasetsTabDatasetItem.makePublic') })] })) : (jsxs(Fragment$1, { children: [jsx(Eye, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: t('datasetsTabDatasetItem.makePrivate') })] })) })) }) }), jsx(TableCell$1, { className: "p-3 whitespace-nowrap", children: jsx(WithFormPermissions, { name: "is_trained",
|
|
265454
265521
|
// @ts-ignore
|
|
265455
|
-
permissions: (_e = dataset === null || dataset === void 0 ? void 0 : dataset.permissions) === null || _e === void 0 ? void 0 : _e.field, children: ({ disabled }) => (jsx(TrainingStatusSwitch, { is_trained: dataset.is_trained, url: dataset.url, disabled: disabled, training_status: dataset.training_status, handleEditTrainingDocument: handleEditTrainingDocument, onUntrainSuccess: () => setIsDeleteDatasetModalOpen(true), onTrainRequest: () => setIsTrainOrDeleteModalOpen(true) })) }) })] }, dataset.id), isDeleteDatasetModalOpen && (jsx(DeleteDatasetModal$1, { isOpen: isDeleteDatasetModalOpen, onClose: () => setIsDeleteDatasetModalOpen(false), dataset: dataset, labels: labels })), isRetrainScheduleModalOpen && (jsx(RetrainScheduleModal$1, { isOpen: isRetrainScheduleModalOpen, onClose: () => setIsRetrainScheduleModalOpen(false), dataset: dataset, labels: labels })), isTrainOrDeleteModalOpen && (jsx(TrainOrDeleteModal$1, { isOpen: isTrainOrDeleteModalOpen, onClose: () => setIsTrainOrDeleteModalOpen(false), onTrain: handleTrainDataset, onDelete: handleDeleteFromTrainModal, showUserAgentField:
|
|
265522
|
+
permissions: (_e = dataset === null || dataset === void 0 ? void 0 : dataset.permissions) === null || _e === void 0 ? void 0 : _e.field, children: ({ disabled }) => (jsx(TrainingStatusSwitch, { is_trained: dataset.is_trained, url: dataset.url, disabled: disabled, training_status: dataset.training_status, handleEditTrainingDocument: handleEditTrainingDocument, onUntrainSuccess: () => setIsDeleteDatasetModalOpen(true), onTrainRequest: () => setIsTrainOrDeleteModalOpen(true) })) }) })] }, dataset.id), isDeleteDatasetModalOpen && (jsx(DeleteDatasetModal$1, { isOpen: isDeleteDatasetModalOpen, onClose: () => setIsDeleteDatasetModalOpen(false), dataset: dataset, labels: labels })), isRetrainScheduleModalOpen && (jsx(RetrainScheduleModal$1, { isOpen: isRetrainScheduleModalOpen, onClose: () => setIsRetrainScheduleModalOpen(false), dataset: dataset, labels: labels })), isTrainOrDeleteModalOpen && (jsx(TrainOrDeleteModal$1, { isOpen: isTrainOrDeleteModalOpen, onClose: () => setIsTrainOrDeleteModalOpen(false), onTrain: handleTrainDataset, onDelete: handleDeleteFromTrainModal, showUserAgentField: isWebCrawlerDocType(dataset.document_type), isLoading: isEditTrainingDocumentLoading, labels: labels }))] }));
|
|
265456
265523
|
}
|
|
265457
265524
|
function TrainingStatusSwitch({ is_trained, url, training_status, disabled, handleEditTrainingDocument, onUntrainSuccess, onTrainRequest, }) {
|
|
265458
265525
|
const t = useT();
|
|
@@ -265719,6 +265786,15 @@ const resourceTypes = [
|
|
|
265719
265786
|
accept: 'text/plain',
|
|
265720
265787
|
icon: (jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("rect", { width: "24", height: "24", rx: "4", fill: "url(#paint0_linear_text)" }), jsx("path", { d: "M7 7H17V9H13V17H11V9H7V7Z", fill: "white" }), jsx("defs", { children: jsxs("linearGradient", { id: "paint0_linear_text", x1: "0", y1: "0", x2: "24", y2: "24", gradientUnits: "userSpaceOnUse", children: [jsx("stop", { stopColor: "#4F46E5" }), jsx("stop", { offset: "1", stopColor: "#06B6D4" })] }) })] })),
|
|
265721
265788
|
},
|
|
265789
|
+
{
|
|
265790
|
+
id: 'markdown',
|
|
265791
|
+
name: 'Markdown',
|
|
265792
|
+
bgColor: 'bg-blue-100',
|
|
265793
|
+
isActive: true,
|
|
265794
|
+
type: 'local',
|
|
265795
|
+
accept: 'text/markdown,.md,.markdown',
|
|
265796
|
+
icon: (jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [jsx("rect", { width: "24", height: "24", rx: "4", fill: "#1F2937" }), jsx("path", { d: "M4 16V8h2l2 3 2-3h2v8H9.5v-4.6L8 13.7l-1.5-2.3V16H4Zm11.5 0L13 13h1.75V8h1.5v5H18l-2.5 3Z", fill: "white" })] })),
|
|
265797
|
+
},
|
|
265722
265798
|
{
|
|
265723
265799
|
id: 'audio',
|
|
265724
265800
|
name: 'Audio',
|
|
@@ -265780,6 +265856,26 @@ const resourceTypes = [
|
|
|
265780
265856
|
},
|
|
265781
265857
|
];
|
|
265782
265858
|
|
|
265859
|
+
/**
|
|
265860
|
+
* Shared chrome for the Add Resources picker and every per-type resource
|
|
265861
|
+
* dialog, mirroring the Datasets tab: a fixed header (title + description bar
|
|
265862
|
+
* with a divider), a body that scrolls on its own (`ResourceDialogBody`), and
|
|
265863
|
+
* an optional fixed footer (`ResourceDialogFooter`).
|
|
265864
|
+
*/
|
|
265865
|
+
function ResourceDialogContent({ title, description, className, children, }) {
|
|
265866
|
+
return (jsxs(DialogContent, { className: cn('flex max-h-[80vh] w-full max-w-lg flex-col gap-0 overflow-hidden p-0', className), children: [jsxs(DialogHeader, { className: "flex-shrink-0 space-y-1 border-b border-gray-200 bg-white px-4 pt-4 pr-10 pb-3 text-left", children: [jsx(DialogTitle, { className: "text-muted-foreground text-base", children: title }), jsx(DialogDescription, { className: "text-xs text-gray-600", children: description })] }), children] }));
|
|
265867
|
+
}
|
|
265868
|
+
/** The only scrolling part of a resource dialog; focusable so keyboard users can scroll it. */
|
|
265869
|
+
function ResourceDialogBody({ label, children }) {
|
|
265870
|
+
return (jsx("div", { className: "min-h-0 flex-1 space-y-4 overflow-x-hidden overflow-y-auto p-4", tabIndex: 0, role: "region", "aria-label": label, children: children }));
|
|
265871
|
+
}
|
|
265872
|
+
/** Actions pinned below the scroll region so they stay visible. */
|
|
265873
|
+
function ResourceDialogFooter({ children }) {
|
|
265874
|
+
return (jsx("div", { className: "flex flex-shrink-0 justify-end border-t border-gray-200 bg-white px-4 py-3", children: children }));
|
|
265875
|
+
}
|
|
265876
|
+
/** Submit button styling shared by every resource dialog footer. */
|
|
265877
|
+
const RESOURCE_SUBMIT_BUTTON_CLASS = 'bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-sm text-white hover:text-white hover:opacity-90';
|
|
265878
|
+
|
|
265783
265879
|
/**
|
|
265784
265880
|
* Spend-cap blocks (HTTP 429) carry the machine code in `error`/`error_code`
|
|
265785
265881
|
* and a friendly, learner-safe sentence in `message`. Detection keys on
|
|
@@ -265874,7 +265970,7 @@ function GithubFileUploadModal() {
|
|
|
265874
265970
|
const { branches, error, isLoading } = useGithubRepoDetails(debouncedGithubUrl, tenantKey);
|
|
265875
265971
|
const isLoadingDisabled = !githubUrl || isLoading || isAddTrainingDocumentLoading;
|
|
265876
265972
|
const isDisabled = isLoadingDisabled || !branch;
|
|
265877
|
-
return (jsxs("div", { className: "
|
|
265973
|
+
return (jsxs(Fragment$1, { children: [jsxs(ResourceDialogBody, { label: t('resourceModalGithubFileUploadModal.scrollRegionAriaLabel'), children: [jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: "github-repo-url", children: t('resourceModalGithubFileUploadModal.repoUrlLabel') }), jsx(Input, { id: "github-repo-url", type: "url", placeholder: t('resourceModalGithubFileUploadModal.githubRepoUrlPlaceholder'), value: githubUrl, onChange: (e) => setGithubUrl(e.target.value), autoComplete: "url", disabled: isAddTrainingDocumentLoading, "aria-describedby": error ? 'github-repo-url-error' : undefined, "aria-invalid": !!error }), error ? (jsx("p", { id: "github-repo-url-error", className: "text-destructive -mt-1 text-xs", role: "alert", children: error })) : null] }), jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: "github-branch", children: t('resourceModalGithubFileUploadModal.branchLabel') }), jsxs(Select$1, { value: branch, onValueChange: (value) => setBranch(value), disabled: isLoadingDisabled, children: [jsx(SelectTrigger, { id: "github-branch", className: "w-full", children: jsx(SelectValue, { placeholder: t('resourceModalGithubFileUploadModal.selectBranchPlaceholder') }) }), jsx(SelectContent, { children: branches.map((b) => (jsx(SelectItem, { value: b, children: b }, b))) })] })] })] }), jsx(ResourceDialogFooter, { children: jsx(Button$1, { onClick: handleSubmit, disabled: isDisabled, className: RESOURCE_SUBMIT_BUTTON_CLASS, children: t('resourceModalGithubFileUploadModal.submit') }) })] }));
|
|
265878
265974
|
}
|
|
265879
265975
|
|
|
265880
265976
|
/**
|
|
@@ -265994,18 +266090,18 @@ function LocalFileUploadModal({ resource, maxFileSizeMB = DEFAULT_MAX_FILE_SIZE_
|
|
|
265994
266090
|
handleUploadFile();
|
|
265995
266091
|
}
|
|
265996
266092
|
};
|
|
265997
|
-
return (jsxs(
|
|
265998
|
-
|
|
265999
|
-
|
|
266000
|
-
|
|
266001
|
-
|
|
266002
|
-
|
|
266003
|
-
|
|
266004
|
-
|
|
266005
|
-
|
|
266006
|
-
|
|
266007
|
-
|
|
266008
|
-
|
|
266093
|
+
return (jsxs(Fragment$1, { children: [jsx(ResourceDialogBody, { label: t('resourceModalLocalFileUploadModal.scrollRegionAriaLabel'), children: jsxs("div", { className: `w-full border-2 border-dashed ${isDraggingFile
|
|
266094
|
+
? 'border-blue-400 bg-blue-50/50 backdrop-blur-sm'
|
|
266095
|
+
: 'border-gray-300 bg-gray-50'} flex flex-col items-center justify-center rounded-lg p-8 transition-all duration-200 ${!isDraggingFile && 'hover:bg-gray-100'}`, onDragOver: handleDragOver, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [jsx("div", { className: "mb-4 rounded-full bg-blue-100 p-3", children: jsx(Upload, { className: "h-8 w-8 text-blue-600" }) }), jsx("h3", { className: "mb-1 text-lg font-medium text-gray-700", children: t('resourceModalLocalFileUploadModal.dragAndDrop') }), jsx("p", { className: "mb-4 text-sm text-gray-500", children: t('resourceModalLocalFileUploadModal.or') }), jsxs("label", { htmlFor: "file-upload", className: "cursor-pointer", children: [jsx("div", { className: "rounded-md bg-gradient-to-r from-blue-600 to-blue-400 px-4 py-2 font-medium text-white transition-colors hover:opacity-90", children: t('resourceModalLocalFileUploadModal.browseFiles') }), jsx("input", { id: "file-upload", type: "file", accept: resource.accept, className: "hidden", ref: fileInputRef, onChange: handleFileChange })] }), jsx("p", { className: "mt-4 text-xs text-gray-500", children: t('resourceModalLocalFileUploadModal.maximumFileSize', {
|
|
266096
|
+
value: maxFileSize.value,
|
|
266097
|
+
unit: maxFileSize.unit,
|
|
266098
|
+
}) }), file && (jsxs(Fragment$1, { children: [jsx("div", { className: "mt-4 flex w-full items-center rounded-md border border-gray-200 bg-white p-3", children: jsxs("div", { className: "flex w-full items-center", children: [jsx("div", { className: "mr-3 flex-shrink-0 rounded-md bg-blue-100 p-2", children: jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2Z", fill: "#4285F4" }), jsx("path", { d: "M14 2V8H20L14 2Z", fill: "#A1C2FA" })] }) }), jsxs("div", { className: "isolate z-50 min-w-0 flex-1 overflow-hidden", children: [jsx("p", { className: "truncate text-sm font-medium", children: file.name }), jsxs("p", { className: "text-xs text-gray-500", children: [convertFromBytes(file.size).value, " ", convertFromBytes(file.size).unit] })] }), jsx("button", { onClick: () => {
|
|
266099
|
+
setFile(null);
|
|
266100
|
+
setDescription('');
|
|
266101
|
+
if (fileInputRef.current) {
|
|
266102
|
+
fileInputRef.current.value = '';
|
|
266103
|
+
}
|
|
266104
|
+
}, className: "ml-2 flex-shrink-0 rounded-full p-1 transition-colors hover:bg-gray-100", children: jsx(X$2, { className: "h-4 w-4 text-gray-500" }) })] }) }), isImageFile(file) && (jsxs("div", { className: "mt-3 grid w-full gap-2", children: [jsx(Label$1, { htmlFor: "image-description", children: t('resourceModalLocalFileUploadModal.descriptionOptional') }), jsx(Textarea, { id: "image-description", value: description, onChange: (e) => setDescription(e.target.value), placeholder: t('resourceModalLocalFileUploadModal.descriptionPlaceholder'), className: "resize-none", rows: 3 })] }))] }))] }) }), jsx(ResourceDialogFooter, { children: jsx(Button$1, { onClick: handleSubmit, disabled: !file || isDisabled, className: RESOURCE_SUBMIT_BUTTON_CLASS, children: isAddTrainingDocumentLoading ? (jsxs(Fragment$1, { children: [jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" }), ' ', t('resourceModalLocalFileUploadModal.submitting')] })) : (jsx(Fragment$1, { children: t('resourceModalLocalFileUploadModal.submit') })) }) })] }));
|
|
266009
266105
|
}
|
|
266010
266106
|
|
|
266011
266107
|
function UrlUploadModal({ resource }) {
|
|
@@ -266074,9 +266170,7 @@ function UrlUploadModal({ resource }) {
|
|
|
266074
266170
|
handleSubmitUrl();
|
|
266075
266171
|
}
|
|
266076
266172
|
};
|
|
266077
|
-
return (jsxs("div", { className: "
|
|
266078
|
-
? 'bg-gradient-to-r from-blue-600 to-blue-400 text-white'
|
|
266079
|
-
: 'bg-gray-100 text-gray-500'), children: t('resourceModalUrlUploadModal.submit') }) })] }));
|
|
266173
|
+
return (jsxs(Fragment$1, { children: [jsx(ResourceDialogBody, { label: t('resourceModalUrlUploadModal.scrollRegionAriaLabel'), children: jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: "resource-url", children: t('resourceModalUrlUploadModal.urlLabel') }), jsx(Input, { id: "resource-url", type: "url", placeholder: t('resourceModalUrlUploadModal.urlPlaceholder'), value: url, onChange: handleUrlChange, autoComplete: "url" })] }) }), jsx(ResourceDialogFooter, { children: jsx(Button$1, { onClick: handleSubmit, disabled: !url || isDisabled, className: RESOURCE_SUBMIT_BUTTON_CLASS, children: t('resourceModalUrlUploadModal.submit') }) })] }));
|
|
266080
266174
|
}
|
|
266081
266175
|
|
|
266082
266176
|
function useWebsiteCrawlerResource(resource) {
|
|
@@ -266101,9 +266195,11 @@ function useWebsiteCrawlerResource(resource) {
|
|
|
266101
266195
|
crawler_match_patterns: [],
|
|
266102
266196
|
crawler_pattern_type: 'glob',
|
|
266103
266197
|
temp_crawler_match_patterns: '',
|
|
266198
|
+
crawler_user_agent: '',
|
|
266104
266199
|
},
|
|
266105
266200
|
onSubmit: async ({ value }) => {
|
|
266106
266201
|
try {
|
|
266202
|
+
const crawlerUserAgent = value.crawler_user_agent.trim();
|
|
266107
266203
|
await addTrainingDocument({
|
|
266108
266204
|
org: tenantKey,
|
|
266109
266205
|
formData: {
|
|
@@ -266115,6 +266211,11 @@ function useWebsiteCrawlerResource(resource) {
|
|
|
266115
266211
|
crawler_match_patterns: crawlerMatchPatterns,
|
|
266116
266212
|
//@ts-expect-error crawler_pattern_type may not be on the typed args but is accepted by the API
|
|
266117
266213
|
crawler_pattern_type: value.crawler_pattern_type,
|
|
266214
|
+
// Per-document User-Agent override; sent only when set so the
|
|
266215
|
+
// backend default applies otherwise.
|
|
266216
|
+
...(crawlerUserAgent
|
|
266217
|
+
? { crawler_extra_headers: { 'User-Agent': crawlerUserAgent } }
|
|
266218
|
+
: {}),
|
|
266118
266219
|
},
|
|
266119
266220
|
userId: username !== null && username !== void 0 ? username : '',
|
|
266120
266221
|
}).unwrap();
|
|
@@ -266141,30 +266242,30 @@ function useWebsiteCrawlerResource(resource) {
|
|
|
266141
266242
|
function WebsiteCrawlModal({ resource }) {
|
|
266142
266243
|
const t = useT();
|
|
266143
266244
|
const { form, handleCheckUrlIsValid, crawlerMatchPatterns, setCrawlerMatchPatterns } = useWebsiteCrawlerResource(resource);
|
|
266144
|
-
return (jsxs(
|
|
266145
|
-
|
|
266146
|
-
|
|
266147
|
-
|
|
266148
|
-
|
|
266245
|
+
return (jsxs("form", { className: "flex min-h-0 flex-1 flex-col", onSubmit: (e) => {
|
|
266246
|
+
e.preventDefault();
|
|
266247
|
+
e.stopPropagation();
|
|
266248
|
+
form.handleSubmit();
|
|
266249
|
+
}, "aria-label": t('resourceModalWebsiteCrawlModal.formAriaLabel'), children: [jsxs(ResourceDialogBody, { label: t('resourceModalWebsiteCrawlModal.scrollRegionAriaLabel'), children: [jsx("div", { className: "rounded-md border border-gray-200 bg-gray-50 p-3 text-xs text-gray-600", children: t('resourceModalWebsiteCrawlModal.infoBox') }), jsxs(Fragment$1, { children: [jsx(form.Field, { name: "url", validators: {
|
|
266149
266250
|
onChange: ({ value }) => (!value && t('resourceModalWebsiteCrawlModal.urlRequired')) ||
|
|
266150
266251
|
(!handleCheckUrlIsValid(value) && t('resourceModalWebsiteCrawlModal.invalidUrl')),
|
|
266151
266252
|
}, children: (field) => {
|
|
266152
266253
|
var _a, _b, _c;
|
|
266153
|
-
return (jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: field.name, children: t('resourceModalWebsiteCrawlModal.urlLabel') }), jsx(Input, { id: field.name, type: "url", value: field.state.value, onChange: (e) => field.handleChange(e.target.value), placeholder: t('resourceModalWebsiteCrawlModal.urlPlaceholder'), "aria-describedby": ((_a = field.state.meta.errors) === null || _a === void 0 ? void 0 : _a.length) ? `${field.name}-error` : undefined, "aria-invalid": !!((_b = field.state.meta.errors) === null || _b === void 0 ? void 0 : _b.length), "aria-required": "true" }), ((_c = field.state.meta.errors) === null || _c === void 0 ? void 0 : _c.length) ? (jsx("p", { id: `${field.name}-error`, className: "text-destructive
|
|
266254
|
+
return (jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: field.name, children: t('resourceModalWebsiteCrawlModal.urlLabel') }), jsx(Input, { id: field.name, type: "url", value: field.state.value, onChange: (e) => field.handleChange(e.target.value), placeholder: t('resourceModalWebsiteCrawlModal.urlPlaceholder'), "aria-describedby": ((_a = field.state.meta.errors) === null || _a === void 0 ? void 0 : _a.length) ? `${field.name}-error` : undefined, "aria-invalid": !!((_b = field.state.meta.errors) === null || _b === void 0 ? void 0 : _b.length), "aria-required": "true" }), ((_c = field.state.meta.errors) === null || _c === void 0 ? void 0 : _c.length) ? (jsx("p", { id: `${field.name}-error`, className: "text-destructive -mt-1 text-xs", role: "alert", children: field.state.meta.errors })) : null] }));
|
|
266154
266255
|
} }), jsxs("div", { className: "grid grid-cols-2 gap-4", children: [jsx(form.Field, { name: "crawler_max_depth", validators: {
|
|
266155
266256
|
onChange: ({ value }) => (!value && t('resourceModalWebsiteCrawlModal.fieldRequired')) ||
|
|
266156
266257
|
(value < 1 && t('resourceModalWebsiteCrawlModal.mustBeGreaterThanZero')) ||
|
|
266157
266258
|
(value > 10000 && t('resourceModalWebsiteCrawlModal.mustBeLessThan10000')),
|
|
266158
266259
|
}, children: (field) => {
|
|
266159
266260
|
var _a, _b, _c;
|
|
266160
|
-
return (jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: field.name, children: t('resourceModalWebsiteCrawlModal.maxCrawlDepthLabel') }), jsx(Input, { id: field.name, type: "number", min: "1", max: "10000", value: field.state.value, onChange: (e) => field.handleChange(Number.parseInt(e.target.value)), "aria-describedby": ((_a = field.state.meta.errors) === null || _a === void 0 ? void 0 : _a.length) ? `${field.name}-error` : undefined, "aria-invalid": !!((_b = field.state.meta.errors) === null || _b === void 0 ? void 0 : _b.length), "aria-required": "true" }), ((_c = field.state.meta.errors) === null || _c === void 0 ? void 0 : _c.length) ? (jsx("p", { id: `${field.name}-error`, className: "text-destructive
|
|
266261
|
+
return (jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: field.name, children: t('resourceModalWebsiteCrawlModal.maxCrawlDepthLabel') }), jsx(Input, { id: field.name, type: "number", min: "1", max: "10000", value: field.state.value, onChange: (e) => field.handleChange(Number.parseInt(e.target.value)), "aria-describedby": ((_a = field.state.meta.errors) === null || _a === void 0 ? void 0 : _a.length) ? `${field.name}-error` : undefined, "aria-invalid": !!((_b = field.state.meta.errors) === null || _b === void 0 ? void 0 : _b.length), "aria-required": "true" }), ((_c = field.state.meta.errors) === null || _c === void 0 ? void 0 : _c.length) ? (jsx("p", { id: `${field.name}-error`, className: "text-destructive -mt-1 text-xs", role: "alert", children: field.state.meta.errors })) : null] }));
|
|
266161
266262
|
} }), jsx(form.Field, { name: "crawler_max_pages_limit", validators: {
|
|
266162
266263
|
onChange: ({ value }) => (!value && t('resourceModalWebsiteCrawlModal.fieldRequired')) ||
|
|
266163
266264
|
(value < 1 && t('resourceModalWebsiteCrawlModal.mustBeGreaterThanZero')),
|
|
266164
266265
|
}, children: (field) => {
|
|
266165
266266
|
var _a, _b, _c;
|
|
266166
|
-
return (jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: field.name, children: t('resourceModalWebsiteCrawlModal.maxPagesLimitLabel') }), jsx(Input, { id: field.name, type: "number", min: "1", value: field.state.value, onChange: (e) => field.handleChange(Number.parseInt(e.target.value)), "aria-describedby": ((_a = field.state.meta.errors) === null || _a === void 0 ? void 0 : _a.length) ? `${field.name}-error` : undefined, "aria-invalid": !!((_b = field.state.meta.errors) === null || _b === void 0 ? void 0 : _b.length), "aria-required": "true" }), ((_c = field.state.meta.errors) === null || _c === void 0 ? void 0 : _c.length) ? (jsx("p", { id: `${field.name}-error`, className: "text-destructive
|
|
266167
|
-
} })] }), jsx(form.Field, { name: "crawler_pattern_type", children: (field) => (jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: "pattern-type", children: t('resourceModalWebsiteCrawlModal.patternTypeLabel') }), jsxs(Select$1, { value: field.state.value, onValueChange: (value) => field.handleChange(value), children: [jsx(SelectTrigger, { id: "pattern-type", "aria-label": t('resourceModalWebsiteCrawlModal.selectPatternTypeAriaLabel'), children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "glob", children: t('resourceModalWebsiteCrawlModal.globPattern') }), jsx(SelectItem, { value: "regex", children: t('resourceModalWebsiteCrawlModal.regularExpression') })] })] })] })) }), jsx(form.Subscribe, { selector: (state) => [
|
|
266267
|
+
return (jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: field.name, children: t('resourceModalWebsiteCrawlModal.maxPagesLimitLabel') }), jsx(Input, { id: field.name, type: "number", min: "1", value: field.state.value, onChange: (e) => field.handleChange(Number.parseInt(e.target.value)), "aria-describedby": ((_a = field.state.meta.errors) === null || _a === void 0 ? void 0 : _a.length) ? `${field.name}-error` : undefined, "aria-invalid": !!((_b = field.state.meta.errors) === null || _b === void 0 ? void 0 : _b.length), "aria-required": "true" }), ((_c = field.state.meta.errors) === null || _c === void 0 ? void 0 : _c.length) ? (jsx("p", { id: `${field.name}-error`, className: "text-destructive -mt-1 text-xs", role: "alert", children: field.state.meta.errors })) : null] }));
|
|
266268
|
+
} })] }), jsx(form.Field, { name: "crawler_pattern_type", children: (field) => (jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: "pattern-type", children: t('resourceModalWebsiteCrawlModal.patternTypeLabel') }), jsxs(Select$1, { value: field.state.value, onValueChange: (value) => field.handleChange(value), children: [jsx(SelectTrigger, { id: "pattern-type", "aria-label": t('resourceModalWebsiteCrawlModal.selectPatternTypeAriaLabel'), children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "glob", children: t('resourceModalWebsiteCrawlModal.globPattern') }), jsx(SelectItem, { value: "regex", children: t('resourceModalWebsiteCrawlModal.regularExpression') })] })] })] })) }), jsx(form.Field, { name: "crawler_user_agent", children: (field) => (jsxs("div", { className: "grid gap-2", children: [jsx(Label$1, { htmlFor: field.name, children: t('resourceModalWebsiteCrawlModal.userAgentLabel') }), jsx(Input, { id: field.name, type: "text", value: field.state.value, onChange: (e) => field.handleChange(e.target.value), placeholder: t('resourceModalWebsiteCrawlModal.userAgentPlaceholder'), "aria-describedby": "user-agent-help" }), jsx("p", { id: "user-agent-help", className: "text-muted-foreground -mt-1 text-xs", children: t('resourceModalWebsiteCrawlModal.userAgentHelpText') })] })) }), jsx(form.Subscribe, { selector: (state) => [
|
|
266168
266269
|
state.values.temp_crawler_match_patterns,
|
|
266169
266270
|
state.values.crawler_pattern_type,
|
|
266170
266271
|
], children: ([tempCrawlerMatchPatterns, crawlerPatternType]) => (jsx(form.Field, { name: "temp_crawler_match_patterns", validators: {
|
|
@@ -266195,14 +266296,24 @@ function WebsiteCrawlModal({ resource }) {
|
|
|
266195
266296
|
]);
|
|
266196
266297
|
field.handleChange('');
|
|
266197
266298
|
}
|
|
266198
|
-
}, disabled: !String(tempCrawlerMatchPatterns).trim(), size: "sm", "aria-label": t('resourceModalWebsiteCrawlModal.addPatternAriaLabel'), children: jsx(Plus, { className: "h-4 w-4" }) })] }), ((_c = field.state.meta.errors) === null || _c === void 0 ? void 0 : _c.length) ? (jsx("p", { id: "pattern-error", className: "text-destructive
|
|
266199
|
-
} })) }), jsx(form.Subscribe, { selector: (state) => [state.isSubmitting], children: ([isSubmitting]) => (jsxs(
|
|
266200
|
-
|
|
266201
|
-
|
|
266202
|
-
}
|
|
266203
|
-
|
|
266204
|
-
|
|
266205
|
-
|
|
266299
|
+
}, disabled: !String(tempCrawlerMatchPatterns).trim(), size: "sm", "aria-label": t('resourceModalWebsiteCrawlModal.addPatternAriaLabel'), children: jsx(Plus, { className: "h-4 w-4" }) })] }), ((_c = field.state.meta.errors) === null || _c === void 0 ? void 0 : _c.length) ? (jsx("p", { id: "pattern-error", className: "text-destructive -mt-1 text-xs", role: "alert", children: field.state.meta.errors })) : null, jsx("p", { id: "pattern-help", className: "text-muted-foreground -mt-1 text-xs", children: t('resourceModalWebsiteCrawlModal.patternHelpText') }), jsx("div", { className: "bg-muted/50 flex min-h-[2rem] flex-wrap gap-2 rounded-md border p-2", role: "list", "aria-label": t('resourceModalWebsiteCrawlModal.addedPatternsAriaLabel'), children: crawlerMatchPatterns.length === 0 ? (jsx("span", { className: "text-muted-foreground text-xs", children: t('resourceModalWebsiteCrawlModal.noPatternsAdded') })) : (crawlerMatchPatterns.map((pattern, index) => (jsxs(Badge, { variant: "secondary", className: "flex items-center gap-1", children: [jsx("span", { className: "text-xs", children: pattern }), jsx("button", { type: "button", onClick: () => setCrawlerMatchPatterns(crawlerMatchPatterns.filter((p) => p !== pattern)), className: "hover:bg-destructive/20 ml-1 rounded-full p-0.5", "aria-label": t('resourceModalWebsiteCrawlModal.removePatternAriaLabel', { pattern }), children: jsx(X$2, { className: "h-3 w-3" }) })] }, index)))) })] })] }));
|
|
266300
|
+
} })) })] })] }), jsx(form.Subscribe, { selector: (state) => [state.isSubmitting], children: ([isSubmitting]) => (jsxs(ResourceDialogFooter, { children: [jsx(Button$1, { type: "submit", className: RESOURCE_SUBMIT_BUTTON_CLASS, disabled: isSubmitting, "aria-describedby": isSubmitting ? 'submitting-status' : undefined, children: isSubmitting
|
|
266301
|
+
? t('resourceModalWebsiteCrawlModal.submitting')
|
|
266302
|
+
: t('resourceModalWebsiteCrawlModal.submit') }), isSubmitting && (jsx("div", { id: "submitting-status", className: "sr-only", role: "status", "aria-live": "polite", children: t('resourceModalWebsiteCrawlModal.formBeingSubmitted') }))] })) })] }));
|
|
266303
|
+
}
|
|
266304
|
+
|
|
266305
|
+
// `link` types open a cloud picker instead of this dialog; it maps to the
|
|
266306
|
+
// generic Add Resources copy only to keep the record total.
|
|
266307
|
+
const DESCRIPTION_KEYS = {
|
|
266308
|
+
github: 'resourceModalGithubFileUploadModal.description',
|
|
266309
|
+
local: 'resourceModalLocalFileUploadModal.description',
|
|
266310
|
+
url: 'resourceModalUrlUploadModal.description',
|
|
266311
|
+
webcrawler: 'resourceModalWebsiteCrawlModal.description',
|
|
266312
|
+
link: 'datasetsTabAddResourceModal.description',
|
|
266313
|
+
};
|
|
266314
|
+
function ResourceModal({ resource, isOpen, onClose, maxFileSizeMB }) {
|
|
266315
|
+
const t = useT();
|
|
266316
|
+
return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(ResourceDialogContent, { title: resource.name, description: t(DESCRIPTION_KEYS[resource.type]), children: [resource.type === 'github' && jsx(GithubFileUploadModal, {}), resource.type === 'local' && (jsx(LocalFileUploadModal, { resource: resource, maxFileSizeMB: maxFileSizeMB })), resource.type === 'webcrawler' && jsx(WebsiteCrawlModal, { resource: resource }), resource.type === 'url' && jsx(UrlUploadModal, { resource: resource })] }) }));
|
|
266206
266317
|
}
|
|
266207
266318
|
|
|
266208
266319
|
var bundle = {exports: {}};
|
|
@@ -266215,6 +266326,8 @@ var bundle = {exports: {}};
|
|
|
266215
266326
|
var bundleExports = bundle.exports;
|
|
266216
266327
|
var GoogleDrivePicker = /*@__PURE__*/getDefaultExportFromCjs(bundleExports);
|
|
266217
266328
|
|
|
266329
|
+
/** Least-privilege scope: only files the user picks/creates via the picker. */
|
|
266330
|
+
const GOOGLE_DRIVE_SCOPES = ['https://www.googleapis.com/auth/drive.file'];
|
|
266218
266331
|
const useGoogleDrivePicker = ({ tenantKey, mentorId }) => {
|
|
266219
266332
|
const [authToken, setAuthToken] = React__default.useState(null);
|
|
266220
266333
|
const [driveFiles, setDriveFiles] = React__default.useState([]);
|
|
@@ -266289,10 +266402,7 @@ const useGoogleDrivePicker = ({ tenantKey, mentorId }) => {
|
|
|
266289
266402
|
refresh_token: 'test-refresh token',
|
|
266290
266403
|
client_id: credentials.client_id,
|
|
266291
266404
|
token: authToken === null || authToken === void 0 ? void 0 : authToken.access_token,
|
|
266292
|
-
scopes:
|
|
266293
|
-
'https://www.googleapis.com/auth/drive.metadata.readonly',
|
|
266294
|
-
'https://www.googleapis.com/auth/drive.readonly',
|
|
266295
|
-
],
|
|
266405
|
+
scopes: GOOGLE_DRIVE_SCOPES,
|
|
266296
266406
|
token_type: authToken === null || authToken === void 0 ? void 0 : authToken.token_type,
|
|
266297
266407
|
expiry_date: new Date(Date.now() + ((authToken === null || authToken === void 0 ? void 0 : authToken.expires_in) || 0) * 1000).toISOString(),
|
|
266298
266408
|
},
|
|
@@ -266386,10 +266496,7 @@ const useGoogleDrivePicker = ({ tenantKey, mentorId }) => {
|
|
|
266386
266496
|
openPicker({
|
|
266387
266497
|
clientId: credentials.client_id,
|
|
266388
266498
|
developerKey: credentials.developer_key,
|
|
266389
|
-
customScopes:
|
|
266390
|
-
'https://www.googleapis.com/auth/drive.metadata.readonly',
|
|
266391
|
-
'https://www.googleapis.com/auth/drive.readonly',
|
|
266392
|
-
],
|
|
266499
|
+
customScopes: GOOGLE_DRIVE_SCOPES,
|
|
266393
266500
|
// @ts-expect-error - token accepts null to force fresh auth per google-drive-picker API
|
|
266394
266501
|
token: null, // Always start with null token to force fresh auth
|
|
266395
266502
|
showUploadView: true,
|
|
@@ -266477,6 +266584,8 @@ const useGoogleDrivePicker = ({ tenantKey, mentorId }) => {
|
|
|
266477
266584
|
forceClosePickerModal,
|
|
266478
266585
|
pickerError,
|
|
266479
266586
|
resetPickerState,
|
|
266587
|
+
credentialsLoaded: credentialLoaded,
|
|
266588
|
+
isConfigured: Boolean(credentials.client_id),
|
|
266480
266589
|
};
|
|
266481
266590
|
};
|
|
266482
266591
|
|
|
@@ -266547,6 +266656,7 @@ function ieOnEnd (script, cb) {
|
|
|
266547
266656
|
|
|
266548
266657
|
var loadScript = /*@__PURE__*/getDefaultExportFromCjs(loadScript$1);
|
|
266549
266658
|
|
|
266659
|
+
/** Default file types offered by the Dropbox chooser. Hosts override via `extensions`. */
|
|
266550
266660
|
const DROPBOX_EXTENSIONS = [
|
|
266551
266661
|
'.pdf',
|
|
266552
266662
|
'.doc',
|
|
@@ -266558,6 +266668,12 @@ const DROPBOX_EXTENSIONS = [
|
|
|
266558
266668
|
'.xlsx',
|
|
266559
266669
|
'.ppt',
|
|
266560
266670
|
'.pptx',
|
|
266671
|
+
'.png',
|
|
266672
|
+
'.jpeg',
|
|
266673
|
+
'.jpg',
|
|
266674
|
+
'.mp3',
|
|
266675
|
+
'.wav',
|
|
266676
|
+
'.m4a',
|
|
266561
266677
|
];
|
|
266562
266678
|
const DROPBOX_SDK_URL = 'https://www.dropbox.com/static/api/2/dropins.js';
|
|
266563
266679
|
const SCRIPT_ID = 'dropboxjs';
|
|
@@ -266566,6 +266682,7 @@ const useDropboxPicker = ({ tenantKey, mentorId, cancel = () => { }, linkType =
|
|
|
266566
266682
|
const [dropboxReady, setDropboxReady] = useState(false);
|
|
266567
266683
|
const [openChooser, setOpenChooser] = useState(false);
|
|
266568
266684
|
const [appKey, setAppKey] = useState(null);
|
|
266685
|
+
const [credentialsLoaded, setCredentialsLoaded] = useState(false);
|
|
266569
266686
|
// Use RTK Query hooks
|
|
266570
266687
|
const [getCredentials] = useLazyGetCredentialsQuery();
|
|
266571
266688
|
const [addTrainingDocument] = useAddTrainingDocumentMutation();
|
|
@@ -266588,6 +266705,7 @@ const useDropboxPicker = ({ tenantKey, mentorId, cancel = () => { }, linkType =
|
|
|
266588
266705
|
catch (error) {
|
|
266589
266706
|
console.error(JSON.stringify({ tenant: tenantKey, error }));
|
|
266590
266707
|
}
|
|
266708
|
+
setCredentialsLoaded(true);
|
|
266591
266709
|
}
|
|
266592
266710
|
};
|
|
266593
266711
|
handleFetchAppKey();
|
|
@@ -266685,6 +266803,8 @@ const useDropboxPicker = ({ tenantKey, mentorId, cancel = () => { }, linkType =
|
|
|
266685
266803
|
openChooser: onChoose,
|
|
266686
266804
|
dropboxReady,
|
|
266687
266805
|
appKey,
|
|
266806
|
+
credentialsLoaded,
|
|
266807
|
+
isConfigured: Boolean(appKey),
|
|
266688
266808
|
};
|
|
266689
266809
|
};
|
|
266690
266810
|
|
|
@@ -266694,6 +266814,7 @@ const useOneDrivePicker = ({ tenantKey, mentorId }) => {
|
|
|
266694
266814
|
const [onedriveAppId, setOnedriveAppId] = useState(null);
|
|
266695
266815
|
const [fullDomain, setFullDomain] = useState(null);
|
|
266696
266816
|
const [isSDKLoaded, setIsSDKLoaded] = useState(false);
|
|
266817
|
+
const [credentialsLoaded, setCredentialsLoaded] = useState(false);
|
|
266697
266818
|
// Use RTK Query hooks
|
|
266698
266819
|
const [getCredentials] = useLazyGetCredentialsQuery();
|
|
266699
266820
|
const [addTrainingDocument] = useAddTrainingDocumentMutation();
|
|
@@ -266808,6 +266929,7 @@ const useOneDrivePicker = ({ tenantKey, mentorId }) => {
|
|
|
266808
266929
|
catch (error) {
|
|
266809
266930
|
console.error(JSON.stringify({ tenant: tenantKey, error }));
|
|
266810
266931
|
}
|
|
266932
|
+
setCredentialsLoaded(true);
|
|
266811
266933
|
}
|
|
266812
266934
|
};
|
|
266813
266935
|
handleFetchAppId();
|
|
@@ -266900,46 +267022,81 @@ const useOneDrivePicker = ({ tenantKey, mentorId }) => {
|
|
|
266900
267022
|
pickOneDriveFile,
|
|
266901
267023
|
onedriveAppId,
|
|
266902
267024
|
isSDKLoaded,
|
|
267025
|
+
credentialsLoaded,
|
|
267026
|
+
isConfigured: Boolean(onedriveAppId),
|
|
266903
267027
|
};
|
|
266904
267028
|
};
|
|
266905
267029
|
|
|
266906
|
-
function AddResourceModal({ isOpen, onClose, disabledDatasets = [], }) {
|
|
267030
|
+
function AddResourceModal({ isOpen, onClose, disabledDatasets = [], maxFileSizeMB, dropboxExtensions, }) {
|
|
266907
267031
|
const t = useT();
|
|
266908
267032
|
const { tenantKey, mentorId } = useAgentSettings();
|
|
266909
267033
|
const [selectedResource, setSelectedResource] = React__default.useState(null);
|
|
266910
|
-
const
|
|
267034
|
+
const dropbox = useDropboxPicker({
|
|
266911
267035
|
autoShow: false,
|
|
266912
267036
|
tenantKey,
|
|
266913
267037
|
mentorId,
|
|
267038
|
+
extensions: dropboxExtensions,
|
|
266914
267039
|
});
|
|
266915
|
-
const { handlePickerOpen, loadGoogleApiScript, isPickerLoaded, forceClosePickerModal, pickerError, } = useGoogleDrivePicker({ tenantKey, mentorId });
|
|
266916
|
-
const
|
|
266917
|
-
|
|
266918
|
-
|
|
266919
|
-
|
|
266920
|
-
|
|
266921
|
-
|
|
266922
|
-
|
|
266923
|
-
|
|
266924
|
-
|
|
266925
|
-
|
|
266926
|
-
|
|
266927
|
-
|
|
266928
|
-
|
|
266929
|
-
|
|
266930
|
-
|
|
266931
|
-
|
|
266932
|
-
|
|
266933
|
-
|
|
266934
|
-
|
|
266935
|
-
|
|
266936
|
-
|
|
267040
|
+
const { handlePickerOpen, loadGoogleApiScript, isPickerLoaded, forceClosePickerModal, pickerError, credentialsLoaded: googleCredentialsLoaded, isConfigured: googleIsConfigured, } = useGoogleDrivePicker({ tenantKey, mentorId });
|
|
267041
|
+
const oneDrive = useOneDrivePicker({ tenantKey, mentorId });
|
|
267042
|
+
// A cloud provider only works once the tenant has OAuth credentials for it
|
|
267043
|
+
// (GET .../integration-credential/?name=<provider>). Without them the SDK is
|
|
267044
|
+
// handed an empty client id and the click does nothing at all — no popup, no
|
|
267045
|
+
// error — which reads as a broken button. Disable and say why instead.
|
|
267046
|
+
// `loaded` gates on the lookup having finished so the buttons are not
|
|
267047
|
+
// disabled during the in-flight fetch.
|
|
267048
|
+
const cloudProviders = {
|
|
267049
|
+
'google-drive': {
|
|
267050
|
+
loaded: googleCredentialsLoaded,
|
|
267051
|
+
configured: googleIsConfigured,
|
|
267052
|
+
},
|
|
267053
|
+
onedrive: {
|
|
267054
|
+
loaded: oneDrive.credentialsLoaded,
|
|
267055
|
+
configured: oneDrive.isConfigured,
|
|
267056
|
+
},
|
|
267057
|
+
dropbox: {
|
|
267058
|
+
loaded: dropbox.credentialsLoaded,
|
|
267059
|
+
configured: dropbox.isConfigured,
|
|
267060
|
+
},
|
|
267061
|
+
};
|
|
267062
|
+
return (jsxs(Fragment$1, { children: [jsx(Script, { src: "https://apis.google.com/js/api.js", onLoad: loadGoogleApiScript, strategy: "lazyOnload" }), jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsx(ResourceDialogContent, { title: t('datasetsTabAddResourceModal.title'), description: t('datasetsTabAddResourceModal.description'), className: "sm:max-w-[800px]", children: jsxs(ResourceDialogBody, { label: t('datasetsTabAddResourceModal.scrollRegionAriaLabel'), children: [pickerError && (jsx("div", { className: "rounded-lg border border-red-200 bg-red-50 p-4", children: jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { children: [jsx("h4", { className: "text-sm font-medium text-red-800", children: t('datasetsTabAddResourceModal.googleDrivePickerError') }), jsx("p", { className: "mt-1 text-sm text-red-600", children: pickerError })] }), jsx("button", { onClick: forceClosePickerModal, className: "ml-4 rounded bg-red-100 px-3 py-1 text-sm font-medium text-red-800 hover:bg-red-200", children: t('datasetsTabAddResourceModal.forceClosePicker') })] }) })), jsx("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: resourceTypes.map((resource) => {
|
|
267063
|
+
const cloudProvider = cloudProviders[resource.id];
|
|
267064
|
+
const notConfigured = cloudProvider
|
|
267065
|
+
? cloudProvider.loaded && !cloudProvider.configured
|
|
267066
|
+
: false;
|
|
267067
|
+
const isDisabled = !resource.isActive ||
|
|
267068
|
+
disabledDatasets.includes(resource.id.toLowerCase()) ||
|
|
267069
|
+
notConfigured;
|
|
267070
|
+
return (jsxs("button", { title: notConfigured ? t('datasetsTabAddResourceModal.notConfigured') : undefined, className: cn('flex items-center rounded-lg border p-4 transition-colors duration-200 hover:bg-gray-50', !isDisabled ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'), onClick: () => {
|
|
267071
|
+
if (resource.type !== 'link') {
|
|
267072
|
+
setSelectedResource(resource);
|
|
267073
|
+
return;
|
|
267074
|
+
}
|
|
267075
|
+
if (resource.name === 'Google Drive') {
|
|
267076
|
+
if (isPickerLoaded) {
|
|
267077
|
+
handlePickerOpen();
|
|
266937
267078
|
}
|
|
266938
|
-
|
|
266939
|
-
|
|
266940
|
-
|
|
267079
|
+
else {
|
|
267080
|
+
// Show loading state or toast
|
|
267081
|
+
console.log('Google Picker is still loading...');
|
|
266941
267082
|
}
|
|
266942
|
-
|
|
267083
|
+
return;
|
|
267084
|
+
}
|
|
267085
|
+
if (resource.name === 'Dropbox') {
|
|
267086
|
+
dropbox.openChooser();
|
|
267087
|
+
return;
|
|
267088
|
+
}
|
|
267089
|
+
if (resource.name === 'Microsoft OneDrive') {
|
|
267090
|
+
oneDrive.pickOneDriveFile();
|
|
267091
|
+
return;
|
|
267092
|
+
}
|
|
267093
|
+
}, disabled: isDisabled, children: [jsx("div", { className: "mr-3 flex h-10 w-10 items-center justify-center rounded-md bg-blue-100", children: resource.icon }), jsxs("span", { className: "flex flex-col items-start text-left", children: [jsx("span", { className: "text-gray-700", children: resource.name }), notConfigured && (
|
|
267094
|
+
// aria-hidden: the same text is already the button's
|
|
267095
|
+
// `title`, so exposing it here too would append it to
|
|
267096
|
+
// the accessible name ("Dropbox Not configured for
|
|
267097
|
+
// this tenant") and break name-based lookups.
|
|
267098
|
+
jsx("span", { "aria-hidden": "true", className: "text-xs text-gray-500", children: t('datasetsTabAddResourceModal.notConfigured') }))] })] }, resource.id));
|
|
267099
|
+
}) })] }) }) }), selectedResource && (jsx(ResourceModal, { resource: selectedResource, isOpen: !!selectedResource, onClose: () => setSelectedResource(null), maxFileSizeMB: maxFileSizeMB }))] }));
|
|
266943
267100
|
}
|
|
266944
267101
|
|
|
266945
267102
|
// DatasetItemList requires a full labels object; without it the empty-state
|
|
@@ -266951,7 +267108,7 @@ const PROJECT_FILES_DATASET_LABELS = resolveDatasetsTabLabels({
|
|
|
266951
267108
|
function ProjectFilesModal(props) {
|
|
266952
267109
|
return (jsx(AgentSettingsProvider, { tenantKey: props.tenantKey, mentorId: props.mentorId, username: props.username, enableRBAC: false, children: jsx(ProjectFilesModalInner, { ...props }) }));
|
|
266953
267110
|
}
|
|
266954
|
-
function ProjectFilesModalInner({ isOpen, onClose }) {
|
|
267111
|
+
function ProjectFilesModalInner({ isOpen, onClose, disabledResourceTypes, maxUploadSizeMb, dropboxExtensions, }) {
|
|
266955
267112
|
var _a;
|
|
266956
267113
|
const t = useT();
|
|
266957
267114
|
const [showAddResourceModal, setShowAddResourceModal] = React__default.useState(false);
|
|
@@ -266966,7 +267123,7 @@ function ProjectFilesModalInner({ isOpen, onClose }) {
|
|
|
266966
267123
|
// @ts-expect-error - Type mismatch between RetrieverDocumentEmbedding[] and Dataset[], id property type difference
|
|
266967
267124
|
, {
|
|
266968
267125
|
// @ts-expect-error - Type mismatch between RetrieverDocumentEmbedding[] and Dataset[], id property type difference
|
|
266969
|
-
datasets: (_a = datasets === null || datasets === void 0 ? void 0 : datasets.results) !== null && _a !== void 0 ? _a : [], labels: PROJECT_FILES_DATASET_LABELS })] })) }) }) }), jsx(IblPagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: handlePageChange, disabled: isDatasetsFetching || isDatasetsLoading }), jsx(AddResourceModal, { isOpen: showAddResourceModal, onClose: () => closeAddResourceModal(), keepParentOpen: true }), isModalOpen && FreeTrialDialog && (jsx(FreeTrialDialog, { isOpen: isModalOpen, onClose: closeModal }))] }) })] }) }) }));
|
|
267126
|
+
datasets: (_a = datasets === null || datasets === void 0 ? void 0 : datasets.results) !== null && _a !== void 0 ? _a : [], labels: PROJECT_FILES_DATASET_LABELS })] })) }) }) }), jsx(IblPagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: handlePageChange, disabled: isDatasetsFetching || isDatasetsLoading }), jsx(AddResourceModal, { isOpen: showAddResourceModal, onClose: () => closeAddResourceModal(), keepParentOpen: true, disabledDatasets: disabledResourceTypes, maxFileSizeMB: maxUploadSizeMb, dropboxExtensions: dropboxExtensions }), isModalOpen && FreeTrialDialog && (jsx(FreeTrialDialog, { isOpen: isModalOpen, onClose: closeModal }))] }) })] }) }) }));
|
|
266970
267127
|
}
|
|
266971
267128
|
|
|
266972
267129
|
var projectFilesModal = /*#__PURE__*/Object.freeze({
|
|
@@ -280099,11 +280256,12 @@ function AgentHumanSupportTab({ PaginationComponent = IblPagination, labels: lab
|
|
|
280099
280256
|
: labels.list.untitled }) }), jsx("div", { className: "mx-auto w-full max-w-full overflow-x-hidden", children: selectedTicket && renderTicketDetail(selectedTicket) })] }) })] }));
|
|
280100
280257
|
}
|
|
280101
280258
|
|
|
280102
|
-
function AgentDatasetsTab({ labels: labelsOverride, onSelect, selectedDatasetId, AddResourceModal, PaginationComponent, page, search, onPageChange, onSearchChange, }) {
|
|
280259
|
+
function AgentDatasetsTab({ labels: labelsOverride, onSelect, selectedDatasetId, AddResourceModal: AddResourceModal$1, PaginationComponent, page, search, onPageChange, onSearchChange, disabledResourceTypes, maxUploadSizeMb, dropboxExtensions, }) {
|
|
280103
280260
|
var _a;
|
|
280104
280261
|
const { tenantKey, mentorId, username, rbacPermissions, executeGatedAction } = useAgentSettings();
|
|
280105
280262
|
const t = useT();
|
|
280106
280263
|
const labels = React__default.useMemo(() => resolveDatasetsTabLabels(labelsOverride, t), [labelsOverride, t]);
|
|
280264
|
+
const Pagination = PaginationComponent !== null && PaginationComponent !== void 0 ? PaginationComponent : IblPagination;
|
|
280107
280265
|
const [showAddResourceModal, setShowAddResourceModal] = React__default.useState(false);
|
|
280108
280266
|
const openAddResourceModal = () => setShowAddResourceModal(true);
|
|
280109
280267
|
const closeAddResourceModal = () => setShowAddResourceModal(false);
|
|
@@ -280145,7 +280303,7 @@ function AgentDatasetsTab({ labels: labelsOverride, onSelect, selectedDatasetId,
|
|
|
280145
280303
|
// @ts-ignore - Type mismatch between RetrieverDocumentEmbedding[] and Dataset[], id property type difference
|
|
280146
280304
|
, {
|
|
280147
280305
|
// @ts-ignore - Type mismatch between RetrieverDocumentEmbedding[] and Dataset[], id property type difference
|
|
280148
|
-
datasets: (_a = datasets === null || datasets === void 0 ? void 0 : datasets.results) !== null && _a !== void 0 ? _a : [], onSelect: onSelect, selectedDatasetId: selectedDatasetId, labels: labels })] })) }) }) }),
|
|
280306
|
+
datasets: (_a = datasets === null || datasets === void 0 ? void 0 : datasets.results) !== null && _a !== void 0 ? _a : [], onSelect: onSelect, selectedDatasetId: selectedDatasetId, labels: labels })] })) }) }) }), jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: handlePageChange, disabled: isDatasetsFetching || isDatasetsLoading }), AddResourceModal$1 ? (jsx(AddResourceModal$1, { isOpen: showAddResourceModal, onClose: () => closeAddResourceModal(), keepParentOpen: true })) : (jsx(AddResourceModal, { isOpen: showAddResourceModal, onClose: () => closeAddResourceModal(), keepParentOpen: true, disabledDatasets: disabledResourceTypes, maxFileSizeMB: maxUploadSizeMb, dropboxExtensions: dropboxExtensions }))] })] })] }));
|
|
280149
280307
|
}
|
|
280150
280308
|
|
|
280151
280309
|
/**
|