pgml-dashboard/src/components/code_editor/editor/template.html
% use crate::components::inputs::select::Select; use crate::components::stimulus::stimulus_target::StimulusTarget; use crate::components::stimulus::stimulus_action::{StimulusAction, StimulusEvents}; use crate::components::code_block::CodeBlock; use crate::utils::random_string; let code_block_id = format!("code-block-{}", random_string(5)); let btn = if btn_style == "party" { format!(r#"
Run "#) } else { format!(r#" Run "#) }; %>
<% if show_task {%> Task: <%+ Select::new().options(vec!["text-generation", "embeddings", "summarization", "translation",]) .name("task-select") .value_target( StimulusTarget::new() .controller("code-editor-editor") .name("task") ) .action( StimulusAction::new() .controller("code-editor-editor") .method("taskChange") .action(StimulusEvents::Change) ) %> <% } %> <% if show_model {%> Model: <%+ Select::new().options(vec![// Models are marked as C (cpu) G (gpu) // The number is the average time it takes to run in seconds // text-generation "meta-llama/Meta-Llama-3.1-8B-Instruct", // G "meta-llama/Meta-Llama-3.1-70B-Instruct", // G "mistralai/Mixtral-8x7B-Instruct-v0.1", // G "mistralai/Mistral-7B-Instruct-v0.2", // G // Embeddings "intfloat/e5-small-v2", "Alibaba-NLP/gte-large-en-v1.5", "mixedbread-ai/mxbai-embed-large-v1", // Translation "google-t5/t5-base", // Summarization "google/pegasus-xsum",]) .name("model-select") .value_target( StimulusTarget::new() .controller("code-editor-editor") .name("model") ) .action( StimulusAction::new() .controller("code-editor-editor").method("modelChange") .action(StimulusEvents::Change) ) %> <% } %> <% if show_question_input {%>
Question: <% if btn_location == "question-header" {%> <%- btn %> <% } %> <% } %>
<%+ CodeBlock::new(&content.unwrap_or_default()) .set_language("sql") .set_editable(is_editable) .set_id(&code_block_id) %> <% if btn_location == "text-area" {%> <%- btn %> <% } %>
<% if show_question_input {%> Answer: <% } %>
Loading non-cached models may take a few moments
[{“translation_text”:”Bienvenue à l'avenir!”}]
<%= default_result %>