mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-06 22:32:39 +02:00
chore: linting
This commit is contained in:
parent
489dd0aa52
commit
4e174f17f2
8 changed files with 15 additions and 16 deletions
|
|
@ -130,7 +130,9 @@ async def create_multi_agent_chat_deep_agent(
|
||||||
|
|
||||||
_t0 = time.perf_counter()
|
_t0 = time.perf_counter()
|
||||||
try:
|
try:
|
||||||
mcp_tools_by_agent = await load_mcp_tools_by_connector(db_session, search_space_id)
|
mcp_tools_by_agent = await load_mcp_tools_by_connector(
|
||||||
|
db_session, search_space_id
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Degrade to builtins-only rather than aborting the turn: a transient
|
# Degrade to builtins-only rather than aborting the turn: a transient
|
||||||
# DB or MCP-server hiccup should not deny the user a response.
|
# DB or MCP-server hiccup should not deny the user a response.
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,6 @@ from ..shared.flags import enabled
|
||||||
|
|
||||||
|
|
||||||
def build_doom_loop_mw(flags: AgentFeatureFlags) -> DoomLoopMiddleware | None:
|
def build_doom_loop_mw(flags: AgentFeatureFlags) -> DoomLoopMiddleware | None:
|
||||||
return DoomLoopMiddleware(threshold=3) if enabled(flags, "enable_doom_loop") else None
|
return (
|
||||||
|
DoomLoopMiddleware(threshold=3) if enabled(flags, "enable_doom_loop") else None
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,7 @@ def build_permission_context(
|
||||||
Rule(permission=tool_def.name, pattern="*", action="deny")
|
Rule(permission=tool_def.name, pattern="*", action="deny")
|
||||||
)
|
)
|
||||||
if synthesized:
|
if synthesized:
|
||||||
rulesets.append(
|
rulesets.append(Ruleset(rules=synthesized, origin="connector_synthesized"))
|
||||||
Ruleset(rules=synthesized, origin="connector_synthesized")
|
|
||||||
)
|
|
||||||
|
|
||||||
general_purpose_interrupt_on: dict[str, bool] = {
|
general_purpose_interrupt_on: dict[str, bool] = {
|
||||||
rule.permission: True
|
rule.permission: True
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ class RateLimitError(Exception):
|
||||||
|
|
||||||
|
|
||||||
class _AlwaysFailingChatModel(BaseChatModel):
|
class _AlwaysFailingChatModel(BaseChatModel):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _llm_type(self) -> str:
|
def _llm_type(self) -> str:
|
||||||
return "always-failing-test-model"
|
return "always-failing-test-model"
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,7 @@ class _RecordingChatModel(BaseChatModel):
|
||||||
) -> ChatResult:
|
) -> ChatResult:
|
||||||
self.call_count += 1
|
self.call_count += 1
|
||||||
return ChatResult(
|
return ChatResult(
|
||||||
generations=[
|
generations=[ChatGeneration(message=AIMessage(content=self.response_text))]
|
||||||
ChatGeneration(message=AIMessage(content=self.response_text))
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _agenerate(
|
async def _agenerate(
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,9 @@ def test_extract_text_content_ignores_thinking_blocks_and_keeps_markdown_text()
|
||||||
assert extract_text_content(content).strip() == markdown.strip()
|
assert extract_text_content(content).strip() == markdown.strip()
|
||||||
|
|
||||||
|
|
||||||
def test_extract_text_content_returns_empty_when_only_thinking_blocks_are_present() -> None:
|
def test_extract_text_content_returns_empty_when_only_thinking_blocks_are_present() -> (
|
||||||
|
None
|
||||||
|
):
|
||||||
content = [
|
content = [
|
||||||
{"type": "thinking", "thinking": "No durable fact."},
|
{"type": "thinking", "thinking": "No durable fact."},
|
||||||
{"type": "thinking", "thinking": "Return no update."},
|
{"type": "thinking", "thinking": "Return no update."},
|
||||||
|
|
|
||||||
|
|
@ -141,9 +141,7 @@ class TestNormalizeDecision:
|
||||||
assert _normalize_permission_decision(decision) == {"decision_type": "reject"}
|
assert _normalize_permission_decision(decision) == {"decision_type": "reject"}
|
||||||
|
|
||||||
def test_lc_envelope_reject_with_message_carries_feedback(self) -> None:
|
def test_lc_envelope_reject_with_message_carries_feedback(self) -> None:
|
||||||
decision = {
|
decision = {"decisions": [{"type": "reject", "message": "wrong recipient"}]}
|
||||||
"decisions": [{"type": "reject", "message": "wrong recipient"}]
|
|
||||||
}
|
|
||||||
out = _normalize_permission_decision(decision)
|
out = _normalize_permission_decision(decision)
|
||||||
assert out == {"decision_type": "reject", "feedback": "wrong recipient"}
|
assert out == {"decision_type": "reject", "feedback": "wrong recipient"}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,7 @@ export default function PurchaseSuccessPage() {
|
||||||
"Stripe reported the checkout as failed or expired. Your card was not charged."}
|
"Stripe reported the checkout as failed or expired. Your card was not charged."}
|
||||||
{state.kind === "error" &&
|
{state.kind === "error" &&
|
||||||
"Don't worry — if your card was charged, your purchase will still apply within a minute or two."}
|
"Don't worry — if your card was charged, your purchase will still apply within a minute or two."}
|
||||||
{state.kind === "no_session" &&
|
{state.kind === "no_session" && "Your purchase is being applied to your account."}
|
||||||
"Your purchase is being applied to your account."}
|
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-3 text-center">
|
<CardContent className="space-y-3 text-center">
|
||||||
|
|
@ -134,7 +133,8 @@ export default function PurchaseSuccessPage() {
|
||||||
)}
|
)}
|
||||||
{state.kind === "completed" && state.data.purchase_type === "premium_tokens" && (
|
{state.kind === "completed" && state.data.purchase_type === "premium_tokens" && (
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
New premium credit balance: {formatCredit(state.data.premium_credit_micros_limit ?? 0)}
|
New premium credit balance:{" "}
|
||||||
|
{formatCredit(state.data.premium_credit_micros_limit ?? 0)}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{state.kind === "error" && (
|
{state.kind === "error" && (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue