Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

智谱 GLM 接口无法正确传递 user_id 参数 #525

Open
5 tasks done
ImYrS opened this issue Oct 10, 2024 · 0 comments
Open
5 tasks done

智谱 GLM 接口无法正确传递 user_id 参数 #525

ImYrS opened this issue Oct 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ImYrS
Copy link

ImYrS commented Oct 10, 2024

例行检查

  • 我已确认目前没有类似 issue
  • 我已确认我已升级到最新版本
  • 我已完整查看过项目 README,尤其是常见问题部分
  • 我理解并愿意跟进此 issue,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

问题描述

智谱 API 平台现在会因为传递内容违规进行 API 临时/永久封禁操作。
可以在请求时传递 user_id 作为规避,只会封禁当前用户下该 user_id 的 API 请求。(类似 OpenAI 的 user 参数,作为审查要求)

参考: https://open.bigmodel.cn/dev/howuse/securityaudit

尝试以后不论是直接传递 user 参数还是在 extra_body 中传递 user_id 参数,最终都无法传递到智谱的接口。

不擅长 Go 语言开发无法直接提 PR,只能开此 Issue。期望项目维护者跟进,如有需要可以辅助调试,提供更新信息。感谢。

复现步骤

请求参数如下

conf = ConfigObj("config.ini")
client = OpenAI(
    base_url=conf["OpenAI"]["base_url"],
    api_key=conf["OpenAI"]["api_key"],
)

r = client.chat.completions.create(
    model="glm-4-flashx",
    messages=[{"role": "user", "content": "hi"}],
    extra_body={
        "user_id": "xxxxxx_test_01"
    },
    user="xxxxxx_test_01"
)

API 端实际收到请求参数如下

{
    "model": "glm-4-flashx",
    "messages": [
        {
            "role": "user",
            "content": "hi"
        }
    ],
    "stop": null
}

可见,user_id 参数未能被正确传递。

@ImYrS ImYrS added the bug Something isn't working label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant