AllenYkl commited on
Commit
88ff42b
·
1 Parent(s): 52bba5c

Update bin_public/app/Chatbot.py

Browse files
Files changed (1) hide show
  1. bin_public/app/Chatbot.py +32 -0
bin_public/app/Chatbot.py CHANGED
@@ -7,6 +7,7 @@ from openai_func import *
7
  from bin_public.utils.utils import *
8
  from bin_public.utils.utils_db import *
9
  from bin_public.config.presets import *
 
10
 
11
  my_api_key = ""
12
 
@@ -58,6 +59,9 @@ with gr.Blocks(css=customCSS) as demo:
58
  user_question = gr.State("")
59
  outputing = gr.State(False)
60
  topic = gr.State("未命名对话历史记录")
 
 
 
61
 
62
  # gr.HTML("""
63
  # <div style="text-align: center; margin-top: 20px;">
@@ -167,6 +171,7 @@ with gr.Blocks(css=customCSS) as demo:
167
  with gr.Tab(label="角色"):
168
  with gr.Row():
169
  interviewer = gr.Button("面试官")
 
170
 
171
  with gr.Tab(label="Davinci-003"):
172
  with gr.Column():
@@ -323,6 +328,33 @@ with gr.Blocks(css=customCSS) as demo:
323
  [interviewer_prompt],
324
  [systemPromptTxt])
325
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  # Davinci
327
  davinci_user_input.submit(predict_davinci,
328
  [
 
7
  from bin_public.utils.utils import *
8
  from bin_public.utils.utils_db import *
9
  from bin_public.config.presets import *
10
+ from bin_public.utils.Pinecone import *
11
 
12
  my_api_key = ""
13
 
 
59
  user_question = gr.State("")
60
  outputing = gr.State(False)
61
  topic = gr.State("未命名对话历史记录")
62
+ pinecone_api_key = gr.Textbox(PINECONE_API_KEY, visible=False)
63
+ pinecone_api_env = gr.Textbox(PINECONE_API_ENV, visible=False)
64
+ pinecone_index_name = gr.Textbox(PINECONE_INDEX_NAME, visible=False)
65
 
66
  # gr.HTML("""
67
  # <div style="text-align: center; margin-top: 20px;">
 
171
  with gr.Tab(label="角色"):
172
  with gr.Row():
173
  interviewer = gr.Button("面试官")
174
+ migraine = gr.Button("问老中医-偏头痛相关")
175
 
176
  with gr.Tab(label="Davinci-003"):
177
  with gr.Column():
 
328
  [interviewer_prompt],
329
  [systemPromptTxt])
330
 
331
+ migraine.click(context_construction,[
332
+ keyTxt,
333
+ user_input,
334
+ model_select_dropdown,
335
+ pinecone_api_key,
336
+ pinecone_api_env,
337
+ temperature,
338
+ pinecone_index_name],
339
+ [systemPromptTxt, status_display]
340
+ ).then(
341
+ predict, [
342
+ keyTxt,
343
+ invite_code,
344
+ systemPromptTxt,
345
+ history,
346
+ user_input,
347
+ chatbot,
348
+ token_count,
349
+ top_p,
350
+ temperature,
351
+ use_streaming_checkbox,
352
+ model_select_dropdown,
353
+ use_websearch_checkbox,
354
+ index_files],
355
+ [chatbot, history, status_display, token_count], show_progress=True
356
+ ).then(reset_textbox, [], [user_input])
357
+
358
  # Davinci
359
  davinci_user_input.submit(predict_davinci,
360
  [