Soulter / hugging-chat-api

HuggingChat Python API🤗
GNU Affero General Public License v3.0
817 stars 118 forks source link

【BUG】运行报错: "{"message":"Internal Error"}" #1

Closed zwluoqi closed 1 year ago

zwluoqi commented 1 year ago

运行测试代码,有以下错误:

{"conversationId":"644db6a65666977e279f5904"}
{"message":"Internal Error"}
None
[]

是不是要配置?

Soulter commented 1 year ago

已找到问题,huggingchat最近修改了他们的请求字段,我马上修复

Soulter commented 1 year ago

已解决,请使用

pip install hugchat --upgrade -i https://pypi.org/simple

更新

zwluoqi commented 1 year ago

好的 ,幸苦了,api网址能分享下吗,我想改成C#用用。

已找到问题,huggingchat最近修改了他们的请求字段,我马上修复

Soulter commented 1 year ago

没有提供公开的api,我是通过抓包拿到的,网址是这个: https://huggingface.co/chat

zwluoqi commented 1 year ago
        req_json = {
            "inputs": text,
            "parameters": {
                "temperature": temperature,
                "top_p": top_p,
                "repetition_penalty": repetition_penalty,
                "top_k": top_k,
                "truncate": truncate,
                "watermark": False,
                "max_new_tokens": 1024,
                "stop": ["</s>"],
                "return_full_text": False,
                "stream": True,
            },
            "options": {
                    "use_cache": False,
                    "is_retry": False,
                    "id": str(uuid.uuid4()),
            },
        }

这个input只是需要当前的发送信息就可以了,上下文在hugging那边记录。就是不能向chatgpt那样,自己构建上下文是把?

Soulter commented 1 year ago
        req_json = {
            "inputs": text,
            "parameters": {
                "temperature": temperature,
                "top_p": top_p,
                "repetition_penalty": repetition_penalty,
                "top_k": top_k,
                "truncate": truncate,
                "watermark": False,
                "max_new_tokens": 1024,
                "stop": ["</s>"],
                "return_full_text": False,
                "stream": True,
            },
            "options": {
                    "use_cache": False,
                    "is_retry": False,
                    "id": str(uuid.uuid4()),
            },
        }

这个input只是需要当前的发送信息就可以了,上下文在hugging那边记录。就是不能向chatgpt那样,自己构建上下文是把?

对,应该是这样的