lobe-chat icon indicating copy to clipboard operation
lobe-chat copied to clipboard

[Bug]Perplexity AI的API Key使用报错

Open jbswbs opened this issue 1 year ago • 6 comments

💻 系统环境

Windows

📦 部署环境

Docker

🌐 浏览器

Chrome

🐛 问题描述

2024-03-27_163814 2024-03-27_163919 检查通过,但使用回复乱码

🚦 期望结果

No response

📷 复现步骤

No response

📝 补充信息

No response

jbswbs avatar Mar 27 '24 08:03 jbswbs

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


💻 System environment

Windows

📦 Deployment environment

Docker

🌐 Browser

Chrome

🐛 Problem description

2024-03-27_163814 2024-03-27_163919 The check passes, but the response is garbled.

🚦 Expected results

No response

📷 Steps to reproduce

No response

📝 Supplementary information

No response

lobehubbot avatar Mar 27 '24 08:03 lobehubbot

👀 @jbswbs

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

lobehubbot avatar Mar 27 '24 08:03 lobehubbot

同样的问题 https://github.com/lobehub/lobe-chat/issues/1780

limboinf avatar Mar 28 '24 05:03 limboinf

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


same question https://github.com/lobehub/lobe-chat/issues/1780

lobehubbot avatar Mar 28 '24 05:03 lobehubbot

I have the same environment (Docker and Chrome) and I'm having the same issue. Lobe Chat [v0.147.0]

Screenshot 2024-04-10 235555

jerome-massey avatar Apr 11 '24 04:04 jerome-massey

通过代码调用是OK的,但是lobehub 就出现问题了。sonar-small-online、sonar-medium-online 模型都试了。

from openai import OpenAI

messages = [
    {
        "role": "user",
        "content": (
            "美国降息最新消息"
        ),
    },
]

client = OpenAI(api_key=YOUR_API_KEY, base_url="https://api.perplexity.ai")

response = client.chat.completions.create(
    model="sonar-small-online",
    messages=messages,
)
print(response)

python demo.py

输出:

ChatCompletion(id='806bb765-c593-4969-9375-07dcc5aab01e', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='美联储最新消息是在北京时间4月11日凌晨2点发布的,其中显示了美联储官员对美国经济、金融状况以及对货币政策路径的研判,释放了美联储降息、放慢量化紧缩的最新信号。大多数美联储官员认为,政策利率可能处于本轮紧缩周期的峰值,几乎所有联储官员认为,若经济总体发展符合他们的预期,将适合今年某个时候降息。美联储官员上月还讨论了结束缩减资产负债表的可能性。', role='assistant', function_call=None, tool_calls=None), delta={'role': 'assistant', 'content': ''})], created=7292468, model='sonar-small-online', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=194, prompt_tokens=37, total_tokens=231))

同样提示词:

image

limboinf avatar Apr 12 '24 15:04 limboinf

✅ @jbswbs

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

lobehubbot avatar May 09 '24 14:05 lobehubbot

:tada: This issue has been resolved in version 0.156.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

lobehubbot avatar May 09 '24 14:05 lobehubbot

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Sep 29 '25 18:09 github-actions[bot]