Fix You.com model selection

This commit is contained in:
Heiner Lohaus 2024-05-17 18:40:34 +02:00
parent 24c5502d76
commit 5396887801

View File

@ -100,9 +100,10 @@ class You(AsyncGeneratorProvider, ProviderModelMixin):
"selectedChatMode": chat_mode,
}
if chat_mode == "custom":
# print(f"You model: {model}")
params["selectedAIModel"] = model.replace("-", "_")
if debug.logging:
print(f"You model: {model}")
params["selectedAiModel"] = model.replace("-", "_")
async with (session.post if chat_mode == "default" else session.get)(
f"{cls.url}/api/streamingSearch",
data=data,
@ -117,9 +118,9 @@ class You(AsyncGeneratorProvider, ProviderModelMixin):
elif line.startswith(b'data: '):
if event in ["youChatUpdate", "youChatToken"]:
data = json.loads(line[6:])
if event == "youChatToken" and event in data:
if event == "youChatToken" and event in data and data[event]:
yield data[event]
elif event == "youChatUpdate" and "t" in data and data["t"] is not None:
elif event == "youChatUpdate" and "t" in data and data["t"]:
if chat_mode == "create":
match = re.search(r"!\[(.+?)\]\((.+?)\)", data["t"])
if match: