HunYuanGPT


NameHunYuanGPT JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/liaozhangsheng/HunYuanGPT
SummaryReverse engineered HunYuan chat
upload_time2023-12-12 12:54:32
maintainer
docs_urlNone
authorZhangsheng Liao
requires_python
licenseGPL-3.0
keywords reverse-engineering hunyuan gpt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<div align="center">



<img src="https://xj-psd-1258344703.cos.ap-guangzhou.myqcloud.com/image/hunyuan/logo/animation/welcome-web-repeat.gif" alt="HunYuanGPT" width="200"/>



# HunYuanGPT



_混元大模型逆向api_



</div>



## 安装模块



```bash

pip install HunYuanGPT --upgrade

```



## 获取cookie



1. 你需要一个拥有腾讯混元大模型体验资格的账号。

2. 打开[腾讯混元助手](https://hunyuan.tencent.com/bot/chat)

3. 打开浏览器开发者模式,切换到`network`选项卡,随便发送一条信息,找到一个有效的的请求,获取`cookie`字段的值。



## 使用聊天机器人



### 从命令行运行



```bash

$ python -m HunYuanGPT -h



             _    _         __     __                 _____ _____ _______ 

            | |  | |        \ \   / /                / ____|  __ \__   __|

            | |__| |_   _ _ _\ \_/ /   _  __ _ _ __ | |  __| |__) | | |   

            |  __  | | | | '_ \   / | | |/ _` | '_ \| | |_ |  ___/  | |   

            | |  | | |_| | | | | || |_| | (_| | | | | |__| | |      | |   

            |_|  |_|\__,_|_| |_|_| \__,_|\__,_|_| |_|\_____|_|      |_|   





Type /help for help.

Alt + Enter to send a message.



usage: __main__.py [-h] [--cookie_file_path COOKIE_FILE_PATH] [--no_stream]



options:

  -h, --help            show this help message and exit

  --cookie_file_path COOKIE_FILE_PATH

                        The path to the cookie file.

  --no_stream           Whether to use streaming mode.

```



### 在代码中运行



```python

from HunYuanGPT import ChatBot



bot = ChatBot(cookie="xxxxxxxx")



# Streaming output

for rsp in bot.ask_stream("你好!你叫什么名字?"):

    print(rsp, end="", flush=True)



# Normal output

print(bot.ask("你好!你叫什么名字?"))



# Generate images

# Images are named numerically by default and are saved in the./images folder.

# Of course, you can specify these parameters.

bot.get_image("赛博朋克风格的上海街头", path="./", name="img")

```



#### 其他用法



```python



# Switch to conversation with chatId "xxxxxx"

bot.change_conversation(chatId="xxxxxx")



# Set the name of conversation with chatId "xxxxxx" to "xxx"

bot.set_conversation_name(name="xxx", chatId="xxxxxx")



# Get the history of conversation with chatId "xxxxxx"

bot.get_conversation(chatId="xxxxxx")



# Get chatId and titles of all conversations

bot.get_all_conversations()



# Clear all conversations

bot.clear_all_conversations()



# Repeat the last reply

bot.repeat_last_reply()



# Forget the history and continue the conversation

bot.restart_conversation()

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/liaozhangsheng/HunYuanGPT",
    "name": "HunYuanGPT",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "reverse-engineering,HunYuan,gpt",
    "author": "Zhangsheng Liao",
    "author_email": "liaozhangsheng@163.com",
    "download_url": "https://files.pythonhosted.org/packages/2b/8d/de54254595ef99c305877bf05e2e0a25351ed076f694fc344c935b18dd2d/HunYuanGPT-0.1.0.tar.gz",
    "platform": null,
    "description": "\r\n<div align=\"center\">\r\r\n\r\r\n<img src=\"https://xj-psd-1258344703.cos.ap-guangzhou.myqcloud.com/image/hunyuan/logo/animation/welcome-web-repeat.gif\" alt=\"HunYuanGPT\" width=\"200\"/>\r\r\n\r\r\n# HunYuanGPT\r\r\n\r\r\n_\u6df7\u5143\u5927\u6a21\u578b\u9006\u5411api_\r\r\n\r\r\n</div>\r\r\n\r\r\n## \u5b89\u88c5\u6a21\u5757\r\r\n\r\r\n```bash\r\r\npip install HunYuanGPT --upgrade\r\r\n```\r\r\n\r\r\n## \u83b7\u53d6cookie\r\r\n\r\r\n1. \u4f60\u9700\u8981\u4e00\u4e2a\u62e5\u6709\u817e\u8baf\u6df7\u5143\u5927\u6a21\u578b\u4f53\u9a8c\u8d44\u683c\u7684\u8d26\u53f7\u3002\r\r\n2. \u6253\u5f00[\u817e\u8baf\u6df7\u5143\u52a9\u624b](https://hunyuan.tencent.com/bot/chat)\r\r\n3. \u6253\u5f00\u6d4f\u89c8\u5668\u5f00\u53d1\u8005\u6a21\u5f0f\uff0c\u5207\u6362\u5230`network`\u9009\u9879\u5361\uff0c\u968f\u4fbf\u53d1\u9001\u4e00\u6761\u4fe1\u606f\uff0c\u627e\u5230\u4e00\u4e2a\u6709\u6548\u7684\u7684\u8bf7\u6c42\uff0c\u83b7\u53d6`cookie`\u5b57\u6bb5\u7684\u503c\u3002\r\r\n\r\r\n## \u4f7f\u7528\u804a\u5929\u673a\u5668\u4eba\r\r\n\r\r\n### \u4ece\u547d\u4ee4\u884c\u8fd0\u884c\r\r\n\r\r\n```bash\r\r\n$ python -m HunYuanGPT -h\r\r\n\r\r\n             _    _         __     __                 _____ _____ _______ \r\r\n            | |  | |        \\ \\   / /                / ____|  __ \\__   __|\r\r\n            | |__| |_   _ _ _\\ \\_/ /   _  __ _ _ __ | |  __| |__) | | |   \r\r\n            |  __  | | | | '_ \\   / | | |/ _` | '_ \\| | |_ |  ___/  | |   \r\r\n            | |  | | |_| | | | | || |_| | (_| | | | | |__| | |      | |   \r\r\n            |_|  |_|\\__,_|_| |_|_| \\__,_|\\__,_|_| |_|\\_____|_|      |_|   \r\r\n\r\r\n\r\r\nType /help for help.\r\r\nAlt + Enter to send a message.\r\r\n\r\r\nusage: __main__.py [-h] [--cookie_file_path COOKIE_FILE_PATH] [--no_stream]\r\r\n\r\r\noptions:\r\r\n  -h, --help            show this help message and exit\r\r\n  --cookie_file_path COOKIE_FILE_PATH\r\r\n                        The path to the cookie file.\r\r\n  --no_stream           Whether to use streaming mode.\r\r\n```\r\r\n\r\r\n### \u5728\u4ee3\u7801\u4e2d\u8fd0\u884c\r\r\n\r\r\n```python\r\r\nfrom HunYuanGPT import ChatBot\r\r\n\r\r\nbot = ChatBot(cookie=\"xxxxxxxx\")\r\r\n\r\r\n# Streaming output\r\r\nfor rsp in bot.ask_stream(\"\u4f60\u597d\uff01\u4f60\u53eb\u4ec0\u4e48\u540d\u5b57\uff1f\"):\r\r\n    print(rsp, end=\"\", flush=True)\r\r\n\r\r\n# Normal output\r\r\nprint(bot.ask(\"\u4f60\u597d\uff01\u4f60\u53eb\u4ec0\u4e48\u540d\u5b57\uff1f\"))\r\r\n\r\r\n# Generate images\r\r\n# Images are named numerically by default and are saved in the./images folder.\r\r\n# Of course, you can specify these parameters.\r\r\nbot.get_image(\"\u8d5b\u535a\u670b\u514b\u98ce\u683c\u7684\u4e0a\u6d77\u8857\u5934\", path=\"./\", name=\"img\")\r\r\n```\r\r\n\r\r\n#### \u5176\u4ed6\u7528\u6cd5\r\r\n\r\r\n```python\r\r\n\r\r\n# Switch to conversation with chatId \"xxxxxx\"\r\r\nbot.change_conversation(chatId=\"xxxxxx\")\r\r\n\r\r\n# Set the name of conversation with chatId \"xxxxxx\" to \"xxx\"\r\r\nbot.set_conversation_name(name=\"xxx\", chatId=\"xxxxxx\")\r\r\n\r\r\n# Get the history of conversation with chatId \"xxxxxx\"\r\r\nbot.get_conversation(chatId=\"xxxxxx\")\r\r\n\r\r\n# Get chatId and titles of all conversations\r\r\nbot.get_all_conversations()\r\r\n\r\r\n# Clear all conversations\r\r\nbot.clear_all_conversations()\r\r\n\r\r\n# Repeat the last reply\r\r\nbot.repeat_last_reply()\r\r\n\r\r\n# Forget the history and continue the conversation\r\r\nbot.restart_conversation()\r\r\n```\r\n",
    "bugtrack_url": null,
    "license": "GPL-3.0",
    "summary": "Reverse engineered HunYuan chat",
    "version": "0.1.0",
    "project_urls": {
        "Bug Report": "https://github.com/liaozhangsheng/HunYuanGPT/issues/new",
        "Homepage": "https://github.com/liaozhangsheng/HunYuanGPT"
    },
    "split_keywords": [
        "reverse-engineering",
        "hunyuan",
        "gpt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b8dde54254595ef99c305877bf05e2e0a25351ed076f694fc344c935b18dd2d",
                "md5": "ca1436a54379af72057b5e88c9db128c",
                "sha256": "8549131ae111415d62e81c61f6cb66e727b57a85e8529bcdefd0f8e917b9d735"
            },
            "downloads": -1,
            "filename": "HunYuanGPT-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ca1436a54379af72057b5e88c9db128c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17419,
            "upload_time": "2023-12-12T12:54:32",
            "upload_time_iso_8601": "2023-12-12T12:54:32.713760Z",
            "url": "https://files.pythonhosted.org/packages/2b/8d/de54254595ef99c305877bf05e2e0a25351ed076f694fc344c935b18dd2d/HunYuanGPT-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-12 12:54:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "liaozhangsheng",
    "github_project": "HunYuanGPT",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "hunyuangpt"
}
        
Elapsed time: 0.14971s