feature: Add message feedback and update frontend interface (#5022)
* add style for message feedback * add backend suprot to new feature * update frontend interface and add handle function * [autofix.ci] apply automated fixes * Update tooltip content for bot messages * Update evaluation icons styling * Add custom thumb icons for thumbs up and thumbs down * Add custom thumb icons for thumbs up and thumbs down * Update thumb icons based on evaluation value * [autofix.ci] apply automated fixes * Update property name for positive feedback * Update property name for positive feedback * feat: Add data-testid attributes to helpful and not helpful buttons and update test of playground to include new functionality * update test to include new message features
This commit is contained in:
parent
4be6b04d8c
commit
02fbb450db
14 changed files with 258 additions and 61 deletions
|
|
@ -92,14 +92,14 @@ async def update_message(
|
|||
|
||||
try:
|
||||
message_dict = message.model_dump(exclude_unset=True, exclude_none=True)
|
||||
message_dict["edit"] = True
|
||||
if "text" in message_dict and message_dict["text"] != db_message.text:
|
||||
message_dict["edit"] = True
|
||||
db_message.sqlmodel_update(message_dict)
|
||||
session.add(db_message)
|
||||
await session.commit()
|
||||
await session.refresh(db_message)
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e)) from e
|
||||
|
||||
return db_message
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class Properties(BaseModel):
|
|||
source: Source = Field(default_factory=Source)
|
||||
icon: str | None = None
|
||||
allow_markdown: bool = False
|
||||
positive_feedback: bool | None = None
|
||||
state: Literal["partial", "complete"] = "complete"
|
||||
targets: list = []
|
||||
|
||||
|
|
|
|||
|
|
@ -160,3 +160,4 @@ class MessageUpdate(SQLModel):
|
|||
files: list[str] | None = None
|
||||
edit: bool | None = None
|
||||
error: bool | None = None
|
||||
properties: Properties | None = None
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ class TestChatInput(ComponentTestBaseWithClient):
|
|||
"background_color": default_kwargs["background_color"],
|
||||
"text_color": default_kwargs["text_color"],
|
||||
"icon": default_kwargs["chat_icon"],
|
||||
"positive_feedback": None,
|
||||
"edited": False,
|
||||
"source": {"id": None, "display_name": None, "source": None},
|
||||
"allow_markdown": False,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue