Files
furyhawk 8351e73d39 feat: add Zustand stores for conversation, file preview, sidebar, theme, and knowledge base selection
- Implemented `conversation-store` for managing conversations and messages.
- Created `file-preview-store` to handle file preview state.
- Added `sidebar-store` for sidebar visibility management.
- Developed `theme-store` for theme persistence and management.
- Introduced `kb-selection-store` for managing active knowledge base selections with persistence.

chore: define API and chat types

- Added types for API responses, authentication, chat messages, conversations, and projects.
- Defined interfaces for various entities including users, sessions, and message ratings.

build: configure TypeScript and testing setup

- Set up `tsconfig.json` for TypeScript configuration.
- Created `vitest.config.ts` for testing configuration with Vitest.
- Added `vitest.setup.ts` for global test setup including mocks for Next.js router and media queries.
- Configured Vercel deployment settings in `vercel.json`.
2026-06-11 16:54:43 +08:00

175 lines
4.9 KiB
TOML

[project]
name = "ai_agent"
version = "0.1.0"
description = "My FastAPI project"
requires-python = ">=3.13"
license = { text = "MIT" }
authors = [
{ name = "Your Name", email = "your@email.com" },
]
dependencies = [
"fastapi>=0.135.3",
"uvicorn[standard]>=0.43.0",
"pydantic[email]>=2.12.0",
"pydantic-settings>=2.13.0",
"python-multipart>=0.0.20",
"logfire[fastapi,asyncpg]>=4.30.0",
"sqlalchemy[asyncio]>=2.0.40",
"asyncpg>=0.31.0",
"psycopg2-binary>=2.9.0",
"alembic>=1.18.0",
"greenlet>=3.2.0",
# HMAC HS256 only — no asymmetric keys, no `cryptography` extra.
"pyjwt>=2.9.0",
"bcrypt>=4.0.0",
"python-multipart>=0.0.12",
"authlib>=1.3.0",
"httpx>=0.28.0",
"redis>=5.2.0",
"fastapi-pagination>=0.12.31",
"sqladmin>=0.24.0",
"itsdangerous>=2.2.0",
"taskiq[reload]>=0.11.0",
"taskiq-redis>=1.0.0",
"taskiq-dependencies>=0.1.0",
"pydantic-ai-slim[openai,duckduckgo,web-fetch]>=1.80.0",
# Vector store
"pymilvus>=2.6.0",
# Text splitting
"langchain-text-splitters>=0.4.0",
# BM25 for hybrid search
"rank-bm25>=0.2.2",
# Uses existing openai dependency
"sentence-transformers>=3.0.0",
"pymupdf>=1.25.0",
"pillow>=10.0.0",
"python-docx>=1.1.0",
"click>=8.1.0",
"tabulate>=0.9.0",
"tqdm>=4.66.0",
]
[project.optional-dependencies]
dev = [
"pytest>=9.0.0",
"anyio[trio]>=4.9.0",
"pytest-cov>=6.1.0",
"httpx>=0.28.0",
"ruff>=0.15.0",
"ty>=0.0.29",
"pre-commit>=4.0.0",
]
[project.scripts]
ai_agent = "cli.commands:main"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["app", "cli"]
[tool.ruff]
target-version = "py311"
line-length = 100
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"SIM", # flake8-simplify
"RUF", # ruff-specific rules
]
ignore = [
"E501", # line too long (handled by formatter)
"E402", # module level import not at top (needed for conditional Jinja2 imports)
"B008", # function call in default argument (needed for FastAPI Depends)
"B905", # zip() without strict= (Python 3.10+ style, not needed)
"RUF012", # mutable class attribute without ClassVar (used in parser base class)
"RUF059", # unpacked variable never used (CLI destructuring pattern)
]
[tool.ruff.lint.isort]
known-first-party = ["app", "cli"]
[tool.ty.environment]
python-version = "3.11"
[tool.ty.src]
exclude = [
"alembic/",
"tests/",
"cli/",
"app/commands/",
]
[tool.ty.rules]
# FastAPI Depends() injects at runtime — default=None on typed params is intentional
invalid-parameter-default = "warn"
# Starlette/FastAPI handler signatures use Union types that ty flags
invalid-argument-type = "warn"
# ORM models with Optional fields trigger on attribute assignment
invalid-assignment = "warn"
# Callable[..., Any] doesn't expose __name__ but function objects do
unresolved-attribute = "warn"
# datetime.utcnow deprecation warnings
deprecated = "warn"
# Optional deps imported inside try/except (pymupdf, docx, faker)
unresolved-import = "warn"
# dict() overload matching on dynamic types from validators
no-matching-overload = "warn"
# Template uses mypy-style `# type: ignore` comments which ty doesn't recognize
unused-type-ignore-comment = "warn"
# Operations on Unknown types from untyped libraries (pymupdf, etc.)
unsupported-operator = "warn"
# Third-party libs (langchain, redis-py) ship without complete type stubs;
# kwargs that work at runtime are flagged as unknown.
unknown-argument = "warn"
# redis-py / asyncio overloads return Awaitable[T] | T which ty rejects as awaitable
invalid-await = "warn"
# sessionmaker(class_=AsyncSession) returns sync sessionmaker per overloads
# but the resulting callable still produces an async context manager.
invalid-context-manager = "warn"
# Helpers like get_agent accept **kwargs but their stubs only list specific params
missing-argument = "warn"
# LangChain BaseMessage subclasses (AIMessage etc.) carry tool_calls only on
# specific subclasses; ty cannot narrow via hasattr().
not-iterable = "warn"
# Return-type widening for langgraph .compile() (StateGraph vs CompiledStateGraph)
invalid-return-type = "warn"
# CrewAI/langgraph runtime classes use kwargs that ty stubs don't enumerate
invalid-type-form = "warn"
[tool.pytest.ini_options]
testpaths = ["tests"]
[tool.coverage.run]
source = ["app"]
omit = [
"app/main.py",
"app/core/logfire_setup.py",
]
[tool.coverage.report]
fail_under = 100
show_missing = true
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"if __name__ ==",
"@overload",
"raise NotImplementedError",
"\\.\\.\\.",
]
[tool.fastapi-fullstack]
generator_version = "0.2.10"
generated_at = "2026-06-11T07:19:21.193991+00:00"