format source code
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
|
||||
"""
|
||||
========================================================================
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
接驳void-terminal:
|
||||
- set_conf: 在运行过程中动态地修改配置
|
||||
- set_multi_conf: 在运行过程中动态地修改多个配置
|
||||
@@ -9,17 +9,20 @@ import os
|
||||
- get_plugin_default_kwargs: 获取插件的默认参数
|
||||
- get_chat_handle: 获取简单聊天的句柄
|
||||
- get_chat_default_kwargs: 获取简单聊天的默认参数
|
||||
========================================================================
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
"""
|
||||
|
||||
|
||||
def get_plugin_handle(plugin_name):
|
||||
"""
|
||||
e.g. plugin_name = 'crazy_functions.批量Markdown翻译->Markdown翻译指定语言'
|
||||
"""
|
||||
import importlib
|
||||
assert '->' in plugin_name, \
|
||||
"Example of plugin_name: crazy_functions.批量Markdown翻译->Markdown翻译指定语言"
|
||||
module, fn_name = plugin_name.split('->')
|
||||
|
||||
assert (
|
||||
"->" in plugin_name
|
||||
), "Example of plugin_name: crazy_functions.批量Markdown翻译->Markdown翻译指定语言"
|
||||
module, fn_name = plugin_name.split("->")
|
||||
f_hot_reload = getattr(importlib.import_module(module, fn_name), fn_name)
|
||||
return f_hot_reload
|
||||
|
||||
@@ -29,6 +32,7 @@ def get_chat_handle():
|
||||
Get chat function
|
||||
"""
|
||||
from request_llms.bridge_all import predict_no_ui_long_connection
|
||||
|
||||
return predict_no_ui_long_connection
|
||||
|
||||
|
||||
@@ -37,13 +41,14 @@ def get_plugin_default_kwargs():
|
||||
Get Plugin Default Arguments
|
||||
"""
|
||||
from toolbox import ChatBotWithCookies, load_chat_cookies
|
||||
|
||||
cookies = load_chat_cookies()
|
||||
llm_kwargs = {
|
||||
'api_key': cookies['api_key'],
|
||||
'llm_model': cookies['llm_model'],
|
||||
'top_p': 1.0,
|
||||
'max_length': None,
|
||||
'temperature': 1.0,
|
||||
"api_key": cookies["api_key"],
|
||||
"llm_model": cookies["llm_model"],
|
||||
"top_p": 1.0,
|
||||
"max_length": None,
|
||||
"temperature": 1.0,
|
||||
}
|
||||
chatbot = ChatBotWithCookies(llm_kwargs)
|
||||
|
||||
@@ -55,7 +60,7 @@ def get_plugin_default_kwargs():
|
||||
"chatbot_with_cookie": chatbot,
|
||||
"history": [],
|
||||
"system_prompt": "You are a good AI.",
|
||||
"web_port": None
|
||||
"web_port": None,
|
||||
}
|
||||
return DEFAULT_FN_GROUPS_kwargs
|
||||
|
||||
@@ -65,13 +70,14 @@ def get_chat_default_kwargs():
|
||||
Get Chat Default Arguments
|
||||
"""
|
||||
from toolbox import load_chat_cookies
|
||||
|
||||
cookies = load_chat_cookies()
|
||||
llm_kwargs = {
|
||||
'api_key': cookies['api_key'],
|
||||
'llm_model': cookies['llm_model'],
|
||||
'top_p': 1.0,
|
||||
'max_length': None,
|
||||
'temperature': 1.0,
|
||||
"api_key": cookies["api_key"],
|
||||
"llm_model": cookies["llm_model"],
|
||||
"top_p": 1.0,
|
||||
"max_length": None,
|
||||
"temperature": 1.0,
|
||||
}
|
||||
default_chat_kwargs = {
|
||||
"inputs": "Hello there, are you ready?",
|
||||
|
||||
Reference in New Issue
Block a user