Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vtk_prompt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def main(
top_k=top_k,
rag=rag,
retry_attempts=retry_attempts,
_provider=provider,
provider=provider,
custom_prompt=custom_prompt_data,
)

Expand Down
4 changes: 2 additions & 2 deletions src/vtk_prompt/generate_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ def main(
f.write(xml_content)
logger.info("VTK XML content written to %s", output)
else:
print(xml_content)
logger.info(xml_content)
else:
logger.warning("Generated content may not be valid VTK XML")
if output:
with open(output, "w") as f:
f.write(xml_content)
logger.info("Content written to %s (please verify)", output)
else:
print(xml_content)
logger.info(xml_content)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion src/vtk_prompt/rag_chat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def main(database: str, collection_name: str, top_k: int, model: str) -> None:
try:
reply = chat.ask(user_input, collection_name, top_k, streaming=True)
for item in reply["response"]:
print(item.delta, end="")
logger.info(item.delta)
full_reply += item.delta

logger.info("\n Here are some relevant references:")
Expand Down
2 changes: 1 addition & 1 deletion src/vtk_prompt/state/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def initialize_state(app: Any) -> None:
"""Initialize application state variables."""
# App state variables
app.state.query_text = ""
app.state.query_text = "Create a red sphere with lighting"
app.state.generated_code = ""
app.state.generated_explanation = ""
app.state.is_loading = False
Expand Down
16 changes: 2 additions & 14 deletions src/vtk_prompt/ui/layout/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,17 @@ def build_content(layout: Any, app: Any) -> None:
classes="mb-2",
v_show="!use_cloud_models",
)
vuetify.VSpacer()
# API token warning chip
vuetify.VChip(
"API token is required for cloud models.",
small=True,
color="error",
text_color="white",
label=True,
classes="mb-2",
v_show="use_cloud_models && !api_token.trim()",
prepend_icon="mdi-alert",
)

with html.Div(classes="d-flex", style="height: calc(100% - 75px);"):
# Query input
vuetify.VTextarea(
label="Describe VTK visualization",
v_model=("query_text", ""),
v_model=("query_text", "Create a red sphere with lighting"),
rows=4,
variant="outlined",
placeholder=("e.g., Create a red sphere with lighting"),
hide_details=True,
no_resize=True,
clearable=True,
)
# Generate button
vuetify.VBtn(
Expand Down
4 changes: 2 additions & 2 deletions src/vtk_prompt/ui/layout/settings_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ def build_settings_dialog(layout: Any, app: Any) -> None:
with vuetify.VRow(cols=12):
with vuetify.VCol(cols=6):
vuetify.VBtn(
"Download Conversation File",
"Conversation File",
color="secondary",
classes="mr-2 mt-2 w-100",
click="download_conversation_file",
append_icon="mdi-download",
)
with vuetify.VCol(cols=6):
vuetify.VBtn(
"Download Prompt File",
"Prompt File",
color="secondary",
classes="mr-2 mt-2 w-100",
click="download_prompt_file",
Expand Down
18 changes: 15 additions & 3 deletions src/vtk_prompt/vtk_prompt_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""

import sys
import textwrap
from typing import Any

import vtk
Expand Down Expand Up @@ -261,11 +262,22 @@ def start(self) -> None:
self.server.start()


def _print_startup_banner() -> None:
"""Print a styled startup banner with ANSI colors."""
banner = textwrap.dedent("""\
\033[36m╭────────────────────────────────────────────────────────────────────╮
│ \033[1mVTK Prompt UI\033[0m\033[36m │
│ \033[97mEnter your API token in the application settings.\033[36m │
│ \033[97mSupported providers: OpenAI, Anthropic, Gemini, NVIDIA NIM\033[36m │
│ \033[97mFor local Ollama, use custom base URL and model config.\033[36m │
╰────────────────────────────────────────────────────────────────────╯\033[0m
""")
print(banner)


def main() -> None:
"""Start the trame app."""
print("VTK Prompt UI - Enter your API token in the application settings.")
print("Supported providers: OpenAI, Anthropic, Google Gemini, NVIDIA NIM")
print("For local Ollama, use custom base URL and model configuration.")
_print_startup_banner()

# Check for custom prompt file in CLI arguments
custom_prompt_file = None
Expand Down