Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Some prompts fails in 0.0.30 #117

@theurs

Description

@theurs

if prompt = 'hello' or 'hello + hello' its ok
if prompt = '1+1' or '2+2' it fails with error
all is ok with 0.0.28

TypeError
can only concatenate str (not "NoneType") to str
  File "C:\Users\user\V\4 python\2 telegram bot tesseract\tb1\test.py", line 19, in test_ask
    response = await bot.ask(
               ^^^^^^^^^^^^^^
  File "C:\Users\user\V\4 python\2 telegram bot tesseract\tb1\test.py", line 42, in <module>
    loop.run_until_complete(test_ask())
TypeError: can only concatenate str (not "NoneType") to str


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:
        cookies: list[dict] = json.loads(open(
            str(Path(str(Path.cwd()) + "/bing_cookies.json")), encoding="utf-8").read())
        bot = await Chatbot.create(cookies=cookies)
        response = await bot.ask(
            prompt="1+1",
            conversation_style=ConversationStyle.balanced,
            simplify_response=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

    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())

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem rightwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions