diff --git a/backend/src/timeflow/business/calendar/service.py b/backend/src/timeflow/business/calendar/service.py index 60d94e14..c38dea3d 100644 --- a/backend/src/timeflow/business/calendar/service.py +++ b/backend/src/timeflow/business/calendar/service.py @@ -203,8 +203,10 @@ def create_schedule( ) except Exception as exc: logger.warning( - "schedule category task could not be submitted; leaving category null", - extra={"error_type": type(exc).__name__}, + "schedule category task could not be submitted (error_type=%s): %s; " + "leaving category null", + type(exc).__name__, + exc, ) return ScheduleMutationResult(schedules=(persisted,)) @@ -233,13 +235,17 @@ def _classify_and_persist_category( self._category_event_publisher(account_id, schedule_id, category) except Exception as exc: logger.warning( - "schedule category event could not be published", - extra={"error_type": type(exc).__name__}, + "schedule category event could not be published " + "(error_type=%s): %s", + type(exc).__name__, + exc, ) except Exception as exc: logger.warning( - "schedule category result could not be persisted; leaving category null", - extra={"error_type": type(exc).__name__}, + "schedule category result could not be persisted (error_type=%s): %s; " + "leaving category null", + type(exc).__name__, + exc, ) def _classify_category(self, command: CreateScheduleCommand) -> ScheduleCategory | None: @@ -249,8 +255,10 @@ def _classify_category(self, command: CreateScheduleCommand) -> ScheduleCategory category = self._category_classifier.classify(command) except Exception as exc: logger.warning( - "schedule category classifier raised unexpectedly; leaving category null", - extra={"error_type": type(exc).__name__}, + "schedule category classifier raised unexpectedly (error_type=%s): %s; " + "leaving category null", + type(exc).__name__, + exc, ) return None if category is None: diff --git a/backend/src/timeflow/infrastructure/settings.py b/backend/src/timeflow/infrastructure/settings.py index be555524..f034b0e5 100644 --- a/backend/src/timeflow/infrastructure/settings.py +++ b/backend/src/timeflow/infrastructure/settings.py @@ -47,7 +47,7 @@ class Settings: openai_api_key: str = "" openai_model: str = "qwen-flash" openai_timeout_seconds: float = 30.0 - schedule_category_timeout_seconds: float = 5.0 + schedule_category_timeout_seconds: float = 10.0 agent_max_tool_rounds: int = 4 aliyun_tts_ws_url: str = "" aliyun_tts_api_key: str = "" @@ -96,7 +96,7 @@ def from_environment(cls, env_file: Path | str = ".env") -> "Settings": openai_timeout_seconds = float(environ.get("TIMEFLOW_OPENAI_TIMEOUT_SECONDS", "30.0")) schedule_category_timeout_seconds = float( - environ.get("TIMEFLOW_SCHEDULE_CATEGORY_TIMEOUT_SECONDS", "5.0") + environ.get("TIMEFLOW_SCHEDULE_CATEGORY_TIMEOUT_SECONDS", "10.0") ) agent_max_tool_rounds = int(environ.get("TIMEFLOW_AGENT_MAX_TOOL_ROUNDS", "4")) tencent_map_timeout_seconds = float( diff --git a/backend/src/timeflow/intelligence/schedule_category.py b/backend/src/timeflow/intelligence/schedule_category.py index d460e8ff..ac5d86db 100644 --- a/backend/src/timeflow/intelligence/schedule_category.py +++ b/backend/src/timeflow/intelligence/schedule_category.py @@ -44,8 +44,10 @@ def classify(self, command: CreateScheduleCommand) -> ScheduleCategory | None: return ScheduleCategory(category) except Exception as exc: logger.warning( - "schedule category classification failed; leaving category null", - extra={"error_type": type(exc).__name__}, + "schedule category classification failed (error_type=%s): %s; " + "leaving category null", + type(exc).__name__, + exc, ) return None diff --git a/backend/tests/test_settings.py b/backend/tests/test_settings.py index ea356d01..ee3b4c8d 100644 --- a/backend/tests/test_settings.py +++ b/backend/tests/test_settings.py @@ -173,7 +173,7 @@ def test_settings_use_qwen_llm_defaults( assert settings.openai_api_key == "" assert settings.openai_model == "qwen-flash" assert settings.openai_timeout_seconds == 30.0 - assert settings.schedule_category_timeout_seconds == 5.0 + assert settings.schedule_category_timeout_seconds == 10.0 assert settings.openai_is_configured() is False assert settings.agent_max_tool_rounds == 4 assert settings.voice_agent_mode == "1"