Skip to content

Commit

Permalink
fix: relocate share conv button
Browse files Browse the repository at this point in the history
  • Loading branch information
taprosoft committed Feb 1, 2025
1 parent 906c6fc commit 9a3c064
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
9 changes: 9 additions & 0 deletions libs/ktem/ktem/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ function run() {
);
chat_setting_panel.insertBefore(citation_dropdown, mindmap_checkbox);

// move share conv checkbox
let report_div = document.querySelector(
"#report-accordion > div:nth-child(3) > div:nth-child(1)"
);
let share_conv_checkbox = document.getElementById("is-public-checkbox");
if (share_conv_checkbox) {
report_div.insertBefore(share_conv_checkbox, report_div.querySelector("button"));
}

// create slider toggle
const is_public_checkbox = document.getElementById("suggest-chat-checkbox");
const label_element = is_public_checkbox.getElementsByTagName("label")[0];
Expand Down
7 changes: 5 additions & 2 deletions libs/ktem/ktem/pages/chat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from .report import ReportIssue

KH_DEMO_MODE = getattr(flowsettings, "KH_DEMO_MODE", False)
KH_SSO_ENABLED = getattr(flowsettings, "KH_SSO_ENABLED", False)
KH_WEB_SEARCH_BACKEND = getattr(flowsettings, "KH_WEB_SEARCH_BACKEND", None)
WebSearch = None
if KH_WEB_SEARCH_BACKEND:
Expand Down Expand Up @@ -318,7 +319,9 @@ def on_building_ui(self):
) as self.chat_settings:
with gr.Row(elem_id="quick-setting-labels"):
gr.HTML("Reasoning method")
gr.HTML("Model", visible=not KH_DEMO_MODE)
gr.HTML(
"Model", visible=not KH_DEMO_MODE and not KH_SSO_ENABLED
)
gr.HTML("Language")

with gr.Row():
Expand Down Expand Up @@ -346,7 +349,7 @@ def on_building_ui(self):
value=model_setting.value,
container=False,
show_label=False,
visible=not KH_DEMO_MODE,
visible=not KH_DEMO_MODE and not KH_SSO_ENABLED,
)
self.language = gr.Dropdown(
choices=language_setting.choices,
Expand Down
7 changes: 3 additions & 4 deletions libs/ktem/ktem/pages/chat/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
logger = logging.getLogger(__name__)

KH_DEMO_MODE = getattr(flowsettings, "KH_DEMO_MODE", False)
KH_SSO_ENABLED = getattr(flowsettings, "KH_SSO_ENABLED", False)
ASSETS_DIR = "assets/icons"
if not os.path.isdir(ASSETS_DIR):
ASSETS_DIR = "libs/ktem/ktem/assets/icons"
Expand Down Expand Up @@ -110,12 +111,10 @@ def on_building_ui(self):
)
self.cb_is_public = gr.Checkbox(
value=False,
label="Shared",
min_width=10,
scale=4,
label="Share this conversation",
elem_id="is-public-checkbox",
container=False,
visible=False,
visible=not KH_DEMO_MODE and not KH_SSO_ENABLED,
)

if not KH_DEMO_MODE:
Expand Down
2 changes: 1 addition & 1 deletion libs/ktem/ktem/pages/chat/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, app):
self.on_building_ui()

def on_building_ui(self):
with gr.Accordion(label="Feedback", open=False):
with gr.Accordion(label="Feedback", open=False, elem_id="report-accordion"):
self.correctness = gr.Radio(
choices=[
("The answer is correct", "correct"),
Expand Down

0 comments on commit 9a3c064

Please sign in to comment.