/
dictator
/
ragflow_sync
Обзор
Документация
Войти
/
dictator
/
ragflow_sync
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
ragflow_sync_cli/commands/sync_all.py
85 строк
2 KB
Developer
feat: add sync files command to upload Markdown files from local directory
05 июн 2026, 18:05
05 июн 2026, 18:05
69cced8
Код
Авторство
О чём код?
""" Sync all configured datasources command. """ import sys from ragflow_uploader.client import RAGFlowClient from ragflow_sync_cli.config import Config def sync_all( client: RAGFlowClient, config: Config, recursive: bool = True, ) -> None: """Sync all configured datasources.""" from ragflow_sync_cli.commands.sync_confluence import sync_confluence from ragflow_sync_cli.commands.sync_tasktracker import sync_tasktracker from ragflow_sync_cli.commands.sync_files import sync_files # Count enabled sources sources = [] if config.confluence: sources.append("Confluence") if config.tasktracker: sources.append("TaskTracker") if config.files: sources.append("Files") if not sources: print("\nNo datasources configured to sync.") return total = len(sources) print("\n" + "=" * 50) print("Syncing All Datasources") print("=" * 50) idx = 0 # Sync Confluence if configured if config.confluence: idx += 1 print(f"\n[{idx}/{total}] Syncing Confluence...") sync_confluence( client=client, config=config.confluence, dataset_name="Confluence Knowledge Base", create_dataset=True, recursive=recursive, ) else: print("\nSkipping Confluence (not configured)") # Sync TaskTracker if configured if config.tasktracker: idx += 1 print(f"\n[{idx}/{total}] Syncing TaskTracker...") sync_tasktracker( client=client, config=config.tasktracker, dataset_name="TaskTracker Knowledge Base", create_dataset=True, recursive=recursive, ) else: print("\nSkipping TaskTracker (not configured)") # Sync Files if configured if config.files: idx += 1 print(f"\n[{idx}/{total}] Syncing Files...") sync_files( client=client, directory=config.files.path, dataset_name=config.files.dataset_name, glob=config.files.glob, exclude=config.files.exclude if config.files.exclude else None, create_dataset=True, ) else: print("\nSkipping Files (not configured)") print("\n✓ All syncs completed!")