chore: ran linter & formatter again
This commit is contained in:
@@ -5,11 +5,12 @@ import logging
|
||||
import os
|
||||
import time
|
||||
import uuid
|
||||
from typing import Any
|
||||
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from fastapi.responses import JSONResponse, StreamingResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from pydantic import BaseModel, Field, validator
|
||||
from typing import Any
|
||||
|
||||
from alfred.agent.agent import Agent
|
||||
from alfred.agent.config import settings
|
||||
@@ -40,7 +41,6 @@ else:
|
||||
)
|
||||
|
||||
# Initialize memory context at startup
|
||||
# Use /data/memory in Docker, fallback to memory_data for local dev
|
||||
storage_dir = os.getenv("MEMORY_STORAGE_DIR", "memory_data")
|
||||
init_memory(storage_dir=storage_dir)
|
||||
logger.info(f"Memory context initialized (storage: {storage_dir})")
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
|
||||
import logging
|
||||
|
||||
from alfred.infrastructure.api.knaben import KnabenAPIError, KnabenClient, KnabenNotFoundError
|
||||
from alfred.infrastructure.api.knaben import (
|
||||
KnabenAPIError,
|
||||
KnabenClient,
|
||||
KnabenNotFoundError,
|
||||
)
|
||||
|
||||
from .dto import SearchTorrentsResponse
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
"""Knaben torrent search API client."""
|
||||
|
||||
|
||||
import logging
|
||||
import requests
|
||||
from requests.exceptions import HTTPError, RequestException, Timeout
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
from requests.exceptions import HTTPError, RequestException, Timeout
|
||||
|
||||
from alfred.agent.config import Settings, settings
|
||||
|
||||
from .dto import TorrentResult
|
||||
from .exceptions import KnabenAPIError, KnabenNotFoundError
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
"""qBittorrent Web API client."""
|
||||
|
||||
import logging
|
||||
import requests
|
||||
from requests.exceptions import HTTPError, RequestException, Timeout
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
from requests.exceptions import HTTPError, RequestException, Timeout
|
||||
|
||||
from alfred.agent.config import Settings, settings
|
||||
|
||||
from .dto import TorrentInfo
|
||||
from .exceptions import QBittorrentAPIError, QBittorrentAuthError
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
"""TMDB (The Movie Database) API client."""
|
||||
|
||||
import logging
|
||||
import requests
|
||||
from requests.exceptions import HTTPError, RequestException, Timeout
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
from requests.exceptions import HTTPError, RequestException, Timeout
|
||||
|
||||
from alfred.agent.config import Settings, settings
|
||||
|
||||
from .dto import MediaResult
|
||||
from .exceptions import (
|
||||
TMDBAPIError,
|
||||
|
||||
1
cli.py
1
cli.py
@@ -179,7 +179,6 @@ def setup() -> None:
|
||||
"""Orchestrate initialization."""
|
||||
is_docker_running()
|
||||
ensure_env()
|
||||
#mkdir
|
||||
|
||||
|
||||
def status() -> None:
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
# TODO: Moved directory, should not be necessary anymore but need to check !!
|
||||
# Ajouter le dossier parent (brain) au PYTHONPATH
|
||||
# sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
import pytest
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, Mock
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.infrastructure.persistence import Memory, set_memory
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"""Edge case tests for the Agent."""
|
||||
import pytest
|
||||
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.agent.agent import Agent
|
||||
from alfred.infrastructure.persistence import get_memory
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ class TestChatCompletionsEdgeCases:
|
||||
|
||||
def test_very_long_message(self, memory):
|
||||
"""Should handle very long user message."""
|
||||
from alfred.app import app
|
||||
from alfred.agent import agent
|
||||
from alfred.app import app
|
||||
|
||||
# Patch the agent's LLM directly
|
||||
mock_llm = Mock()
|
||||
@@ -33,8 +33,8 @@ class TestChatCompletionsEdgeCases:
|
||||
|
||||
def test_unicode_message(self, memory):
|
||||
"""Should handle unicode in message."""
|
||||
from alfred.app import app
|
||||
from alfred.agent import agent
|
||||
from alfred.app import app
|
||||
|
||||
mock_llm = Mock()
|
||||
mock_llm.complete.return_value = {
|
||||
@@ -59,8 +59,8 @@ class TestChatCompletionsEdgeCases:
|
||||
|
||||
def test_special_characters_in_message(self, memory):
|
||||
"""Should handle special characters."""
|
||||
from alfred.app import app
|
||||
from alfred.agent import agent
|
||||
from alfred.app import app
|
||||
|
||||
mock_llm = Mock()
|
||||
mock_llm.complete.return_value = {"role": "assistant", "content": "Response"}
|
||||
@@ -187,8 +187,8 @@ class TestChatCompletionsEdgeCases:
|
||||
|
||||
def test_many_messages(self, memory):
|
||||
"""Should handle many messages in conversation."""
|
||||
from alfred.app import app
|
||||
from alfred.agent import agent
|
||||
from alfred.app import app
|
||||
|
||||
mock_llm = Mock()
|
||||
mock_llm.complete.return_value = {"role": "assistant", "content": "Response"}
|
||||
@@ -301,8 +301,8 @@ class TestChatCompletionsEdgeCases:
|
||||
|
||||
def test_extra_fields_in_request(self, memory):
|
||||
"""Should ignore extra fields in request."""
|
||||
from alfred.app import app
|
||||
from alfred.agent import agent
|
||||
from alfred.app import app
|
||||
|
||||
mock_llm = Mock()
|
||||
mock_llm.complete.return_value = {"role": "assistant", "content": "Response"}
|
||||
@@ -325,8 +325,8 @@ class TestChatCompletionsEdgeCases:
|
||||
|
||||
def test_streaming_with_tool_call(self, memory, real_folder):
|
||||
"""Should handle streaming with tool execution."""
|
||||
from alfred.app import app
|
||||
from alfred.agent import agent
|
||||
from alfred.app import app
|
||||
from alfred.infrastructure.persistence import get_memory
|
||||
|
||||
mem = get_memory()
|
||||
@@ -371,8 +371,8 @@ class TestChatCompletionsEdgeCases:
|
||||
|
||||
def test_concurrent_requests_simulation(self, memory):
|
||||
"""Should handle rapid sequential requests."""
|
||||
from alfred.app import app
|
||||
from alfred.agent import agent
|
||||
from alfred.app import app
|
||||
|
||||
mock_llm = Mock()
|
||||
mock_llm.complete.return_value = {"role": "assistant", "content": "Response"}
|
||||
@@ -392,8 +392,8 @@ class TestChatCompletionsEdgeCases:
|
||||
|
||||
def test_llm_returns_json_in_response(self, memory):
|
||||
"""Should handle LLM returning JSON in text response."""
|
||||
from alfred.app import app
|
||||
from alfred.agent import agent
|
||||
from alfred.app import app
|
||||
|
||||
mock_llm = Mock()
|
||||
mock_llm.complete.return_value = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
"""Critical tests for configuration validation."""
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.agent.config import ConfigurationError, Settings
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
"""Edge case tests for configuration and parameters."""
|
||||
|
||||
import os
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.agent.config import ConfigurationError, Settings
|
||||
from alfred.agent.parameters import (
|
||||
REQUIRED_PARAMETERS,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"""Edge case tests for domain entities and value objects."""
|
||||
import pytest
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.domain.movies.entities import Movie
|
||||
from alfred.domain.movies.value_objects import MovieTitle, Quality, ReleaseYear
|
||||
from alfred.domain.shared.exceptions import ValidationError
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"""Tests for the Memory system."""
|
||||
import pytest
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.infrastructure.persistence import (
|
||||
EpisodicMemory,
|
||||
LongTermMemory,
|
||||
|
||||
@@ -4,6 +4,7 @@ import json
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.infrastructure.persistence import (
|
||||
EpisodicMemory,
|
||||
LongTermMemory,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import inspect
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.agent.prompts import PromptBuilder
|
||||
from alfred.agent.registry import Tool, _create_tool_from_function, make_tools
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Edge case tests for tool registry."""
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.agent.registry import Tool, make_tools
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"""Edge case tests for tools."""
|
||||
import pytest
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.agent.tools import api as api_tools
|
||||
from alfred.agent.tools import filesystem as fs_tools
|
||||
from alfred.infrastructure.persistence import get_memory
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"""Tests for filesystem tools."""
|
||||
import pytest
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.agent.tools import filesystem as fs_tools
|
||||
from alfred.infrastructure.persistence import get_memory
|
||||
|
||||
|
||||
Reference in New Issue
Block a user