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

chatglm:! HTTP 400 Bad Request. #38

Open
AlizarinScintillate opened this issue Jan 3, 2025 · 1 comment
Open

chatglm:! HTTP 400 Bad Request. #38

AlizarinScintillate opened this issue Jan 3, 2025 · 1 comment

Comments

@AlizarinScintillate
Copy link

流程如下:
set_translate_option(key = "a................................................................a",
appid = "a..............................................................a",
source = "chatglm")
text <- '我都不知道做人该怎么办,总之报纸写啥就信啥,电视演啥我就看啥。'
translate(text)

报错如下:

translate(text)
Error in httr2::req_perform_stream():
! HTTP 400 Bad Request.
Run rlang::last_trace() to see where the error occurred.
rlang::last_trace()
<error/httr2_http_400>
Error in httr2::req_perform_stream():
! HTTP 400 Bad Request.


Backtrace:

  1. └─fanyi::translate(text)
  2. └─fanyi::chatglm_translate(x, from = from, to = to)
  3. └─fanyi:::vectorize_translator(...)
    
  4.   └─fanyi:::.translate(x[i], .fun = .fun, from = from, to = to)
    
  5.     └─fanyi (local) .fun(x, from = from, to = to)
    
  6.       └─fanyi:::.chatglm_query(prompt)
    
  7.         └─httr2::req_perform_stream(...)
    

Run rlang::last_trace(drop = FALSE) to see 3 hidden frames.

rlang::last_trace(drop = FALSE)
<error/httr2_http_400>
Error in httr2::req_perform_stream():
! HTTP 400 Bad Request.


Backtrace:

  1. └─fanyi::translate(text)
  2. └─fanyi::chatglm_translate(x, from = from, to = to)
  3. └─fanyi:::vectorize_translator(...)
    
  4.   └─fanyi:::.translate(x[i], .fun = .fun, from = from, to = to)
    
  5.     └─fanyi (local) .fun(x, from = from, to = to)
    
  6.       └─fanyi:::.chatglm_query(prompt)
    
  7.         └─httr2::req_perform_stream(...)
    
  8.           └─httr2:::handle_resp(req, resp)
    
  9.             └─httr2:::resp_abort(resp, req, body, call = error_call)
    
  10.               └─rlang::abort(...)
    

蹲蹲余叔和好心人帮助

@AlizarinScintillate
Copy link
Author

已经解决,正确的格式是:
set_translate_option(appid='',key = '~~~~~',
source = 'chatglm')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant