EdgeGPT

2025-12-11 0 662

该项目已存档。由于个人情况,我没有时间来维持此存储库。

边缘GPT

反向工程新版本的bing聊天功能

英语 – 简体中文繁体中文 -Español-日本语

设置

安装软件包

python3 -m pip install EdgeGPT --upgrade

要求

  • Python 3.8+
  • Microsoft帐户,可访问https://b**ing.co*m/chat(可选,取决于您的地区
  • 在受支持的国家或地区需要新的Bing(需要中国大陆VPN)
  • 硒(用于自动饼干设置)

验证

!!!!可能不再需要!!!

在某些地区,微软使每个人都可以使用聊天功能,因此您可以跳过此步骤。您可以通过尝试在不登录的情况下启动聊天来使用浏览器(用用户代理设置以反射边缘)检查一下。

还发现它可能取决于您的IP地址。例如,如果您尝试从已知属于数据中心范围的IP中访问聊天功能(VSERVERS,根服务器,VPN,Common Proxies,…),则可能需要登录,同时可以从您的家庭IP地址访问该功能。

如果收到以下错误,则可以尝试提供cookie并查看它是否有效,然后:

例外:身份验证失败。您尚未被接受到Beta。

收集饼干

  1. 获取一个看起来像Microsoft Edge的浏览器。
  • A)(轻松)安装最新版本的Microsoft Edge
  • b)(提前)您可以使用任何浏览器,并将用户设置为看起来像使用边缘(例如,Mozilla/5.0(Windows NT 10.0; Win64; x64)AppleWebkit/537.36(Khtml,Khtml,喜欢Gecko)Chrome/111.0.0.0.0.0.0.0.0.0.0.0.0.111111.11.11.0.11.0.11.0.0.0.61.0.0.0.0.0.0.61.0.0.0.66.0.0.61.0.0.61.0.b/ed。您可以使用Chrome和Firefox的“用户代理切换器和管理器”(例如“用户代理切换器和管理器”)轻松执行此操作。
  1. 打开bing.com/chat
  2. 如果您看到聊天功能,那么您可以继续…
  3. 安装chrome或firefox的曲奇编辑器扩展程序
  4. 转到bing.com
  5. 打开扩展名
  6. 单击右下方的“导出”,然后“导出为JSON”(这将您的cookie保存到剪贴板))
  7. 将您的cookie粘贴到文件bing_cookies _*。json中。
    • 注意: cookies文件名必须遵循正则示意bing_cookies _*。json ,以便可以通过内部cookie处理机制识别它们

