Spaces:
Runtime error
Runtime error
Commit
·
a1cf93b
1
Parent(s):
a430c4b
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,8 +6,8 @@ import gradio as gr
|
|
| 6 |
from threading import Thread #线程 用于定时器
|
| 7 |
import testlinkspark
|
| 8 |
|
| 9 |
-
from assets.char_poses_base64 import ( #角色动作
|
| 10 |
-
|
| 11 |
|
| 12 |
from app_utils import (
|
| 13 |
get_chat_history, initialize_knowledge_base,
|
|
@@ -46,10 +46,10 @@ def update_img():
|
|
| 46 |
global FUNC_CALL
|
| 47 |
FUNC_CALL += 1
|
| 48 |
|
| 49 |
-
if FUNC_CALL % 2== 0:
|
| 50 |
-
|
| 51 |
-
else:
|
| 52 |
-
|
| 53 |
|
| 54 |
|
| 55 |
def get_response(history, audio_input):
|
|
@@ -90,14 +90,14 @@ def get_response(history, audio_input):
|
|
| 90 |
#for trigger in GENERAL_RSPONSE_TRIGGERS:
|
| 91 |
#if trigger in str(answer):
|
| 92 |
MESSAGES.append({"role": "user", "content": question})
|
| 93 |
-
chat = openai.ChatCompletion.create(
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
answer = chat.choices[0].message.content
|
| 101 |
MESSAGES.append({"role": "assistant", "content": answer})
|
| 102 |
LOGGER.info("general_response: %s", answer)
|
| 103 |
print('\ngeneral_response:', answer)
|
|
|
|
| 6 |
from threading import Thread #线程 用于定时器
|
| 7 |
import testlinkspark
|
| 8 |
|
| 9 |
+
#from assets.char_poses_base64 import ( #角色动作
|
| 10 |
+
# CHAR_IDLE_HTML, CHAR_THINKING_HTML, CHAR_TALKING_HTML)
|
| 11 |
|
| 12 |
from app_utils import (
|
| 13 |
get_chat_history, initialize_knowledge_base,
|
|
|
|
| 46 |
global FUNC_CALL
|
| 47 |
FUNC_CALL += 1
|
| 48 |
|
| 49 |
+
#if FUNC_CALL % 2== 0:
|
| 50 |
+
# return CHAR_TALKING_HTML
|
| 51 |
+
#else:
|
| 52 |
+
# return CHAR_THINKING_HTML
|
| 53 |
|
| 54 |
|
| 55 |
def get_response(history, audio_input):
|
|
|
|
| 90 |
#for trigger in GENERAL_RSPONSE_TRIGGERS:
|
| 91 |
#if trigger in str(answer):
|
| 92 |
MESSAGES.append({"role": "user", "content": question})
|
| 93 |
+
#chat = openai.ChatCompletion.create(
|
| 94 |
+
# model="gpt-3.5-turbo",
|
| 95 |
+
# messages=MESSAGES,
|
| 96 |
+
# temperature=0.7,
|
| 97 |
+
# n=128,
|
| 98 |
+
# stop="\n"
|
| 99 |
+
# )
|
| 100 |
+
#answer = chat.choices[0].message.content
|
| 101 |
MESSAGES.append({"role": "assistant", "content": answer})
|
| 102 |
LOGGER.info("general_response: %s", answer)
|
| 103 |
print('\ngeneral_response:', answer)
|