Skip to content

Commit

Permalink
fix: Gemini 500
Browse files Browse the repository at this point in the history
  • Loading branch information
Jazee6 committed Jun 4, 2024
1 parent e1de51e commit 72de829
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ https://dash.deno.com
- Build Step改为`NITRO_PRESET=deno-deploy npm run build_node`
- Deploy Project
- 设置环境变量
- 部分地区可能需要Gemini反代

### Docker

Expand Down Expand Up @@ -53,6 +52,7 @@ https://developers.cloudflare.com/workers-ai/models/
| CF_GATEWAY | Cloudflare AI Gateway URL |
| OPENAI_API_KEY | OpenAI API Key (需要ChatGPT时填写) |
| G_API_KEY | Google AI API Key (需要GeminiPro时填写) |
| G_API_URL | Google AI 反代 (不支持地区填写,或参考以下配置) |
| PASSWORD | 访问密码 (可选) |

示例: 查看`.env.example`文件
Expand All @@ -75,12 +75,26 @@ https://dash.cloudflare.com/
- 添加新 AI Gateway
- 填写名称和URL slug创建
- 单击右上角API Endpoints
- 复制您的Universal Endpoint(去掉末尾'/'),设置环境变量
- 复制您的Universal Endpoint(去掉末尾`/`),设置环境变量

#### G_API_KEY

https://ai.google.dev/tutorials/rest_quickstart#set_up_your_api_key

#### G_API_URL

参考 https://github.com/Jazee6/gemini-proxy 搭建反代,末尾无需`/`

或者在`nuxt.config.ts`中添加以下配置

```
nitro: {
vercel: {
regions: ["sin1", "syd1", "sfo1", "iad1", "pdx1", "cle1"]
}
}
```

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=Jazee6/cloudflare-ai-web&type=Date)](https://star-history.com/#Jazee6/cloudflare-ai-web&Date)
2 changes: 1 addition & 1 deletion components/ChatInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const handlePaste = (e: ClipboardEvent) => {
<UButton class="m-1" @click="addHistory = !addHistory" :color="addHistory?'primary':'gray'"
icon="i-heroicons-clock-solid"/>
</UTooltip>
<UTooltip v-if="selectedModel.type === 'universal'" :text="$t('add_image')">
<UTooltip v-if="selectedModel.type === 'universal'" :text="$t('add_image') + '(' + $t('support_paste') + ')'">
<UButton @click="handleAddFiles" color="white" class="m-1" icon="i-heroicons-paper-clip-16-solid"/>
</UTooltip>
<UTextarea v-model="input" :placeholder="$t('please_input_text') + '...' "
Expand Down
6 changes: 3 additions & 3 deletions components/IButton.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
defineProps({
name: String
})
defineProps<{
name: string
}>()
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ defineProps<{
</aside>
</template>

<style scoped>
<style scoped lang="postcss">
.hide {
@apply -translate-x-full opacity-0 w-0 m-0 invisible transition-all
}
Expand Down
10 changes: 2 additions & 8 deletions i18n.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ export default defineI18nConfig(() => ({
setting: '设置',
use_own_key: '使用自己的key',
new_chat: '新建对话',
// need_image: '需要图片',
// waited: '已等待',
// image_max_5MB: '图片大小不能超过5MB',
input_password: '请输入访问密码',
confirm: '确定',
with_history: '发送时携带历史记录',
without_history: '发送时不携带历史记录',
please_input_text: '请输入文本',
add_image: '添加图片',
// support_paste: '支持粘贴',
support_paste: '支持粘贴',
send: '发送',
img_gen_steps: '图片生成步数',
text_generation: '文本生成',
Expand All @@ -26,16 +23,13 @@ export default defineI18nConfig(() => ({
setting: 'Setting',
use_own_key: 'Use own key',
new_chat: 'New chat',
// need_image: 'Need image',
// waited: 'Waited',
// image_max_5MB: 'Image size cannot exceed 5MB',
input_password: 'Please enter access password',
confirm: 'Confirm',
with_history: 'Send with history',
without_history: 'Send without history',
please_input_text: 'Please input text',
add_image: 'Add image',
// support_paste: 'Support paste',
support_paste: 'Support paste',
send: 'Send',
img_gen_steps: 'Image generation steps',
text_generation: 'Text generation',
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default defineNuxtConfig({
}
// nitro: {
// vercel: {
// regions: ["cle1", "iad1", "pdx1", "sfo1", "sin1", "syd1", "hnd1", "kix1"]
// regions: ["sin1", "syd1", "sfo1", "iad1", "pdx1", "cle1"]
// }
// }
})

0 comments on commit 72de829

Please sign in to comment.