ERNIEBot
在Python上使用文心一言。可拓展为各种聊天机器人。
欢迎提交Pull Request或者Issues来改进此项目 Make a pull request to improve this project
功能 / Fetures
- 基于ACS-Token逆向(暂时未解决)
- 使用Selenium和Browsermob-Proxy来与文心一言模拟交互
使用 / Get Start
如果要在你的项目上使用:
- 执行
pip install wenxin -i https://pypi.org/simple/ - 【已发现的问题】需要在你的项目根目录上加上/src/wenxin文件夹,然后将本项目src/wenxin/browsermob-proxy-2.1.4文件夹和chromedriver.exe复制到/src/wenxin中
- 使用以下代码:
from wenxin.wenxin import WenXinBot
from wenxin.wenxin import WenxinRevError
# wenxin_cookies_dict_list 的内容详见下文
wx = WenXinBot(wenxin_cookies_dict_list)
# 初始化selenium,debug=True时,会输出调试信息,方便调试。headless=False时,会打开浏览器。
wx.initSelenium(debug=False, headless=True)
# 超时设置,单位秒,防止长时间等待,当超时后,会将已经生成的文本返回
res = wx.chatViaSelenium('hello', timeout=20)
print(res)
wx = WenXinBot()需要传入一个cookie参数,获取方法如下:
- 使用一个获得资格的账号登录https://yiyan.baidu.com/ ,然后打开F12,找到如图所示的请求,右键另存为HAR
- 找到cookies,如下图所示,然后复制整个列表放到代码上。然后使用文本替换工具将
true替换为True,false替换为False
- 替换文本完成后,得到的列表就是wx = WenXinBot()要传入的参数了。
Metadata
Release files for Wenxin 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Wenxin-1.1.4.tar.gz | 18.1 kB | Without provenance | Details for Wenxin-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Wenxin-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for Wenxin-1.1.4-py3-none-any.whl |
Total release size: 36.1 kB
Release files / Wenxin-1.1.4.tar.gz
| Download URL | Wenxin-1.1.4.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5f5d20de8bc7884f22eefa2ec387906a3f1e69ba57aa4b2f0ad122cd2b6da75
|
|
BLAKE2b-256 checksum How to use checksums |
1fecb0bf75be2191ff0c869fce84a2b26cd904c6bdf3b06747430b156f83f6d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Release files / Wenxin-1.1.4-py3-none-any.whl
| Download URL | Wenxin-1.1.4-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d7080adc19c760979a3aa3ebb314e3c05627f1862ae2750bd7ffca3565fc492
|
|
BLAKE2b-256 checksum How to use checksums |
4bc9c5db07cea70de8db6d8f1b16dd9f458e5344aa54ba7408d32031fa31459f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Security for Wenxin 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.