Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Hdandria <henri.dandria@mistral.ai> Co-authored-by: Ivana Dunisijevic <ivana.dunisijevic@mistral.ai> Co-authored-by: Jean Burellier <sheplu@users.noreply.github.com> Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai> Co-authored-by: Mert Unsal <mert.unsal@mistral.ai> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Val <102326092+vdeva@users.noreply.github.com> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: renovate-mistral[bot] <253709520+renovate-mistral[bot]@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
24 lines
957 B
Python
24 lines
957 B
Python
from __future__ import annotations
|
|
|
|
from vibe.core.agent_loop import AgentLoop
|
|
from vibe.core.feedback import record_feedback_asked, should_show_feedback
|
|
from vibe.core.types import Role
|
|
|
|
|
|
class FeedbackBarManager:
|
|
"""Decides whether to show the feedback bar and records when feedback is given."""
|
|
|
|
def should_show(self, agent_loop: AgentLoop) -> bool:
|
|
user_message_count = (
|
|
sum(m.role == Role.user and not m.injected for m in agent_loop.messages)
|
|
+ 1 # +1 for the message the user just sent
|
|
)
|
|
return should_show_feedback(
|
|
telemetry_active=agent_loop.telemetry_client.is_active(),
|
|
is_mistral_model=agent_loop.config.is_active_model_mistral(),
|
|
user_message_count=user_message_count,
|
|
cache_store=agent_loop.cache_store,
|
|
)
|
|
|
|
def record_feedback_asked(self, agent_loop: AgentLoop) -> None:
|
|
record_feedback_asked(agent_loop.cache_store)
|