nek0us / ChatGPT

a ChatGPT api,no web ui
GNU General Public License v3.0
15 stars 4 forks source link

error: send_page #8

Closed Mohamed3nan closed 5 months ago

Mohamed3nan commented 5 months ago

2024/06/17 03:07:15 ChatGPTWeb.py ERROR send msg error,session: ,error:cannot access local variable 'send_page' where it is not associated with a value

nek0us commented 5 months ago

it may be a network issue,do u have more detailed DEBUG logs

Mohamed3nan commented 5 months ago

image

also with headless=False same error no send prompt or response

nek0us commented 5 months ago

set logger_level='DEBUG'

Mohamed3nan commented 5 months ago

set logger_level='DEBUG'

where?

I'm using the sample snippet:


import asyncio
from ChatGPTWeb import chatgpt
from ChatGPTWeb.config import Personality, MsgData
import aioconsole

sessions = [
    {
        "email": "xx",
        "password": "xx",
        "session_token": 'xx'
    }
]
# please remove account if u don't have | 请删除你不需要的登录方式 
# if you only use session_token, automatic login after expiration is not supported | 仅使用session_token登录的话,不支持过期后的自动登录
# if you use an openai account to log in, 
# pleases manually obtain the session_token in advance and add it together to reduce the possibility of openai verification
# 使用openai账号登录的话,请提前手动获取 session_token并一同添加,降低 openai 验证的可能性

personality_definition = Personality(
    [
        {
            "name": "Programmer",
            'value': 'You are python Programmer'
        },
    ])

chat = chatgpt(sessions=sessions, begin_sleep_time=False, headless=False, stdout_flush=True)
# "begin_sleep_time=False" for testing only
# Make sure "headless=True" when using 

async def main():
    c_id = await aioconsole.ainput("your conversation_id if you have:")
    # if u don't have,pleases enter empty
    p_id = await aioconsole.ainput("your parent_message_id if you have:")
    # if u don't have,pleases enter empty
    data:MsgData = MsgData(conversation_id=c_id,p_msg_id=p_id)
    while 1:
        print("------------------------------")
        data.msg_send = await aioconsole.ainput("input:")
        print("------------------------------")
        if data.msg_send == "quit":
            break
        elif data.msg_send == "gpt4o":
            if not data.gpt4o:
                data.gpt_model = "gpt-4o"
                data.conversation_id = ""
                data.p_msg_id = ""
            data.msg_send = await aioconsole.ainput("reinput:")
        elif data.msg_send == "gpt3.5":
            if data.gpt4o:
                data.gpt_model = "text-davinci-002-render-sha"
                data.conversation_id = ""
                data.p_msg_id = ""
            data.msg_send = await aioconsole.ainput("reinput:")
        elif data.msg_send == "re":
            data.msg_type = "back_loop"
            data.p_msg_id = await aioconsole.ainput("your parent_message_id if you go back:")
        elif data.msg_send == "reset":
            data = await chat.back_init_personality(data)
            print(f"ChatGPT:{data.msg_recv}")
            continue
        elif data.msg_send == "init_personality":
            data.msg_send = "your ..."
            data = await chat.init_personality(data)
            print(f"ChatGPT:{data.msg_recv}")
            continue
        elif data.msg_send == "history":
            print(await chat.show_chat_history(data))
            continue
        elif data.msg_send == "status":
            print(await chat.token_status())
            continue
        data = await chat.continue_chat(data)
        if data.msg_recv == '':
            print(f"error:{data.error_info}")
        else:
            print(f"ChatGPT:{data.msg_recv}")
        data.error_info = ""
        data.msg_recv = ""
        data.p_msg_id = ""

loop = asyncio.get_event_loop()
loop.run_until_complete(main())      
nek0us commented 5 months ago

set logger_level='DEBUG'

where?

chat = chatgpt(sessions=sessions, begin_sleep_time=False, headless=True, logger_level='DEBUG')

Mohamed3nan commented 5 months ago

set logger_level='DEBUG'

where?

chat = chatgpt(sessions=sessions, begin_sleep_time=False, headless=True, logger_level='DEBUG')

image

nek0us commented 5 months ago

did you set httpx_status=True?

Mohamed3nan commented 5 months ago

did you set httpx_status=True?

the default is already True, also tried to set it httpx_status=True now, and the same error above

nek0us commented 5 months ago

did you set httpx_status=True?

the default is already True, also tried to set it httpx_status=True now, and the same error above

sorry,i have checked the code and it is indeed enable by default.this is my mistake.please set httpx_status=False,this httpx solution has been temporarily abandoned.

Mohamed3nan commented 5 months ago

did you set httpx_status=True?

the default is already True, also tried to set it httpx_status=True now, and the same error above

sorry,i have checked the code and it is indeed enable by default.this is my mistake.please set httpx_status=False,this httpx solution has been temporarily abandoned.

Thank you, it's working now

Mohamed3nan commented 5 months ago

Sorry for bothering you, but why when using MsgData(gpt_model="gpt4o") I got this error ERROR you use gptplus,but gptplus account not found error:you use gptplus,but gptplus account not found

I'm using free account!

nek0us commented 5 months ago

Sorry for bothering you, but why when using MsgData(gpt_model="gpt4o") I got this error ERROR you use gptplus,but gptplus account not found error:you use gptplus,but gptplus account not found

I'm using free account!

Currently, models such as gpt4o require a gpt plus account. Although free accounts can also use gpt4o, the available amount is too low, so I did not adapt for free accounts.

nek0us commented 5 months ago

Sorry for bothering you, but why when using MsgData(gpt_model="gpt4o") I got this error ERROR you use gptplus,but gptplus account not found error:you use gptplus,but gptplus account not found I'm using free account!

Currently, models such as gpt4o require a gpt plus account. Although free accounts can also use gpt4o, the available amount is too low, so I did not adapt for free accounts.

In the future, adaptation may be made for free accounts.

Mohamed3nan commented 5 months ago

Sorry for bothering you, but why when using MsgData(gpt_model="gpt4o") I got this error ERROR you use gptplus,but gptplus account not found error:you use gptplus,but gptplus account not found I'm using free account!

Currently, models such as gpt4o require a gpt plus account. Although free accounts can also use gpt4o, the available amount is too low, so I did not adapt for free accounts.

you can simply use model:"auto" and the switch will be handled by openai i guess