在使用vercel部署后使用,报了两个错,麻烦各位大佬帮忙看看。
me4p0 opened this issue · 8 comments
me4p0 commented
在使用vercel部署后使用,报了两个错,麻烦各位大佬帮忙看看。
1.首先,因为部署代理的链接不可用,因此采用了修改nuxt.config.ts文件的方法,修改后如下,不知是否对不对?
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: {enabled: true},
modules: ['@nuxt/ui'],
css: ['~/assets/css/style.css'],
devServer: {
port: 3001,
},
routeRules: {
'/': {
prerender: true,
}
},
app: {
head: {
title: 'CF AI Web',
meta: [
{
name: 'keywords',
content: 'CF AI Web, AI, Cloudflare Workers, ChatGPT, GeminiPro, Google Generative AI'
},
{
name: 'description',
content: 'Integrated web platform supporting GeminiPro/Cloudflare Workers AI/ChatGPT by Jazee6'
}
]
}
}
})
nitro: {
vercel: {
regions: ["cle1", "iad1", "pdx1", "sfo1", "sin1", "syd1", "hnd1", "kix1"]
}
}
2.环境变量添加了gemini api key,现在报错代码如下。
[POST] /api/auth/gemini/?model=gemini-pro status=500
[nuxt] [request error] [unhandled] [500] [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1/models/gemini-pro:streamGenerateContent?alt=sse: [400 Bad Request] User location is not supported for the API use.
at (index.mjs:1:117483)
at (index.mjs:1:121866)
Jazee6 commented
你好,配置需要放在defineNuxtConfig中
me4p0 commented
像这样?
export default defineNuxtConfig({
devtools: {enabled: true},
modules: ['@nuxt/ui'],
css: ['~/assets/css/style.css'],
devServer: {
port: 3001,
},
routeRules: {
'/': {
prerender: true,
}
},
app: {
head: {
title: 'CF AI Web',
meta: [
{
name: 'keywords',
content: 'CF AI Web, AI, Cloudflare Workers, ChatGPT, GeminiPro, Google Generative AI'
},
{
name: 'description',
content: 'Integrated web platform supporting GeminiPro/Cloudflare Workers AI/ChatGPT by Jazee6'
}
]
}
},
nitro: {
vercel: {
regions: ["cle1", "iad1", "pdx1", "sfo1", "sin1", "syd1", "hnd1", "kix1"]
}
}
})
Jazee6 commented
是的,不过前面少了一个,
me4p0 commented
感谢大佬,在上面重新编辑了,方便业余选手复制。
me4p0 commented
redepoly了下,还是一样的报错,困惑……
Jazee6 commented
me4p0 commented
me4p0 commented
已解决,可以正常使用了,出现了一个特别noobs的操作,我github仓库里修改来修改去,原来我的仓库是在gitlab里 ,lOL,谢谢