Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions backend/src/timeflow/business/calendar/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,))

Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions backend/src/timeflow/infrastructure/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
LUPENGHAN marked this conversation as resolved.
agent_max_tool_rounds: int = 4
aliyun_tts_ws_url: str = ""
aliyun_tts_api_key: str = ""
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions backend/src/timeflow/intelligence/schedule_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion backend/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading