Commit 079f0ac7 authored by Jan Reimes's avatar Jan Reimes
Browse files

refactor(ai): remove AI CLI commands and related files

* Delete ai.py and ai_app.py to clean up unused AI command structure.
* Update pyproject.toml to remove AI dependencies and scripts.
* Refactor app.py and tdoc_app.py to eliminate optional AI command registration.
* Modify conftest.py to ignore legacy AI tests in the test suite.
parent edeca9f7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ dependencies = [
[project.urls]
Repository = "https://forge.3gpp.org/rep/reimes/3gpp-crawler"

[project.scripts]
3gpp-ai = "threegpp_ai.cli:app"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
+43 −0
Original line number Diff line number Diff line
"""Smoke tests for the top-level 3gpp-ai CLI aggregator."""

from __future__ import annotations

from threegpp_ai.cli import app
from typer.testing import CliRunner


def test_cli_help_lists_top_level_groups() -> None:
    runner = CliRunner()
    result = runner.invoke(app, ["--help"])

    assert result.exit_code == 0
    assert "summarize" in result.stdout
    assert "convert" in result.stdout
    assert "workspace" in result.stdout
    assert "rag" in result.stdout


def test_workspace_help_lists_expected_subcommands() -> None:
    runner = CliRunner()
    result = runner.invoke(app, ["workspace", "--help"])

    assert result.exit_code == 0
    assert "add-members" in result.stdout
    assert "list-members" in result.stdout
    assert "process" in result.stdout


def test_summarize_help_shows_description() -> None:
    runner = CliRunner()
    result = runner.invoke(app, ["summarize", "--help"])

    assert result.exit_code == 0
    assert "Summarize a single document with specified word count." in result.stdout


def test_convert_help_shows_description() -> None:
    runner = CliRunner()
    result = runner.invoke(app, ["convert", "--help"])

    assert result.exit_code == 0
    assert "Convert a single TDoc to markdown format." in result.stdout
+84 −0
Original line number Diff line number Diff line
"""Shared Typer argument and option definitions for 3gpp-ai CLI."""

from __future__ import annotations

from pathlib import Path
from typing import Annotated

import typer

# Common
JsonOutputOption = Annotated[bool, typer.Option("--json", help="Output as JSON")]

# Summarize
SummarizeDocumentArgument = Annotated[str, typer.Argument(help="Document ID to summarize")]
SummarizeWordsOption = Annotated[int, typer.Option("--words", "-w", help="Target/Maximum word count (default: 200)")]
SummarizeForceOption = Annotated[bool, typer.Option("--force", "-f", help="Force reconversion even if cached")]

# Convert
ConvertDocumentArgument = Annotated[str, typer.Argument(help="Document ID to convert")]
ConvertOutputOption = Annotated[
    Path | None,
    typer.Option("--output", "-o", help="Output file path (optional, prints to stdout if not specified)"),
]
ConvertForceOption = Annotated[bool, typer.Option("--force", "-f", help="Force reconversion even if cached")]

# Workspace
WorkspaceNameArgument = Annotated[str, typer.Argument(help="Workspace name")]
WorkspaceNameOption = Annotated[str | None, typer.Option("--workspace", "-w", help="Workspace name")]
WorkspaceActivateOption = Annotated[
    bool,
    typer.Option("--activate/--no-activate", help="Activate workspace after creation (default: activate)"),
]
WorkspaceAutoBuildOption = Annotated[
    bool,
    typer.Option("--auto-build", help="Automatically process documents added to this workspace"),
]
WorkspaceItemsArgument = Annotated[list[str] | None, typer.Argument(help="Source item IDs to add (optional if filters provided)")]
WorkspaceKindOption = Annotated[str, typer.Option("--kind", help="Source kind (tdoc, spec, other)")]
WorkspaceCheckoutOption = Annotated[bool, typer.Option("--checkout/--no-checkout", help="Checkout/download documents if not present")]
WorkspaceReleaseOption = Annotated[
    str | None,
    typer.Option("--release", help="Spec release version (e.g., 16.3.0, 17.0.0). Only applies to specs."),
]
WorkspaceLimitOption = Annotated[int | None, typer.Option("--limit", help="Maximum items to add")]
WorkspaceIncludeInactiveOption = Annotated[bool, typer.Option("--include-inactive", help="Include inactive members")]
WorkspaceProcessForceOption = Annotated[bool, typer.Option("--force", help="Force reprocessing of all members")]
WorkspacePreserveArtifactsOption = Annotated[
    bool,
    typer.Option("--preserve-artifacts/--delete-artifacts", help="Preserve LightRAG artifacts"),
]

# Filter options for workspace add-members
StartDateOption = Annotated[
    str | None,
    typer.Option("--start-date", help="Filter from ISO timestamp (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)"),
]
EndDateOption = Annotated[
    str | None,
    typer.Option("--end-date", help="Filter until ISO timestamp (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)"),
]
SourcePatternOption = Annotated[
    str | None,
    typer.Option("--source", help="Glob/regex pattern for source field"),
]
SourcePatternExcludeOption = Annotated[
    str | None,
    typer.Option("--source-ex", help="Pattern to exclude source field"),
]
TitlePatternOption = Annotated[
    str | None,
    typer.Option("--title", help="Glob/regex pattern for title field"),
]
TitlePatternExcludeOption = Annotated[
    str | None,
    typer.Option("--title-ex", help="Pattern to exclude title field"),
]
AgendaPatternOption = Annotated[
    str | None,
    typer.Option("--agenda", help="Glob/regex pattern for agenda field"),
]
AgendaPatternExcludeOption = Annotated[
    str | None,
    typer.Option("--agenda-ex", help="Pattern to exclude agenda field"),
]
+597 −0

File added.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -17,12 +17,12 @@ from typing import Any
from lightrag import LightRAG, QueryParam
from lightrag.kg import STORAGES
from lightrag.kg.shared_storage import initialize_pipeline_status
from lightrag.utils import EmbeddingFunc
from lightrag.llm.hf import hf_embed, hf_model_complete
from lightrag.llm.jina import jina_embed
from lightrag.llm.ollama import ollama_embed, ollama_model_complete
from lightrag.llm.openai import openai_complete, openai_embed
from lightrag.llm.zhipu import zhipu_complete, zhipu_embedding
from lightrag.utils import EmbeddingFunc

from tdoc_crawler.config import resolve_cache_manager

Loading