diff --git a/__main__.py b/__main__.py index 1d1cf56..7560b97 100644 --- a/__main__.py +++ b/__main__.py @@ -79,6 +79,7 @@ class ChatBot(ChatBotFrame): with gr.Box(elem_id='chat_box'): with gr.Row(): gr.Button(elem_classes='sm_btn').style(size='sm', full_width=False) + gr.HTML(func_box.get_html("appearance_switcher.html").format(label=""), elem_classes="insert_block") with gr.Row(): self.txt = gr.Textbox(show_label=False, placeholder="Input question here.", elem_classes='chat_input').style(container=False) self.input_copy = gr.State('') diff --git a/docs/assets/custom.css b/docs/assets/custom.css index 6994fbf..d3f38c6 100644 --- a/docs/assets/custom.css +++ b/docs/assets/custom.css @@ -72,6 +72,14 @@ mspace { .sm_btn { position: relative; bottom: 5px; + height: 10%; + border-radius: 20px!important; + min-width: min(10%,100%) !important; +} +/* usage_display */ +.insert_block { + position: relative; + bottom: 2px; min-width: min(110px,100%) !important; } @@ -253,20 +261,7 @@ textarea.svelte-1pie7s6 { font-size: 12px !important; } -/* usage_display */ -.insert_block { - position: relative; - margin: 0; - padding: .5em 1em; - box-shadow: var(--block-shadow); - border-width: var(--block-border-width); - border-color: var(--block-border-color); - border-radius: var(--block-radius); - background: var(--block-background-fill); - width: 100%; - line-height: var(--line-sm); - min-height: 2em; -} + #usage_display p, #usage_display span { margin: 0; font-size: .85em; diff --git a/docs/assets/custom.js b/docs/assets/custom.js index 84e0068..9a07884 100644 --- a/docs/assets/custom.js +++ b/docs/assets/custom.js @@ -58,8 +58,8 @@ function gradioLoaded(mutations) { chat_txt = document.getElementById('chat_txt'); userInfoDiv = document.getElementById("user_info"); appTitleDiv = document.getElementById("app_title"); - chatbot = document.querySelector('#main_chatbot'); - chatbotWrap = document.querySelector('#main_chatbot > .wrap'); + chatbot = document.querySelector('#废弃'); + chatbotWrap = document.querySelector('#废弃 > .wrap'); apSwitch = document.querySelector('.apSwitch input[type="checkbox"]'); if (loginUserForm) { @@ -414,7 +414,7 @@ var mObserver = new MutationObserver(function (mutationsList) { for (var node of mmutation.addedNodes) { if (node.nodeType === 1 && node.classList.contains('message') && node.getAttribute('data-testid') === 'bot') { saveHistoryHtml(); - document.querySelectorAll('#main_chatbot>.wrap>.message-wrap .message.bot').forEach(addChuanhuButton); + document.querySelectorAll('#废弃>.wrap>.message-wrap .message.bot').forEach(addChuanhuButton); } if (node.tagName === 'INPUT' && node.getAttribute('type') === 'range') { setSlider(); @@ -423,7 +423,7 @@ var mObserver = new MutationObserver(function (mutationsList) { for (var node of mmutation.removedNodes) { if (node.nodeType === 1 && node.classList.contains('message') && node.getAttribute('data-testid') === 'bot') { saveHistoryHtml(); - document.querySelectorAll('#main_chatbot>.wrap>.message-wrap .message.bot').forEach(addChuanhuButton); + document.querySelectorAll('#废弃>.wrap>.message-wrap .message.bot').forEach(addChuanhuButton); } } } else if (mmutation.type === 'attributes') { @@ -433,7 +433,7 @@ var mObserver = new MutationObserver(function (mutationsList) { clearTimeout(timeoutId); timeoutId = setTimeout(() => { isThrottled = false; - document.querySelectorAll('#main_chatbot>.wrap>.message-wrap .message.bot').forEach(addChuanhuButton); + document.querySelectorAll('#废弃>.wrap>.message-wrap .message.bot').forEach(addChuanhuButton); saveHistoryHtml(); }, 500); } @@ -444,7 +444,7 @@ mObserver.observe(document.documentElement, { attributes: true, childList: true, var loadhistorytime = 0; // for debugging function saveHistoryHtml() { - var historyHtml = document.querySelector('#main_chatbot > .wrap'); + var historyHtml = document.querySelector('#废弃 > .wrap'); localStorage.setItem('chatHistory', historyHtml.innerHTML); // console.log("History Saved") historyLoaded = false; diff --git a/docs/assets/html/appearance_switcher.html b/docs/assets/html/appearance_switcher.html index 9375071..2f03cd4 100644 --- a/docs/assets/html/appearance_switcher.html +++ b/docs/assets/html/appearance_switcher.html @@ -1,7 +1,4 @@