taipy icon indicating copy to clipboard operation
taipy copied to clipboard

[Refactor] Chat control height property should force widget height regardless of messages

Open AlexandreSajus opened this issue 1 year ago • 0 comments

Description

Setting height when using the chat control should limit the chat window's height regardless of the messages' size. Currently, it overflows: image

The chat window should have a fixed size defined by the height property: image

Take https://demo-llm-chat.taipy.cloud/ as reference

Example code (just type long messages to reproduce):

from taipy.gui import Gui, Icon

msgs = [
    ["1", "msg 1", "Fred"],
    ["2", "msg From Another unknown User", "Fredo"],
    ["3", "This from the sender User", "taipy"],
    ["4", "And from another known one", "Fredi"],
]

users = [
    ["Fred", Icon("/images/favicon.png", "Fred.png")],
    ["Fredi", Icon("/images/fred.png", "Fred.png")],
]


def button_action(state, var_name: str, payload: dict):
    args = payload.get("args", [])
    msgs.append([f"{len(msgs) +1 }", args[2], "Fred"])
    state.msgs = msgs


Gui(
    """
<|{msgs}|chat|users={users}|on_action=button_action|height=300|sender_id=Me|>
""",
    path_mapping={"images": "c:\\users\\jeu\\downloads"},
).run()

Acceptance Criteria

  • [ ] Ensure new code is unit tested, and check code coverage is at least 90%.
  • [ ] Propagate any change on the demos and run all of them to ensure there is no breaking change.
  • [ ] Ensure any change is well documented.

Code of Conduct

  • [X] I have checked the existing issues.
  • [ ] I am willing to work on this issue (optional)

AlexandreSajus avatar Jul 25 '24 19:07 AlexandreSajus