mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-06 22:12:12 +02:00
Scoped codemod over surfsense_backend/app (excluding routes/, Wave E): renames search_space_id -> workspace_id, search_space -> workspace, SearchSpace -> Workspace across services, utils, tasks, agents, gateway, event_bus, notifications, podcasts, automations, observability params, and prompt .md files. Also flips the camelCase payload key searchSpaceId -> workspaceId (no backend reader; hard cutover). Preserved carve-outs (verbatim): Celery task names "delete_search_space_background" and "ai_sort_search_space" (wire names), and the OTel/metric key "search_space.id" (dashboards depend on it). Enum values 'SEARCH_SPACE' and SearchSourceConnector untouched.
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
"""Propose a podcast's initial brief spec."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.podcasts.duration_limits import DEFAULT_MAX_SECONDS, DEFAULT_MIN_SECONDS
|
|
from app.podcasts.persistence import PodcastRepository
|
|
from app.podcasts.schemas import PodcastSpec
|
|
from app.podcasts.service import preferences_from
|
|
|
|
from .config import DEFAULT_SPEAKER_COUNT
|
|
from .graph import graph as brief_graph
|
|
from .state import BriefState
|
|
|
|
|
|
async def propose_brief(
|
|
session: AsyncSession,
|
|
*,
|
|
workspace_id: int,
|
|
speaker_count: int = DEFAULT_SPEAKER_COUNT,
|
|
min_seconds: int = DEFAULT_MIN_SECONDS,
|
|
max_seconds: int = DEFAULT_MAX_SECONDS,
|
|
focus: str | None = None,
|
|
) -> PodcastSpec:
|
|
"""Reuse the last-used language and voices, else English; return the spec."""
|
|
last_language, last_voices = preferences_from(
|
|
await PodcastRepository(session).latest_with_spec(workspace_id)
|
|
)
|
|
config = {
|
|
"configurable": {
|
|
"speaker_count": speaker_count,
|
|
"min_seconds": min_seconds,
|
|
"max_seconds": max_seconds,
|
|
"focus": focus,
|
|
"last_used_language": last_language,
|
|
"last_used_voices": last_voices,
|
|
}
|
|
}
|
|
result = await brief_graph.ainvoke(BriefState(), config=config)
|
|
return result["spec"]
|