在代码中使用cookie:

 cookies = json . loads ( open ( \"./path/to/cookies.json\" , encoding = \"utf-8\" ). read ())  # might omit cookies option
bot = await Chatbot . create ( cookies = cookies )

如何使用聊天机器人

从指令行跑

EdgeGPT -h

EdgeGPT – A demo of reverse engineering the Bing GPT chatbot
Repo: github.com/acheong08/ EdgeGPT
By: Antonio Cheong

!help for help

Type !exit to exit

usage: EdgeGPT .py [-h] [–enter-once] [–search-result] [–no-stream] [–rich] [–proxy PROXY] [–wss-link WSS_LINK]
[–style {creative,balanced,precise}] [–prompt PROMPT] [–cookie-file COOKIE_FILE]
[–history-file HISTORY_FILE] [–locale LOCALE]

options:
-h, –help show this help message and exit
–enter-once
–search-result
–no-stream
–rich
–proxy PROXY Proxy URL (e.g. socks5://127.0.0.1:1080)
–wss-link WSS_LINK WSS URL(e.g. wss://sydney.bing.com/sydney/ChatHub)
–style {creative,balanced,precise}
–prompt PROMPT prompt to start with
–cookie-file COOKIE_FILE
path to cookie file
–history-file HISTORY_FILE
path to history file
–locale LOCALE your locale (e.g. en-US, zh-CN, en-IE, en-GB)\”>

 $ python3 -m EdgeGPT . EdgeGPT -h

        EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
        Repo: github.com/acheong08/ EdgeGPT
        By: Antonio Cheong

        !help for help

        Type !exit to exit

usage: EdgeGPT .py [-h] [--enter-once] [--search-result] [--no-stream] [--rich] [--proxy PROXY] [--wss-link WSS_LINK]
                  [--style {creative,balanced,precise}] [--prompt PROMPT] [--cookie-file COOKIE_FILE]
                  [--history-file HISTORY_FILE] [--locale LOCALE]

options:
  -h, --help            show this help message and exit
  --enter-once
  --search-result
  --no-stream
  --rich
  --proxy PROXY         Proxy URL (e.g. socks5://127.0.0.1:1080)
  --wss-link WSS_LINK   WSS URL(e.g. wss://sydney.bing.com/sydney/ChatHub)
  --style {creative,balanced,precise}
  --prompt PROMPT       prompt to start with
  --cookie-file COOKIE_FILE
                        path to cookie file
  --history-file HISTORY_FILE
                        path to history file
  --locale LOCALE       your locale (e.g. en-US, zh-CN, en-IE, en-GB)

(中国/美国/英国/挪威对地方的支持得到了增强)

在Python跑

1。聊天机器人类和异步

例如,使用异步来获得最佳体验,例如:

EdgeGPT import Chatbot, ConversationStyle

async def main():
bot = await Chatbot.create() # Passing cookies is \”optional\”, as explained above
response = await bot.ask(prompt=\”Hello world\”, conversation_style=ConversationStyle.creative, simplify_response=True)
print(json.dumps(response, indent=2)) # Returns
\”\”\”
{
\”text\”: str,
\”author\”: str,
\”sources\”: list[dict],
\”sources_text\”: str,
\”suggestions\”: list[str],
\”messages_left\”: int
}
\”\”\”
await bot.close()

if __name__ == \”__main__\”:
asyncio.run(main())\”>

 import asyncio , json
from EdgeGPT . EdgeGPT import Chatbot , ConversationStyle

async def main ():
    bot = await Chatbot . create () # Passing cookies is \"optional\", as explained above
    response = await bot . ask ( prompt = \"Hello world\" , conversation_style = ConversationStyle . creative , simplify_response = True )
    print ( json . dumps ( response , indent = 2 )) # Returns
    \"\"\"
{
    \"text\": str,
    \"author\": str,
    \"sources\": list[dict],
    \"sources_text\": str,
    \"suggestions\": list[str],
    \"messages_left\": int
}
    \"\"\"
    await bot . close ()

if __name__ == \"__main__\" :
    asyncio . run ( main ())

2)查询和饼干助手课程

创建一个简单的Bing Chat AI查询(默认使用“精确”对话样式),仅查看主要文本输出,而不是整个API响应:

remeber以特定格式存储您的cookie:bing_cookies _*。json。

EdgeGPT.EdgeUtils import Query, Cookie

q = Query(\”What are you? Give your answer as Python code\”)
print(q)\”>

 from EdgeGPT . EdgeUtils import Query , Cookie

q = Query ( \"What are you? Give your answer as Python code\" )
print ( q )

存储cookie文件的默认目录是Home/bing_cookies,但您可以通过以下方式更改它:

 Cookie . dir_path = Path ( r\"...\" )

或更改要使用的对话样式或cookie文件:

 q = Query (
  \"What are you? Give your answer as Python code\" ,
  style = \"creative\" ,  # or: \'balanced\', \'precise\'
  cookie_file = \"./bing_cookies_alternative.json\"
)

#  Use `help(Query)` to see other supported parameters.

快速提取文本输出,代码段,源/参考列表或使用以下属性从响应中提出的后续问题:

 q . output  # Also: print(q)
q . sources
q . sources_dict
q . suggestions
q . code
q . code_blocks
q . code_block_formatsgiven )

获取您指定的原始提示和对话样式:

 q . prompt
q . ignore_cookies
q . style
q . simplify_response
q . locale
repr ( q )

自导入查询以来进行的访问以前的查询:

 Query . index  # A list of Query objects; updated dynamically
Query . image_dir_path

最后,cookie类支持多个cookie文件,因此,如果您使用命名约定的bing_cookies _*。json创建其他cookie文件,您的查询将自动尝试使用下一个文件(如果您超过了每日的请求的配额)(当前设置为200)。

这是您可以访问的主要属性:

 Cookie . current_file_index
Cookie . current_file_path
Cookie . current_data
Cookie . dir_path
Cookie . search_pattern
Cookie . files
Cookie . image_token
Cookie . import_next
Cookie . rotate_cookies
Cookie . ignore_files
Cookie . supplied_files
Cookie . request_count 

与Docker一起运行

这假设您当前的工作目录中有一个文件cookies.json

docker run --rm -it -v $( pwd ) /cookies.json:/cookies.json:ro -e COOKIE_FILE= \' /cookies.json \' ghcr.io/acheong08/ EdgeGPT

您可以添加任何额外的标志如下

docker run --rm -it -v $( pwd ) /cookies.json:/cookies.json:ro -e COOKIE_FILE= \' /cookies.json \' ghcr.io/acheong08/ EdgeGPT --rich --style creative

如何使用图像生成器

从指令行跑

$ python3 -m ImageGen.ImageGen -h
usage: ImageGen.py [-h] [-U U] [--cookie-file COOKIE_FILE] --prompt PROMPT [--output-dir OUTPUT_DIR] [--quiet] [--asyncio]

optional arguments:
  -h, --help            show this help message and exit
  -U U                  Auth cookie from browser
  --cookie-file COOKIE_FILE
                        File containing auth cookie
  --prompt PROMPT       Prompt to generate images for
  --output-dir OUTPUT_DIR
                        Output directory
  --quiet               Disable pipeline messages
  --asyncio             Run ImageGen using asyncio

在Python跑

1)ImageQuery助手课程

根据简单的提示生成图像,然后下载到当前的工作目录:

EdgeGPT.EdgeUtils import ImageQuery

q=ImageQuery(\”Meerkats at a garden party in Devon\”)\”>

 from EdgeGPT . EdgeUtils import ImageQuery

q = ImageQuery ( \"Meerkats at a garden party in Devon\" )

更改本会话中所有未来图像的下载目录:

Query.image_dirpath = Path(\"./to_another_folder\")

2)图像Gen类和异步用于更颗粒的控制

EdgeGPT.ImageGen import ImageGen
import argparse
import json

async def async_image_gen(args) -> None:
async with ImageGenAsync(args.U, args.quiet) as image_generator:
images = await image_generator.get_images(args.prompt)
await image_generator.save_images(images, output_dir=args.output_dir)

if __name__ == \”__main__\”:
parser = argparse.ArgumentParser()
parser.add_argument(\”-U\”, help=\”Auth cookie from browser\”, type=str)
parser.add_argument(\”–cookie-file\”, help=\”File containing auth cookie\”, type=str)
parser.add_argument(
\”–prompt\”,
help=\”Prompt to generate images for\”,
type=str,
required=True,
)
parser.add_argument(
\”–output-dir\”,
help=\”Output directory\”,
type=str,
default=\”./output\”,
)
parser.add_argument(
\”–quiet\”, help=\”Disable pipeline messages\”, action=\”store_true\”
)
parser.add_argument(
\”–asyncio\”, help=\”Run ImageGen using asyncio\”, action=\”store_true\”
)
args = parser.parse_args()
# Load auth cookie
with open(args.cookie_file, encoding=\”utf-8\”) as file:
cookie_json = json.load(file)
for cookie in cookie_json:
if cookie.get(\”name\”) == \”_U\”:
args.U = cookie.get(\”value\”)
break

if args.U is None:
raise Exception(\”Could not find auth cookie\”)

if not args.asyncio:
# Create image generator
image_generator = ImageGen(args.U, args.quiet)
image_generator.save_images(
image_generator.get_images(args.prompt),
output_dir=args.output_dir,
)
else:
asyncio.run(async_image_gen(args))
\”>

 from EdgeGPT . ImageGen import ImageGen
import argparse
import json

async def async_image_gen ( args ) -> None :
    async with ImageGenAsync ( args . U , args . quiet ) as image_generator :
        images = await image_generator . get_images ( args . prompt )
        await image_generator . save_images ( images , output_dir = args . output_dir )

if __name__ == \"__main__\" :
    parser = argparse . ArgumentParser ()
    parser . add_argument ( \"-U\" , help = \"Auth cookie from browser\" , type = str )
    parser . add_argument ( \"--cookie-file\" , help = \"File containing auth cookie\" , type = str )
    parser . add_argument (
        \"--prompt\" ,
        help = \"Prompt to generate images for\" ,
        type = str ,
        required = True ,
    )
    parser . add_argument (
        \"--output-dir\" ,
        help = \"Output directory\" ,
        type = str ,
        default = \"./output\" ,
    )
    parser . add_argument (
        \"--quiet\" , help = \"Disable pipeline messages\" , action = \"store_true\"
    )
    parser . add_argument (
        \"--asyncio\" , help = \"Run ImageGen using asyncio\" , action = \"store_true\"
    )
    args = parser . parse_args ()
    # Load auth cookie
    with open ( args . cookie_file , encoding = \"utf-8\" ) as file :
        cookie_json = json . load ( file )
        for cookie in cookie_json :
            if cookie . get ( \"name\" ) == \"_U\" :
                args . U = cookie . get ( \"value\" )
                break

    if args . U is None :
        raise Exception ( \"Could not find auth cookie\" )

    if not args . asyncio :
        # Create image generator
        image_generator = ImageGen ( args . U , args . quiet )
        image_generator . save_images (
            image_generator . get_images ( args . prompt ),
            output_dir = args . output_dir ,
        )
    else :
        asyncio . run ( async_image_gen ( args ))

星历史

贡献者

由于所有贡献的人,该项目的存在。

下载源码

通过命令行克隆项目:

git clone https://github.com/acheong08/EdgeGPT.git

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

申明:本文由第三方发布,内容仅代表作者观点,与本网站无关。对本文以及其中全部或者部分内容的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。本网发布或转载文章出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,也不代表本网对其真实性负责。

左子网 建站资源 EdgeGPT https://www.zuozi.net/35473.html

MyIP
下一篇: MyIP
常见问题
  • 1、自动:拍下后,点击(下载)链接即可下载;2、手动:拍下后,联系卖家发放即可或者联系官方找开发者发货。
查看详情
  • 1、源码默认交易周期:手动发货商品为1-3天,并且用户付款金额将会进入平台担保直到交易完成或者3-7天即可发放,如遇纠纷无限期延长收款金额直至纠纷解决或者退款!;
查看详情
  • 1、描述:源码描述(含标题)与实际源码不一致的(例:货不对板); 2、演示:有演示站时,与实际源码小于95%一致的(但描述中有”不保证完全一样、有变化的可能性”类似显著声明的除外); 3、发货:不发货可无理由退款; 4、安装:免费提供安装服务的源码但卖家不履行的; 5、收费:价格虚标,额外收取其他费用的(但描述中有显著声明或双方交易前有商定的除外); 6、其他:如质量方面的硬性常规问题BUG等。 注:经核实符合上述任一,均支持退款,但卖家予以积极解决问题则除外。
查看详情
  • 1、左子会对双方交易的过程及交易商品的快照进行永久存档,以确保交易的真实、有效、安全! 2、左子无法对如“永久包更新”、“永久技术支持”等类似交易之后的商家承诺做担保,请买家自行鉴别; 3、在源码同时有网站演示与图片演示,且站演与图演不一致时,默认按图演作为纠纷评判依据(特别声明或有商定除外); 4、在没有”无任何正当退款依据”的前提下,商品写有”一旦售出,概不支持退款”等类似的声明,视为无效声明; 5、在未拍下前,双方在QQ上所商定的交易内容,亦可成为纠纷评判依据(商定与描述冲突时,商定为准); 6、因聊天记录可作为纠纷评判依据,故双方联系时,只与对方在左子上所留的QQ、手机号沟通,以防对方不承认自我承诺。 7、虽然交易产生纠纷的几率很小,但一定要保留如聊天记录、手机短信等这样的重要信息,以防产生纠纷时便于左子介入快速处理。
查看详情

相关文章

猜你喜欢
发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务