Coder Social home page Coder Social logo

Streaming rows of markdown into a ChatFeed, Feed, or Column breaks the styling of subsequent appended rows and leads to overlap of text about panel HOT 5 OPEN

DmitriyLeybel avatar DmitriyLeybel commented on August 16, 2024
Streaming rows of markdown into a ChatFeed, Feed, or Column breaks the styling of subsequent appended rows and leads to overlap of text

from panel.

Comments (5)

philippjfr avatar philippjfr commented on August 16, 2024 1

Seems to be because something is setting max_height: 100%. Looking into it.

from panel.

ahuang11 avatar ahuang11 commented on August 16, 2024 1

I may have overridden that value in ChatMessage CSS, so it's possible that you can also workaround it with stylesheets

Maybe max-height: none

from panel.

philippjfr avatar philippjfr commented on August 16, 2024

The immediate cause is this bit of code in Bokeh

https://github.com/bokeh/bokeh/blob/04bde465230d8a27256fe80a19ca108a849efdf7/bokehjs/src/lib/models/layouts/layout_dom.ts#L333

which does not seem quite correct to me.

from panel.

DmitriyLeybel avatar DmitriyLeybel commented on August 16, 2024

I may have overridden that value in ChatMessage CSS, so it's possible that you can also workaround it with stylesheets

Maybe max-height: none

Appreciate the heads up, Andrew.

How are you handling the auto-scroll aspect?

This does partly seem to work as expected:

import panel as pn
import time

chat_column = pn.Column(height=200, width=400, scroll=True)
chat_input = pn.widgets.TextInput(placeholder='Type your message here...')
send_button = pn.widgets.Button(name='Send', button_type='primary')

def send_message(event):
    message = chat_input.value
    if message:
        message_pane = pn.pane.Markdown(
            '',
            stylesheets=["""
                :host {
                    max-height: none;
                }
                """])
        chat_column.append(message_pane)
        for word in message.split():
            message_pane.object += word + " "
            time.sleep(0.01)  
        chat_input.value = ''  

send_button.on_click(send_message)
pn.Column(chat_column, pn.Row(chat_input, send_button)).servable()
no_overlap_max_height_none.mp4

from panel.

ahuang11 avatar ahuang11 commented on August 16, 2024

It's done in the typescript side. Perhaps instead of watching for children, it should watch for scroll length from the bottom?

this.on_change(children, () => this.trigger_auto_scroll());

Maybe you can help contribute a fix for this if you're interested and we can get it for Panel 1.5.0

from panel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.