Closed JayGarland closed 8 months ago
BTW I added some info related to the 成均館 in prompt of the bot's persona, so would it possibly cause the error?
Maybe you need to set a proxy in China.
That exception is Microsoft service exception.
Maybe you need to set a proxy in China.
thanks, my ip is clean.
That exception is Microsoft service exception.
I know, but it is actually an exception and caused no response, while I used another project which uses a similar logic to chat with the sydney, it won't get the error, I used the same context and and question ask the bot.
If I use your prompt in my environment, it runs successfully. Can you try using code to ask the bot, not the CLI? I haven’t checked the CLI module for more than 5 months.
If I use your prompt in my environment, it runs successfully. Can you try using code to ask the bot, not the CLI? I haven’t checked the CLI module for more than 5 months.
Sorry I am not clear which code you asked to use? I currently just saw CLI and UI two ways to run the bot.
Example:
import asyncio
import json
from pathlib import Path
from re_edge_gpt import Chatbot
from re_edge_gpt import ConversationStyle
# If you are using jupyter pls install this package
# from nest_asyncio import apply
async def test_ask() -> None:
bot = None
try:
mode = "Bing"
if mode == "Bing":
cookies: list[dict] = json.loads(open(
str(Path(str(Path.cwd()) + "/bing_cookies.json")), encoding="utf-8").read())
else:
cookies: list[dict] = json.loads(open(
str(Path(str(Path.cwd()) + "/copilot_cookies.json")), encoding="utf-8").read())
bot = await Chatbot.create(cookies=cookies, mode=mode)
response = await bot.ask(
prompt="成均馆大学好玩吗?",
conversation_style=ConversationStyle.balanced,
simplify_response=True,
search_result=True
)
# If you are using non ascii char you need set ensure_ascii=False
print(json.dumps(response, indent=2, ensure_ascii=False))
# Raw response
# print(response)
assert response
except Exception as error:
raise error
finally:
if bot is not None:
await bot.close()
if __name__ == "__main__":
# If you are using jupyter pls use nest_asyncio apply()
# apply()
try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.get_event_loop()
loop.run_until_complete(test_ask())
thanks your review, today I tested and using the same context, tried to reproduce that exception, but seems that error disappear
Always this error happens as soon as the bot searches internet.
prerequisite: I use a precontext as the webpage to give the bot a persona and chat with the bot.