small refactor of the structure

This commit is contained in:
2026-05-25 12:16:24 +02:00
parent 51e099acdd
commit b0f10b6bb1
26 changed files with 37 additions and 37 deletions
+6 -6
View File
@@ -12,7 +12,7 @@ An Agent is a lightweight wrapper:
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import Dict, List from typing import Dict, List
from skills import Skill, get_combined_prompt, list_all as list_all_skills from agents.skills import Skill, get_combined_prompt, list_all as list_all_skills
@dataclass @dataclass
@@ -61,8 +61,8 @@ def load_all_agents() -> None:
import agents.media_agent # noqa: F401 import agents.media_agent # noqa: F401
# Also import skill modules so they self-register # Also import skill modules so they self-register
import skills.media_info # noqa: F401 import agents.skills.media_info # noqa: F401
import skills.seerr # noqa: F401 import agents.skills.seerr # noqa: F401
import skills.triage # noqa: F401 import agents.skills.triage # noqa: F401
import skills.easter_eggs # noqa: F401 import agents.skills.easter_eggs # noqa: F401
import skills.watch_history # noqa: F401 import agents.skills.watch_history # noqa: F401
@@ -12,7 +12,7 @@ A Skill is a lightweight object with:
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import Any, Awaitable, Callable, Dict, List, Optional from typing import Any, Awaitable, Callable, Dict, List, Optional
from core.config import get_config # re-export so every skill can use it from src.config import get_config # re-export so every skill can use it
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -8,7 +8,7 @@ requested actions normally. Functionality is never sacrificed for a reference.
Add a new theme by adding one entry to THEMES no code changes needed. Add a new theme by adding one entry to THEMES no code changes needed.
""" """
from skills import Skill, register from agents.skills import Skill, register
THEMES = { THEMES = {
"naruto": { "naruto": {
@@ -5,7 +5,7 @@ A lightweight base skill that teaches the agent it is a media assistant.
Real API capabilities come from other skills (seerr, triage, etc.). Real API capabilities come from other skills (seerr, triage, etc.).
""" """
from skills import Skill, register from agents.skills import Skill, register
media_info_skill = Skill( media_info_skill = Skill(
name="media_info", name="media_info",
+1 -1
View File
@@ -24,7 +24,7 @@ from urllib.parse import quote
import httpx import httpx
from skills import Skill, register, ToolResult, get_config from agents.skills import Skill, register, ToolResult, get_config
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Config # Config
+1 -1
View File
@@ -10,7 +10,7 @@ cancelling requests, banning users), this skill teaches the LLM to:
3. Use the seerr_submit_issue tool (if available) to create the ticket. 3. Use the seerr_submit_issue tool (if available) to create the ticket.
""" """
from skills import Skill, register from agents.skills import Skill, register
# This skill has no tools of its own — it guides the LLM's behavior. # This skill has no tools of its own — it guides the LLM's behavior.
# The actual ticket submission is handled by seerr_submit_issue. # The actual ticket submission is handled by seerr_submit_issue.
@@ -8,7 +8,7 @@ users who haven't linked Jellyfin will be prompted to /login first.
from __future__ import annotations from __future__ import annotations
from skills import Skill, register, ToolResult from agents.skills import Skill, register, ToolResult
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Tool definitions # Tool definitions
View File
@@ -20,8 +20,8 @@ from typing import Optional
import httpx import httpx
from auth import AuthService, AuthResult, register_auth_service from gateway.auth import AuthService, AuthResult, register_auth_service
from core.config import get_config from src.config import get_config
logger = logging.getLogger("auth.jellyfin") logger = logging.getLogger("auth.jellyfin")
@@ -1,7 +1,7 @@
from fastapi import Request from fastapi import Request
from openai import OpenAI from openai import OpenAI
from core.graph import create_agent_graph from src.graph import create_agent_graph
def get_llm_client(request: Request) -> OpenAI: def get_llm_client(request: Request) -> OpenAI:
@@ -23,12 +23,12 @@ import os
import discord import discord
from agents import list_all as list_all_agents from agents import list_all as list_all_agents
from bot.conversation import ConversationStore from gateway.discord.conversation import ConversationStore
from core.config import DEEPSEEK_API_KEY, get_config from src.config import DEEPSEEK_API_KEY, get_config
from core.graph import create_agent_graph from src.graph import create_agent_graph
from core.llm import create_client from src.llm import create_client
from core import auth_store from src import auth_store
from auth import list_auth_services, get_auth_service from gateway.auth import list_auth_services, get_auth_service
logger = logging.getLogger("bot.discord") logger = logging.getLogger("bot.discord")
+4 -4
View File
@@ -19,10 +19,10 @@ import logging
from fastapi import APIRouter, Form, HTTPException, Request from fastapi import APIRouter, Form, HTTPException, Request
from fastapi.responses import HTMLResponse from fastapi.responses import HTMLResponse
from auth import get_auth_service, list_auth_services from gateway.auth import get_auth_service, list_auth_services
from core import auth_store from src import auth_store
logger = logging.getLogger("api.auth") logger = logging.getLogger("gateway.auth")
router = APIRouter(prefix="/api/v1/auth", tags=["auth"]) router = APIRouter(prefix="/api/v1/auth", tags=["auth"])
@@ -199,7 +199,7 @@ async def auth_status(discord_id: int):
# POST /auth/reset — wipe auth store (DEV ONLY) # POST /auth/reset — wipe auth store (DEV ONLY)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
from core.config import get_config # noqa: E402 from src.config import get_config # noqa: E402
@router.post("/reset") @router.post("/reset")
async def reset_auth(): async def reset_auth():
+2 -2
View File
@@ -4,9 +4,9 @@ from openai import OpenAI
from pydantic import BaseModel from pydantic import BaseModel
import json import json
from api.dependencies import get_llm_client, get_agent_graph from gateway.dependencies import get_llm_client, get_agent_graph
from agents import get as get_agent, list_all as list_all_agents from agents import get as get_agent, list_all as list_all_agents
from core.state import AgentState from src.state import AgentState
router = APIRouter() router = APIRouter()
+6 -6
View File
@@ -4,10 +4,10 @@ from contextlib import asynccontextmanager
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
from api.v1.auth import router as auth_router from gateway.v1.auth import router as auth_router
from api.v1.chat import router as v1_router from gateway.v1.chat import router as v1_router
from core.config import DEEPSEEK_API_KEY, get_config from src.config import DEEPSEEK_API_KEY, get_config
from core.llm import create_client from src.llm import create_client
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Logging — tool calls will appear in the uvicorn console # Logging — tool calls will appear in the uvicorn console
@@ -25,14 +25,14 @@ from agents import load_all_agents # noqa: E402
load_all_agents() load_all_agents()
import auth.jellyfin # noqa: E402 — self-registers JellyfinAuth import gateway.auth.jellyfin # noqa: E402 — self-registers JellyfinAuth
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Lifespan # Lifespan
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@asynccontextmanager @asynccontextmanager
async def lifespan(app: FastAPI): async def lifespan(app: FastAPI):
from bot.discord_bot import start_in_background # noqa: E402 from gateway.discord.bot import start_in_background # noqa: E402
start_in_background() start_in_background()
+1 -1
View File
@@ -19,7 +19,7 @@ from datetime import datetime, timedelta, timezone
from pathlib import Path from pathlib import Path
from typing import Optional from typing import Optional
from core.config import get_config from src.config import get_config
logger = logging.getLogger("auth_store") logger = logging.getLogger("auth_store")
View File
+2 -2
View File
@@ -20,8 +20,8 @@ from langchain_core.messages import AIMessage, ToolMessage
from langgraph.graph import END, StateGraph from langgraph.graph import END, StateGraph
from openai import OpenAI from openai import OpenAI
from core.state import AgentState from src.state import AgentState
from skills import get_all_tools, execute_tool from agents.skills import get_all_tools, execute_tool
logger = logging.getLogger("graph") logger = logging.getLogger("graph")
View File
View File
@@ -13,7 +13,7 @@ from typing import Any
from langchain_core.tools import tool from langchain_core.tools import tool
from skills import get_all_tools, execute_tool from agents.skills import get_all_tools, execute_tool
def build_langgraph_tools(skill_names: list[str]) -> list: def build_langgraph_tools(skill_names: list[str]) -> list: