feat: optimize getHeaders

This commit is contained in:
Dogtiti 2024-07-06 11:16:00 +08:00
parent b58bbf8eb4
commit 700b06f9c5
1 changed files with 2 additions and 2 deletions

View File

@ -157,6 +157,7 @@ export class ClientApi {
export function getHeaders() { export function getHeaders() {
const accessStore = useAccessStore.getState(); const accessStore = useAccessStore.getState();
const chatStore = useChatStore.getState();
const headers: Record<string, string> = { const headers: Record<string, string> = {
"Content-Type": "application/json", "Content-Type": "application/json",
Accept: "application/json", Accept: "application/json",
@ -165,8 +166,7 @@ export function getHeaders() {
const clientConfig = getClientConfig(); const clientConfig = getClientConfig();
function getConfig() { function getConfig() {
const modelConfig = useChatStore.getState().currentSession() const modelConfig = chatStore.currentSession().mask.modelConfig;
.mask.modelConfig;
const isGoogle = modelConfig.providerName == ServiceProvider.Google; const isGoogle = modelConfig.providerName == ServiceProvider.Google;
const isAzure = modelConfig.providerName === ServiceProvider.Azure; const isAzure = modelConfig.providerName === ServiceProvider.Azure;
const isAnthropic = modelConfig.providerName === ServiceProvider.Anthropic; const isAnthropic = modelConfig.providerName === ServiceProvider.Anthropic;