Skip to content

Commit

Permalink
fix: 更新 Bard 脚本以正确获取数据
Browse files Browse the repository at this point in the history
Bard 返回数据的组织方式发生了变化,脚本在读取数据时出现问题。原先代码 `result = data[0][0]` 引发了 `TypeError` 错误。经过实际分析,已将代码修改为 `result = data[4][0][1][0]`。

修改后机器人能够正常运行。
  • Loading branch information
Huoyuuu authored and lss233 committed Jul 5, 2023
1 parent 71e9647 commit 51abcb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion adapter/google/bard.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def ask(self, prompt: str) -> Generator[str, None, None]:
for lines in res:
if "wrb.fr" in lines:
data = json.loads(json.loads(lines)[0][2])
result = data[0][0]
result = data[4][0][1][0]
self.bard_session_id = data[1][0]
self.r = data[1][1] # 用于下一次请求, 这个位置是固定的
# self.rc = data[4][1][0]
Expand Down

0 comments on commit 51abcb8

Please sign in to comment.