fix dependency

This commit is contained in:
binary-husky 2023-05-25 15:28:27 +08:00
parent cd411c2eea
commit 5d75c578b9
2 changed files with 36 additions and 33 deletions

View File

@ -202,19 +202,22 @@ if "stack-claude" in AVAIL_LLM_MODELS:
} }
}) })
if "newbing-free" in AVAIL_LLM_MODELS: if "newbing-free" in AVAIL_LLM_MODELS:
from .bridge_newbingfree import predict_no_ui_long_connection as newbingfree_noui try:
from .bridge_newbingfree import predict as newbingfree_ui from .bridge_newbingfree import predict_no_ui_long_connection as newbingfree_noui
# claude from .bridge_newbingfree import predict as newbingfree_ui
model_info.update({ # claude
"newbing-free": { model_info.update({
"fn_with_ui": newbingfree_ui, "newbing-free": {
"fn_without_ui": newbingfree_noui, "fn_with_ui": newbingfree_ui,
"endpoint": newbing_endpoint, "fn_without_ui": newbingfree_noui,
"max_token": 4096, "endpoint": newbing_endpoint,
"tokenizer": tokenizer_gpt35, "max_token": 4096,
"token_cnt": get_token_num_gpt35, "tokenizer": tokenizer_gpt35,
} "token_cnt": get_token_num_gpt35,
}) }
})
except:
print(trimmed_format_exc())
def LLM_CATCH_EXCEPTION(f): def LLM_CATCH_EXCEPTION(f):
""" """

View File

@ -196,9 +196,9 @@ class _ChatHubRequest:
self, self,
prompt: str, prompt: str,
conversation_style: CONVERSATION_STYLE_TYPE, conversation_style: CONVERSATION_STYLE_TYPE,
options: list | None = None, options = None,
webpage_context: str | None = None, webpage_context = None,
search_result: bool = False, search_result = False,
) -> None: ) -> None:
""" """
Updates request object Updates request object
@ -294,9 +294,9 @@ class _Conversation:
def __init__( def __init__(
self, self,
proxy: str | None = None, proxy = None,
async_mode: bool = False, async_mode = False,
cookies: list[dict] | None = None, cookies = None,
) -> None: ) -> None:
if async_mode: if async_mode:
return return
@ -350,8 +350,8 @@ class _Conversation:
@staticmethod @staticmethod
async def create( async def create(
proxy: str | None = None, proxy = None,
cookies: list[dict] | None = None, cookies = None,
): ):
self = _Conversation(async_mode=True) self = _Conversation(async_mode=True)
self.struct = { self.struct = {
@ -418,11 +418,11 @@ class _ChatHub:
def __init__( def __init__(
self, self,
conversation: _Conversation, conversation: _Conversation,
proxy: str = None, proxy = None,
cookies: list[dict] | None = None, cookies = None,
) -> None: ) -> None:
self.session: aiohttp.ClientSession | None = None self.session = None
self.wss: aiohttp.ClientWebSocketResponse | None = None self.wss = None
self.request: _ChatHubRequest self.request: _ChatHubRequest
self.loop: bool self.loop: bool
self.task: asyncio.Task self.task: asyncio.Task
@ -441,7 +441,7 @@ class _ChatHub:
conversation_style: CONVERSATION_STYLE_TYPE = None, conversation_style: CONVERSATION_STYLE_TYPE = None,
raw: bool = False, raw: bool = False,
options: dict = None, options: dict = None,
webpage_context: str | None = None, webpage_context = None,
search_result: bool = False, search_result: bool = False,
) -> Generator[str, None, None]: ) -> Generator[str, None, None]:
""" """
@ -611,10 +611,10 @@ class Chatbot:
def __init__( def __init__(
self, self,
proxy: str | None = None, proxy = None,
cookies: list[dict] | None = None, cookies = None,
) -> None: ) -> None:
self.proxy: str | None = proxy self.proxy = proxy
self.chat_hub: _ChatHub = _ChatHub( self.chat_hub: _ChatHub = _ChatHub(
_Conversation(self.proxy, cookies=cookies), _Conversation(self.proxy, cookies=cookies),
proxy=self.proxy, proxy=self.proxy,
@ -623,8 +623,8 @@ class Chatbot:
@staticmethod @staticmethod
async def create( async def create(
proxy: str | None = None, proxy = None,
cookies: list[dict] | None = None, cookies = None,
): ):
self = Chatbot.__new__(Chatbot) self = Chatbot.__new__(Chatbot)
self.proxy = proxy self.proxy = proxy
@ -641,7 +641,7 @@ class Chatbot:
wss_link: str = "wss://sydney.bing.com/sydney/ChatHub", wss_link: str = "wss://sydney.bing.com/sydney/ChatHub",
conversation_style: CONVERSATION_STYLE_TYPE = None, conversation_style: CONVERSATION_STYLE_TYPE = None,
options: dict = None, options: dict = None,
webpage_context: str | None = None, webpage_context = None,
search_result: bool = False, search_result: bool = False,
) -> dict: ) -> dict:
""" """
@ -667,7 +667,7 @@ class Chatbot:
conversation_style: CONVERSATION_STYLE_TYPE = None, conversation_style: CONVERSATION_STYLE_TYPE = None,
raw: bool = False, raw: bool = False,
options: dict = None, options: dict = None,
webpage_context: str | None = None, webpage_context = None,
search_result: bool = False, search_result: bool = False,
) -> Generator[str, None, None]: ) -> Generator[str, None, None]:
""" """