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

GPT 接口返回401/429/500 的时候,偶现的json 解析异常 #294

Open
CharlesTHN opened this issue Sep 18, 2024 · 0 comments
Open

Comments

@CharlesTHN
Copy link

异常信息:

cn.hutool.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
	at cn.hutool.json.JSONTokener.syntaxError(JSONTokener.java:450)
	at cn.hutool.json.JSONParser.parseTo(JSONParser.java:48)
	at cn.hutool.json.ObjectMapper.mapFromTokener(ObjectMapper.java:243)
	at cn.hutool.json.ObjectMapper.mapFromStr(ObjectMapper.java:219)
	at cn.hutool.json.ObjectMapper.map(ObjectMapper.java:98)
	at cn.hutool.json.JSONObject.<init>(JSONObject.java:210)
	at cn.hutool.json.JSONObject.<init>(JSONObject.java:187)
	at cn.hutool.json.JSONObject.<init>(JSONObject.java:142)
	at cn.hutool.json.JSONObject.<init>(JSONObject.java:125)
	at cn.hutool.json.JSONUtil.parseObj(JSONUtil.java:88)
	at cn.hutool.json.JSONUtil.toBean(JSONUtil.java:420)
	at com.unfbx.chatgpt.interceptor.OpenAiResponseInterceptor.intercept(OpenAiResponseInterceptor.java:32)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.kt:154)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
	at retrofit2.OkHttpCall.execute(OkHttpCall.java:204)
	at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:46)
	at io.reactivex.Observable.subscribe(Observable.java:10151)
	at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:35)
	at io.reactivex.Observable.subscribe(Observable.java:10151)
	at io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:35)
	at io.reactivex.Single.subscribe(Single.java:2517)
	at io.reactivex.Single.blockingGet(Single.java:2001)
	at com.unfbx.chatgpt.OpenAiClient.chatCompletion(OpenAiClient.java:699)
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