mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-09 07:16:04 +00:00
feat(rag): add data-only migration option and fix dialog width
Add option to migrate knowledge base data without auto-installing the LangRAG plugin (for offline/intranet environments). Also narrow the migration dialog to match other confirmation dialogs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,9 +45,9 @@ export default function KBMigrationDialog({
|
||||
},
|
||||
});
|
||||
|
||||
const handleStartMigration = async () => {
|
||||
const handleMigration = async (installPlugin: boolean) => {
|
||||
try {
|
||||
const resp = await httpClient.executeRagMigration();
|
||||
const resp = await httpClient.executeRagMigration(installPlugin);
|
||||
asyncTask.startTask(resp.task_id);
|
||||
} catch {
|
||||
toast.error(t('knowledge.migration.error'));
|
||||
@@ -77,7 +77,7 @@ export default function KBMigrationDialog({
|
||||
if (!isRunning) onOpenChange(v);
|
||||
}}
|
||||
>
|
||||
<DialogContent className="sm:max-w-[500px]">
|
||||
<DialogContent className="sm:max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{t('knowledge.migration.title')}</DialogTitle>
|
||||
<DialogDescription>
|
||||
@@ -87,18 +87,13 @@ export default function KBMigrationDialog({
|
||||
|
||||
<div className="py-4 space-y-3">
|
||||
{!isRunning && !isError && (
|
||||
<>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('knowledge.migration.detected', {
|
||||
total: totalCount,
|
||||
internal: internalKbCount,
|
||||
external: externalKbCount,
|
||||
})}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('knowledge.migration.installHint')}
|
||||
</p>
|
||||
</>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('knowledge.migration.detected', {
|
||||
total: totalCount,
|
||||
internal: internalKbCount,
|
||||
external: externalKbCount,
|
||||
})}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{isRunning && (
|
||||
@@ -122,26 +117,39 @@ export default function KBMigrationDialog({
|
||||
)}
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
{!isRunning && (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleDismiss}
|
||||
disabled={dismissing}
|
||||
>
|
||||
{t('knowledge.migration.dismiss')}
|
||||
</Button>
|
||||
)}
|
||||
<DialogFooter className="flex flex-col gap-2 sm:flex-col">
|
||||
{!isRunning && !isError && (
|
||||
<Button onClick={handleStartMigration}>
|
||||
{t('knowledge.migration.start')}
|
||||
</Button>
|
||||
<>
|
||||
<Button onClick={() => handleMigration(true)} className="w-full">
|
||||
{t('knowledge.migration.startWithInstall')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => handleMigration(false)}
|
||||
className="w-full"
|
||||
>
|
||||
{t('knowledge.migration.startDataOnly')}
|
||||
</Button>
|
||||
<p className="text-xs text-muted-foreground text-center">
|
||||
{t('knowledge.migration.dataOnlyHint')}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{isError && (
|
||||
<Button onClick={handleStartMigration}>
|
||||
<Button onClick={() => handleMigration(true)} className="w-full">
|
||||
{t('knowledge.migration.retry')}
|
||||
</Button>
|
||||
)}
|
||||
{!isRunning && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={handleDismiss}
|
||||
disabled={dismissing}
|
||||
className="w-full"
|
||||
>
|
||||
{t('knowledge.migration.dismiss')}
|
||||
</Button>
|
||||
)}
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
@@ -716,8 +716,12 @@ export class BackendClient extends BaseHttpClient {
|
||||
return this.get('/api/v1/knowledge/migration/status');
|
||||
}
|
||||
|
||||
public executeRagMigration(): Promise<AsyncTaskCreatedResp> {
|
||||
return this.post('/api/v1/knowledge/migration/execute');
|
||||
public executeRagMigration(
|
||||
installPlugin: boolean = true,
|
||||
): Promise<AsyncTaskCreatedResp> {
|
||||
return this.post('/api/v1/knowledge/migration/execute', {
|
||||
install_plugin: installPlugin,
|
||||
});
|
||||
}
|
||||
|
||||
public dismissRagMigration(): Promise<object> {
|
||||
|
||||
@@ -779,9 +779,10 @@ const enUS = {
|
||||
'Legacy knowledge base data detected. Migration to the new plugin-based RAG architecture is required.',
|
||||
detected:
|
||||
'Found {{total}} knowledge base(s) to migrate ({{internal}} internal, {{external}} external).',
|
||||
installHint:
|
||||
'Migration will automatically install the LangRAG plugin and restore your knowledge base data. Documents and vector data will be preserved.',
|
||||
start: 'Migrate Now',
|
||||
startWithInstall: 'Auto-install Plugin & Migrate',
|
||||
startDataOnly: 'Migrate Data Only',
|
||||
dataOnlyHint:
|
||||
'"Migrate Data Only" is for offline/intranet environments. Please install the LangRAG plugin manually before migrating.',
|
||||
dismiss: 'Skip for Now',
|
||||
running: 'Migrating knowledge bases, please wait...',
|
||||
success: 'Knowledge base migration completed',
|
||||
|
||||
@@ -768,9 +768,10 @@ const jaJP = {
|
||||
'旧バージョンのナレッジベースデータが検出されました。新しいプラグインベースのRAGアーキテクチャへの移行が必要です。',
|
||||
detected:
|
||||
'移行が必要なナレッジベースが{{total}}件見つかりました(内部{{internal}}件、外部{{external}}件)。',
|
||||
installHint:
|
||||
'移行により LangRAG プラグインが自動的にインストールされ、ナレッジベースデータが復元されます。ドキュメントとベクトルデータは保持されます。',
|
||||
start: '今すぐ移行',
|
||||
startWithInstall: 'プラグインを自動インストールして移行',
|
||||
startDataOnly: 'データのみ移行',
|
||||
dataOnlyHint:
|
||||
'「データのみ移行」はオフライン環境向けです。事前に LangRAG プラグインを手動でインストールしてください。',
|
||||
dismiss: '後で',
|
||||
running: 'ナレッジベースを移行中です。しばらくお待ちください...',
|
||||
success: 'ナレッジベースの移行が完了しました',
|
||||
|
||||
@@ -747,9 +747,9 @@ const zhHans = {
|
||||
description: '检测到旧版知识库数据,需要迁移到新的插件化 RAG 架构。',
|
||||
detected:
|
||||
'共检测到 {{total}} 个知识库需要迁移({{internal}} 个内置知识库,{{external}} 个外部知识库)。',
|
||||
installHint:
|
||||
'迁移将自动安装 LangRAG 插件并恢复您的知识库数据,文档和向量数据将被保留。',
|
||||
start: '立即迁移',
|
||||
startWithInstall: '自动安装插件并迁移',
|
||||
startDataOnly: '仅迁移数据',
|
||||
dataOnlyHint: '「仅迁移数据」适合内网环境使用,请自行安装 LangRAG 插件后再迁移。',
|
||||
dismiss: '暂不迁移',
|
||||
running: '正在迁移知识库,请稍候...',
|
||||
success: '知识库迁移完成',
|
||||
|
||||
@@ -727,9 +727,10 @@ const zhHant = {
|
||||
description: '檢測到舊版知識庫資料,需要遷移到新的插件化 RAG 架構。',
|
||||
detected:
|
||||
'共檢測到 {{total}} 個知識庫需要遷移({{internal}} 個內建知識庫,{{external}} 個外部知識庫)。',
|
||||
installHint:
|
||||
'遷移將自動安裝 LangRAG 插件並恢復您的知識庫資料,文件和向量資料將被保留。',
|
||||
start: '立即遷移',
|
||||
startWithInstall: '自動安裝插件並遷移',
|
||||
startDataOnly: '僅遷移資料',
|
||||
dataOnlyHint:
|
||||
'「僅遷移資料」適合內網環境使用,請自行安裝 LangRAG 插件後再遷移。',
|
||||
dismiss: '暫不遷移',
|
||||
running: '正在遷移知識庫,請稍候...',
|
||||
success: '知識庫遷移完成',
|
||||
|
||||
Reference in New Issue
Block a user