Ahmed Moubtahij
Ahmed Moubtahij
SSolara
Created by Ahmed Moubtahij on 1/17/2025 in #questions-issues
Multiline ChatInput
Ah, found the solution: I needed update_events=["keyup.enter.exact"]
3 replies
SSolara
Created by Ahmed Moubtahij on 1/17/2025 in #questions-issues
Multiline ChatInput
solara.lab.ChatInput(send_callback=register_user_msg)
solara.lab.ChatInput(send_callback=register_user_msg)
text_input = sol.use_reactive("")
sol.InputTextArea(
label="",
value=text_input,
auto_grow=True,
rows=1,
continuous_update=False,
update_events=["keyup.enter"],
on_value=lambda msg: (
register_user_msg(msg),
text_input.set("")
) if msg.strip() else None,
)
text_input = sol.use_reactive("")
sol.InputTextArea(
label="",
value=text_input,
auto_grow=True,
rows=1,
continuous_update=False,
update_events=["keyup.enter"],
on_value=lambda msg: (
register_user_msg(msg),
text_input.set("")
) if msg.strip() else None,
)
3 replies
SSolara
Created by Ahmed Moubtahij on 1/1/2025 in #questions-issues
Clearing a component
Got it, thank you
4 replies
SSolara
Created by Ahmed Moubtahij on 1/1/2025 in #questions-issues
Clearing a component
Or is the idea of Solara that I shouldn't worry about a non-visible iframe resource and that it will clean it up when it deems it appropriate?
4 replies
SSolara
Created by Ahmed Moubtahij on 9/12/2024 in #questions-issues
rendering pdf
Yep, reorganizing project structure to have ../public relative to the running .py worked! Thank you 🙏
11 replies
SSolara
Created by Ahmed Moubtahij on 9/12/2024 in #questions-issues
rendering pdf
Oh I see, indeed, I'll fix that tonight, thanks! (Yeah other basic components work)
only show the iframe when the task is done (i.,e. when the file is written)
Did you mean something like this?
if (out_pdf := solara.lab.use_task(generate_pdf, dependencies=[])).finished:
solara.HTML(
tag="iframe",
attributes={"src": f"/static/{out_pdf.value}", "style": "width:100%; height:100%;"},
)
else:
solara.ProgressLinear(out_pdf.pending)
if (out_pdf := solara.lab.use_task(generate_pdf, dependencies=[])).finished:
solara.HTML(
tag="iframe",
attributes={"src": f"/static/{out_pdf.value}", "style": "width:100%; height:100%;"},
)
else:
solara.ProgressLinear(out_pdf.pending)
11 replies
SSolara
Created by Ahmed Moubtahij on 9/12/2024 in #questions-issues
rendering pdf
PUBLIC_DIR = Path("public/")
PDF_PATH = PUBLIC_DIR/"my_cv.pdf"

@solara.component
def Page():
with solara.Column(style={"height": "100%", "width": "100%"}):
solara.lab.use_task(generate_pdf, dependencies=[])
solara.HTML(f'<iframe src="/static/{str(PDF_PATH)}" style="width:100%; height:100%;"></iframe>')
PUBLIC_DIR = Path("public/")
PDF_PATH = PUBLIC_DIR/"my_cv.pdf"

@solara.component
def Page():
with solara.Column(style={"height": "100%", "width": "100%"}):
solara.lab.use_task(generate_pdf, dependencies=[])
solara.HTML(f'<iframe src="/static/{str(PDF_PATH)}" style="width:100%; height:100%;"></iframe>')
Replaced with use_task. It is more appropriate, thanks! I was already using "public/" in the pdf path though, I made it clearer. Here is what my project structure looks like:
├── Dockerfile
├── README.md
├── __init__.py
├── compose.yaml
├── public
│   └── my_cv.pdf
├── requirements.txt
└── ui.py
├── Dockerfile
├── README.md
├── __init__.py
├── compose.yaml
├── public
│   └── my_cv.pdf
├── requirements.txt
└── ui.py
The browser just shows A widget with mount-id="solara-main" should go here
11 replies