Skip to main content

Reverse engineered HunYuan chat

Project description

HunYuanGPT

HunYuanGPT

混元大模型逆向api

安装模块

pip install HunYuanGPT --upgrade

获取cookie

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

  2. 打开腾讯混元助手

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

使用聊天机器人

从命令行运行

$ 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.

在代码中运行

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")

其他用法

# 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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

HunYuanGPT-0.1.0.tar.gz (17.4 kB view details)

Uploaded Source

File details

Details for the file HunYuanGPT-0.1.0.tar.gz.

File metadata

  • Download URL: HunYuanGPT-0.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for HunYuanGPT-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8549131ae111415d62e81c61f6cb66e727b57a85e8529bcdefd0f8e917b9d735
MD5 ca1436a54379af72057b5e88c9db128c
BLAKE2b-256 2b8dde54254595ef99c305877bf05e2e0a25351ed076f694fc344c935b18dd2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page