chore: remove model provider free token link (#4579)

This commit is contained in:
zxhlyh
2024-05-22 16:42:49 +08:00
committed by GitHub
parent 24576a39e5
commit 4f62541bfb
6 changed files with 4 additions and 109 deletions

View File

@@ -24,7 +24,6 @@ import {
fetchModelProviderCredentials,
fetchModelProviders,
getPayUrl,
submitFreeQuota,
} from '@/service/common'
import { useProviderContext } from '@/context/provider-context'
@@ -202,30 +201,6 @@ export const useAnthropicBuyQuota = () => {
return handleGetPayUrl
}
export const useFreeQuota = (onSuccess: () => void) => {
const [loading, setLoading] = useState(false)
const handleClick = async (type: string) => {
if (loading)
return
try {
setLoading(true)
const res = await submitFreeQuota(`/workspaces/current/model-providers/${type}/free-quota-submit`)
if (res.type === 'redirect' && res.redirect_url)
window.location.href = res.redirect_url
else if (res.type === 'submit' && res.result === 'success')
onSuccess()
}
finally {
setLoading(false)
}
}
return handleClick
}
export const useModelProviders = () => {
const { data: providersData, mutate, isLoading } = useSWR('/workspaces/current/model-providers', fetchModelProviders)