mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-02 21:50:43 +08:00
add common ai support
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package ai.chat2db.server.web.api.controller.ai.fastchat.interceptor;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.http.ContentType;
|
||||
import cn.hutool.http.Header;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.Getter;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
@ -28,7 +30,8 @@ public class FastChatHeaderAuthorizationInterceptor implements Interceptor {
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request original = chain.request();
|
||||
Request request = original.newBuilder()
|
||||
.header("apiKey", apiKey) // replace to your corresponding field and value
|
||||
// replace to your corresponding field and value
|
||||
.header(Header.AUTHORIZATION.getValue(), "Bearer " + apiKey)
|
||||
.header(Header.CONTENT_TYPE.getValue(), ContentType.JSON.getValue())
|
||||
.method(original.method(), original.body())
|
||||
.build();
|
||||
|
Reference in New Issue
Block a user