forked from retoor/devplacepy
fix: normalize unicode escape sequences and reformat multi-line expressions across codebase
This commit is contained in:
@@ -87,8 +87,13 @@ def _make_executor(
|
||||
|
||||
async def execute(prompt: str) -> str:
|
||||
worker = Agent(
|
||||
settings, llm, dispatcher, tools,
|
||||
lessons=lessons, cost_tracker=cost_tracker, chunk_store=chunk_store,
|
||||
settings,
|
||||
llm,
|
||||
dispatcher,
|
||||
tools,
|
||||
lessons=lessons,
|
||||
cost_tracker=cost_tracker,
|
||||
chunk_store=chunk_store,
|
||||
)
|
||||
return await worker.respond(prompt)
|
||||
|
||||
@@ -113,6 +118,7 @@ def _resolve_owner(settings: Settings) -> tuple[str, str]:
|
||||
same per-user memory, tasks, and admin analytics as the web session for that account."""
|
||||
try:
|
||||
from devplacepy.database import db, get_table
|
||||
|
||||
if "users" not in db.tables:
|
||||
return "user", "cli"
|
||||
users = get_table("users")
|
||||
@@ -132,12 +138,18 @@ def _build_stores(owner_kind: str, owner_id: str):
|
||||
if owner_id == "cli":
|
||||
owned_db = dataset.connect(f"sqlite:///{CLI_TASKS_DB}")
|
||||
else:
|
||||
from devplacepy.database import db as owned_db # share the platform DB for this account
|
||||
return TaskStore(owned_db, owner_kind, owner_id), LessonStore(owned_db, owner_kind, owner_id)
|
||||
from devplacepy.database import (
|
||||
db as owned_db,
|
||||
) # share the platform DB for this account
|
||||
return TaskStore(owned_db, owner_kind, owner_id), LessonStore(
|
||||
owned_db, owner_kind, owner_id
|
||||
)
|
||||
|
||||
|
||||
async def run(settings: Settings, prompt: Optional[str] = None) -> None:
|
||||
client = PlatformClient(settings.base_url, settings.timeout_seconds, settings.platform_api_key)
|
||||
client = PlatformClient(
|
||||
settings.base_url, settings.timeout_seconds, settings.platform_api_key
|
||||
)
|
||||
llm = LLMClient(settings)
|
||||
greeting = await _bootstrap_auth(client, settings)
|
||||
|
||||
@@ -147,15 +159,27 @@ async def run(settings: Settings, prompt: Optional[str] = None) -> None:
|
||||
cost_tracker = CostTracker()
|
||||
chunk_store = ChunkStore()
|
||||
agentic = AgenticController(lessons, settings)
|
||||
dispatcher = Dispatcher(CATALOG, client, settings, controller, agentic, is_admin=True)
|
||||
dispatcher = Dispatcher(
|
||||
CATALOG, client, settings, controller, agentic, is_admin=True
|
||||
)
|
||||
tools = CATALOG.tool_schemas_for(client.authenticated, is_admin=True)
|
||||
agentic.bind(
|
||||
llm=llm, dispatcher=dispatcher, tools=tools,
|
||||
on_trace=_trace, cost_tracker=cost_tracker, chunk_store=chunk_store,
|
||||
llm=llm,
|
||||
dispatcher=dispatcher,
|
||||
tools=tools,
|
||||
on_trace=_trace,
|
||||
cost_tracker=cost_tracker,
|
||||
chunk_store=chunk_store,
|
||||
)
|
||||
agent = Agent(
|
||||
settings, llm, dispatcher, tools,
|
||||
lessons=lessons, on_trace=_trace, cost_tracker=cost_tracker, chunk_store=chunk_store,
|
||||
settings,
|
||||
llm,
|
||||
dispatcher,
|
||||
tools,
|
||||
lessons=lessons,
|
||||
on_trace=_trace,
|
||||
cost_tracker=cost_tracker,
|
||||
chunk_store=chunk_store,
|
||||
)
|
||||
|
||||
if prompt is not None:
|
||||
@@ -216,11 +240,19 @@ def _parse_args(argv: Optional[list[str]] = None) -> argparse.Namespace:
|
||||
prog="devii",
|
||||
description="Agentic chat assistant that manages a DevPlace account.",
|
||||
)
|
||||
parser.add_argument("-p", "--prompt", help="Run a single prompt non-interactively and exit.")
|
||||
parser.add_argument("--api-key", help="DevPlace API key for automatic authentication (Bearer).")
|
||||
parser.add_argument(
|
||||
"-p", "--prompt", help="Run a single prompt non-interactively and exit."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--api-key", help="DevPlace API key for automatic authentication (Bearer)."
|
||||
)
|
||||
parser.add_argument("--email", help="Login email for automatic basic-auth login.")
|
||||
parser.add_argument("--password", help="Login password for automatic basic-auth login.")
|
||||
parser.add_argument("--basic-auth", help="Shorthand credentials in the form email:password.")
|
||||
parser.add_argument(
|
||||
"--password", help="Login password for automatic basic-auth login."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--basic-auth", help="Shorthand credentials in the form email:password."
|
||||
)
|
||||
parser.add_argument("--base-url", help="Override the platform base URL.")
|
||||
parser.add_argument("--ai-url", help="Override the model endpoint URL.")
|
||||
parser.add_argument("--ai-key", help="Override the model API key.")
|
||||
@@ -248,7 +280,14 @@ def _settings_from_args(args: argparse.Namespace) -> Settings:
|
||||
return replace(settings, **overrides)
|
||||
|
||||
|
||||
NOISY_LOGGERS = ("httpcore", "httpx", "httpcore.http11", "httpcore.connection", "asyncio", "urllib3")
|
||||
NOISY_LOGGERS = (
|
||||
"httpcore",
|
||||
"httpx",
|
||||
"httpcore.http11",
|
||||
"httpcore.connection",
|
||||
"asyncio",
|
||||
"urllib3",
|
||||
)
|
||||
|
||||
|
||||
def main(argv: Optional[list[str]] = None) -> None:
|
||||
|
||||
Reference in New Issue
Block a user