From 0f0583e8d5f95039a20498cd5ac72a759ab27e63 Mon Sep 17 00:00:00 2001 From: Andrew <15331990+ahuang11@users.noreply.github.com> Date: Mon, 5 Aug 2024 09:06:54 -0700 Subject: [PATCH] Export column analyses (#638) --- lumen/ai/export.py | 8 ++++++++ lumen/ai/views.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lumen/ai/export.py b/lumen/ai/export.py index 5731cd336..ad9814bfe 100644 --- a/lumen/ai/export.py +++ b/lumen/ai/export.py @@ -5,6 +5,9 @@ import nbformat +from panel import Column +from panel.chat import ChatStep + from lumen.ai.views import LumenOutput from lumen.pipeline import Pipeline from lumen.views import View @@ -59,6 +62,11 @@ def export_notebook(assistant, preamble: str = ""): cells += format_markdown(msg) elif isinstance(msg.object, LumenOutput): cells += format_output(msg) + elif isinstance(msg.object, Column): + for obj in msg.object: + if isinstance(obj, ChatStep): + continue + cells += format_output(obj) nb = nbformat.v4.new_notebook(cells=cells) return nbformat.v4.writes(nb) diff --git a/lumen/ai/views.py b/lumen/ai/views.py index a9d347fd5..daa78cf31 100644 --- a/lumen/ai/views.py +++ b/lumen/ai/views.py @@ -138,7 +138,7 @@ def __init__(self, **params): if config_options: options = pn.Param(self.analysis.param, parameters=config_options) b = pn.widgets.Button(icon='rocket', name='Run...', on_click=self._rerun, button_type='success', margin=20) - self._tabs.insert(0, ('Config', pn.Column(options, b))) + self._tabs.insert(1, ('Config', pn.Column(options, b))) with discard_events(self): self._tabs.active = 2