Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
a366e21
1
Parent(s):
d7954d9
修复从UI中粘贴key时,无法显示OpenAI余额的问题
Browse files- ChuanhuChatbot.py +1 -1
- modules/models.py +5 -0
- modules/utils.py +1 -1
ChuanhuChatbot.py
CHANGED
@@ -274,7 +274,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
274 |
|
275 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
276 |
gr.HTML(FOOTER.format(versions=versions_html()), elem_id="footer")
|
277 |
-
demo.load(refresh_ui_elements_on_load, [current_model, model_select_dropdown], [
|
278 |
chatgpt_predict_args = dict(
|
279 |
fn=predict,
|
280 |
inputs=[
|
|
|
274 |
|
275 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
276 |
gr.HTML(FOOTER.format(versions=versions_html()), elem_id="footer")
|
277 |
+
demo.load(refresh_ui_elements_on_load, [current_model, model_select_dropdown], [like_dislike_area], show_progress=False)
|
278 |
chatgpt_predict_args = dict(
|
279 |
fn=predict,
|
280 |
inputs=[
|
modules/models.py
CHANGED
@@ -209,6 +209,11 @@ class OpenAIClient(BaseLLMModel):
|
|
209 |
if error_msg:
|
210 |
raise Exception(error_msg)
|
211 |
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
class ChatGLM_Client(BaseLLMModel):
|
214 |
def __init__(self, model_name) -> None:
|
|
|
209 |
if error_msg:
|
210 |
raise Exception(error_msg)
|
211 |
|
212 |
+
def set_key(self, new_access_key):
|
213 |
+
ret = super().set_key(new_access_key)
|
214 |
+
self._refresh_header()
|
215 |
+
return ret
|
216 |
+
|
217 |
|
218 |
class ChatGLM_Client(BaseLLMModel):
|
219 |
def __init__(self, model_name) -> None:
|
modules/utils.py
CHANGED
@@ -539,7 +539,7 @@ def get_model_source(model_name, alternative_source):
|
|
539 |
return "https://huggingface.co/gpt2-medium"
|
540 |
|
541 |
def refresh_ui_elements_on_load(current_model, selected_model_name):
|
542 |
-
return
|
543 |
|
544 |
def toggle_like_btn_visibility(selected_model_name):
|
545 |
if selected_model_name == "xmchat":
|
|
|
539 |
return "https://huggingface.co/gpt2-medium"
|
540 |
|
541 |
def refresh_ui_elements_on_load(current_model, selected_model_name):
|
542 |
+
return toggle_like_btn_visibility(selected_model_name)
|
543 |
|
544 |
def toggle_like_btn_visibility(selected_model_name):
|
545 |
if selected_model_name == "xmchat":
|