Bard icon indicating copy to clipboard operation
Bard copied to clipboard

always show IndexError: list index out of range

Open zchengzhong opened this issue 1 year ago • 1 comments

GooglBard version is 1.4.0 i use: chatbot = Chatbot(token)
chatbot.ask(tempQuest)

and the token is useful Traceback (most recent call last): File "F:\github\chatgpts\EdgeGPT-master\src\classifyMilitaryUnits\ChatGoogleBardMilitaryUnitsSecond.py", line 187, in dealStartIndex = process_classify_data(df, tokenArr[tokenIndex], dealStartIndex) File "F:\github\chatgpts\EdgeGPT-master\src\classifyMilitaryUnits\ChatGoogleBardMilitaryUnitsSecond.py", line 112, in process_classify_data result = chatbot.ask(tempQuest) File "G:\soft\Anaconda3\envs\py39\lib\site-packages\Bard.py", line 83, in ask return self.loop.run_until_complete(self.async_chatbot.ask(message)) File "G:\soft\Anaconda3\envs\py39\lib\asyncio\base_events.py", line 647, in run_until_complete return future.result() File "G:\soft\Anaconda3\envs\py39\lib\site-packages\Bard.py", line 260, in ask chat_data = json.loads(resp.content.splitlines()[3])[0][2] IndexError: list index out of range

zchengzhong avatar Jul 15 '23 07:07 zchengzhong

and use code to fix:

    try:
        chat_data = json.loads(resp.content.splitlines()[3])[0][2]
    except:
        chat_data=""

zchengzhong avatar Jul 15 '23 08:07 zchengzhong