Skip to main content

revERNIEBot

文心一言 API

  • Selenium方法
  • requests调用协议方法

目前仅支持使用Selenium的方案

安装

安装Chrome

Windows系统

自行前往 https://www.google.cn/chrome/index.html 下载安装

Ubuntu/Debian系统

安装依赖软件

sudo apt install udev fonts-liberation libu2f-udev libvulkan1 xdg-utils -y

下载Chrome安装包

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

安装Chrome

sudo dpkg -i google-chrome-stable_current_amd64.deb

检查Chrome版本

google-chrome -version

记住此版本号

CentOS/Rocky Linux系统

安装Chrome

yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

下载browsermob-proxy

点击此处展开

前往 https://github.com/lightbody/browsermob-proxy/releases/tag/browsermob-proxy-2.1.4

下载 browsermob-proxy-2.1.4-bin.zip,解压

使用

  1. 安装本依赖库
pip3 install --upgrade revERNIEBot
  1. 安装 Chrome/Edge 或 Firefox 上的Cookies Editor插件

  2. 前往yiyan.baidu.com

  3. 打开此插件,点击Export->Export as JSON,将复制的Cookies内容保存到文件cookies.json

  4. 代码调用

from revERNIEBot.selenium import ChatBot  # 目前仅支持Selenium的方案

chatbot = ChatBot(
    cookieFile="cookies.json"
    browsermobProxyPath="pathToBrowserMobProxyExecFile",  # browsermob-proxy的可执行文件路径,详见下方说明
)

print(chatbot.ask("你好"))  # 获取回复
print(chatbot.ask("你是谁?"))

chatbot.reset_session()  # 开启新对话

chatbot.quit()
  • browsermobProxyPath:填写刚刚下载的browsermobproxy的压缩包解压出来的bin/中的可执行文件路径,例如Linux系统下填写bin中的browsermob-proxy的路径,Windows填写browsermob-proxy.bat路径(Windows系统下需要将路径使用\分隔)
  • 系统上的java版本不能高于java8

注意

  • 有问题请在issue中发起讨论
  • 此仓库仅供学习

Metadata

Release files for revERNIEBot 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for revERNIEBot 0.0.7
File Size Uploaded
reverniebot-0.0.7.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for revERNIEBot 0.0.7
File Interpreter ABI Platform
reverniebot-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / reverniebot-0.0.7.tar.gz

Download URL reverniebot-0.0.7.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7e91cb294c052b1a141adbf008d692b120cac73151ba714fd8e5281b5653f653
BLAKE2b-256 checksum
How to use checksums
16ef4d431c1721442ee2f43a5277dde36666abf1bd7150031595d115db66611d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release files / reverniebot-0.0.7-py3-none-any.whl

Download URL reverniebot-0.0.7-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f023d3fea1e04750646df13931b2460e3bdd335a78253e8cbfb258567a6f1615
BLAKE2b-256 checksum
How to use checksums
c208891c3eed32f7f58872c7a51e394a41934963a4d3472885ee35f0b3490d00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page