fix(komodo,config): fresh pagerless shell per exec, panel and api injects framed as the user
This commit is contained in:
@@ -13,6 +13,7 @@ from beaver_gateway.core.conversations import (
|
||||
SeedContext,
|
||||
)
|
||||
from beaver_gateway.core.distill import DistillContext, Distiller, LineCap
|
||||
from beaver_gateway.core.injects import INTERRUPTED_TURN, InjectContext
|
||||
from beaver_gateway.core.prompt import assemble
|
||||
from beaver_gateway.core.registry import Gateway
|
||||
from beaver_gateway.core.rotation import HandoutContext, RotationPolicy
|
||||
@@ -435,7 +436,27 @@ def distill_prompt(ctx: DistillContext) -> str:
|
||||
return DISTILL.format(chat=ctx.chat_name, reason=ctx.reason, day=day, path=path)
|
||||
|
||||
|
||||
# Панель и API - это сам Бобёр (single-user); остальные origin - крон, watch,
|
||||
# komodo, ротация - не он.
|
||||
BEAVER_ORIGINS = frozenset({"panel", "api"})
|
||||
|
||||
|
||||
def inject_header(ctx: InjectContext) -> str:
|
||||
if ctx.origin in BEAVER_ORIGINS:
|
||||
head = (
|
||||
"[инжект из панели: это Бобёр, ответ он видит в панели; "
|
||||
"в телегу - только через say]"
|
||||
)
|
||||
else:
|
||||
head = (
|
||||
f"[инжект: {ctx.origin} - это не Бобёр, отвечать не нужно, "
|
||||
"голос не обязателен]"
|
||||
)
|
||||
return f"{head}\n{INTERRUPTED_TURN}" if ctx.interrupted_turn else head
|
||||
|
||||
|
||||
texts = ConversationTexts(
|
||||
inject_header=inject_header,
|
||||
merge_prompt=_read(GRANULES / "слив.md") or ConversationTexts().merge_prompt,
|
||||
seed=seed_body,
|
||||
handout=handout_prompt,
|
||||
|
||||
Reference in New Issue
Block a user