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,解压
使用
- 安装本依赖库
pip3 install --upgrade revERNIEBot
-
安装 Chrome/Edge 或 Firefox 上的Cookies Editor插件
-
前往yiyan.baidu.com
-
打开此插件,点击
Export->Export as JSON,将复制的Cookies内容保存到文件cookies.json -
代码调用
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)
| File | Size | Uploaded | |
|---|---|---|---|
| reverniebot-0.0.7.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|