fix(bot): better buttons

This commit is contained in:
h
2026-01-21 02:51:59 +01:00
parent e1e0670d0e
commit 058ec809ff
3 changed files with 12 additions and 7 deletions

View File

@@ -202,7 +202,7 @@ async def process_message_from_web( # noqa: C901, PLR0912, PLR0915
follow_up_agent = create_follow_up_agent( follow_up_agent = create_follow_up_agent(
api_key=api_key, model_name=follow_up_model, system_prompt=follow_up_prompt api_key=api_key, model_name=follow_up_model, system_prompt=follow_up_prompt
) )
follow_ups = await get_follow_ups(follow_up_agent, full_history) follow_ups = await get_follow_ups(follow_up_agent, full_history, chat_images)
if state: if state:
await state.stop_typing() await state.stop_typing()
@@ -336,7 +336,7 @@ async def process_message(
follow_up_agent = create_follow_up_agent( follow_up_agent = create_follow_up_agent(
api_key=api_key, model_name=follow_up_model, system_prompt=follow_up_prompt api_key=api_key, model_name=follow_up_model, system_prompt=follow_up_prompt
) )
follow_ups = await get_follow_ups(follow_up_agent, full_history) follow_ups = await get_follow_ups(follow_up_agent, full_history, chat_images)
await state.stop_typing() await state.stop_typing()

View File

@@ -99,15 +99,17 @@ async def stream_response( # noqa: PLR0913
async def get_follow_ups( async def get_follow_ups(
follow_up_agent: Agent[None, FollowUpOptions], follow_up_agent: Agent[None, FollowUpOptions],
history: list[dict[str, str]], history: list[dict[str, str]],
image: ImageData | None = None, images: list[ImageData] | None = None,
) -> list[str]: ) -> list[str]:
message_history = build_message_history(history) if history else None message_history = build_message_history(history) if history else None
if image: if images:
prompt: list[str | BinaryContent] = [ prompt: list[str | BinaryContent] = [
"Suggest follow-up options based on this conversation and image.", "Suggest follow-up options based on this conversation and images.",
BinaryContent(data=image.data, media_type=image.media_type),
] ]
prompt.extend(
BinaryContent(data=img.data, media_type=img.media_type) for img in images
)
else: else:
prompt = "Suggest follow-up questions based on this conversation." # type: ignore[assignment] prompt = "Suggest follow-up questions based on this conversation." # type: ignore[assignment]

View File

@@ -15,7 +15,10 @@ When asked for DETAILS on a specific problem (or a problem number):
EXAM_FOLLOW_UP = """You see a problem set image. List available problem numbers. EXAM_FOLLOW_UP = """You see a problem set image. List available problem numbers.
Output only the numbers that exist in the image, like: 1, 2, 3, 4, 5 Output only the numbers that exist in the image, like: 1, 2, 3, 4, 5
If problems have letters (a, b, c), list them as: 1a, 1b, 2a, etc. If problems have letters (a, b, c), list them as: 1a, 1b, 2a, etc.
Keep it minimal - just the identifiers.""" Keep it minimal - just the identifiers.
Then, if applicable, output some possible followups of conversation
If there is a problem set, you MUST output ALL of problem numbers/letters,
before another followups"""
DEFAULT_FOLLOW_UP = ( DEFAULT_FOLLOW_UP = (
"Based on the conversation, suggest 3 short follow-up questions " "Based on the conversation, suggest 3 short follow-up questions "