spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

spring-ai-qianfan unknown client id

Open huashuiwujiale opened this issue 1 year ago • 2 comments

Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create. If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description 按照springai官网的配置接入qianfan(spring-ai-qianfan-spring-boot-starter),调用以下接口报错 401 Unauthorized: "{"error_description":"unknown client id","error":"invalid_client"}<EOL>"

我知道请求中缺少client id,但是不知道在哪里进行配置

Environment @GetMapping("/ai/generate") public Map generate(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) { return Map.of("generation", chatClient.call(message)); }

Steps to reproduce Steps to reproduce the issue.

Expected behavior A clear and concise description of what you expected to happen.

Minimal Complete Reproducible example Please provide a failing test or a minimal complete verifiable example that reproduces the issue. Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

huashuiwujiale avatar Sep 30 '24 03:09 huashuiwujiale

the client id is your app api key, check you application on: https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application/v1

you can create an app, get the api key and secret key.

mxsl-gr avatar Sep 30 '24 05:09 mxsl-gr

and config the application.yml file, like this:

spring:
  ai:
    qianfan:
      apiKey: {your app api key}
      secretKey: {your app secret key}

mxsl-gr avatar Sep 30 '24 05:09 mxsl-gr

V1报错,完全按照文档来复制代码,运行起来后,请求接口的的时候,异常

jobmission avatar Feb 25 '25 08:02 jobmission