diff --git a/app.vue b/app.vue index 83da1e2..cec0a45 100644 --- a/app.vue +++ b/app.vue @@ -1,10 +1,15 @@ diff --git a/locales/en-US.json b/locales/en-US.json index 086bc57..442ac80 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -20,5 +20,9 @@ "role.assistant.desc": "MoodHelper is a mood-management assistance bot using Mistral AI.", "locales.title": "Locales", "locales.en": "English", - "locales.cn": "Chinese" + "locales.cn": "Chinese", + "main.response.error": "An error occurred while generating a response. Please refresh the page. If this issue persists, please contact the site admin.", + "docs.coming_soon": "Coming Soon...", + "main.check_docs.1": "Want to use it in your own project?", + "main.check_docs.2": "Check out our docs!" } \ No newline at end of file diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 2a199e3..4ec0407 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -20,5 +20,9 @@ "role.assistant.desc": "情绪帮手是一个帮助人控制情绪的AI助手,由 Mistral AI 驱动。", "locales.title": "语言", "locales.en": "英语", - "locales.cn": "中文" + "locales.cn": "中文", + "main.response.error": "哦不!在生成回复时遇到一个错误。请刷新该网页;若该问题持续发生,请联系站点管理员。", + "docs.coming_soon": "敬请等待...", + "main.check_docs.1": "想要在你自己的项目中使用吗?", + "main.check_docs.2": "来看看我们的文档吧!" } \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index c897e06..5926b48 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -19,14 +19,24 @@ export default defineNuxtConfig({ }, devtools: { enabled: true }, css: ['~/assets/main.css'], - modules: ['@nuxtjs/tailwindcss', '@nuxtjs/i18n', '@nuxt/content'], + modules: ['@nuxtjs/tailwindcss', 'nuxt-rate-limit', '@nuxtjs/i18n', '@nuxt/content'], + nuxtRateLimit: { + routes: { + '/api/v1/*': { + maxRequests: (!process.env.NUXT_API_RATE_LIMIT ? 50 : process.env.NUXT_API_RATE_LIMIT as unknown as number), + intervalSeconds: ((!process.env.NUXT_API_WINDOW_DURATION ? 15 * 60 : process.env.NUXT_API_WINDOW_DURATION as unknown as number * 60)), + }, + }, + }, runtimeConfig: { + apiRateLimit: 50, // Default: 50 requests per min + apiWindowDuration: 15, // Default: 15 minutes + openaiApiKey: '', public:{ - openaiApiKey: '', apiModel: 'gpt-3.5-turbo', aiEndpoint: 'https://api.openai.com/v1/chat/completions', siteUrl: '', siteName: '', } - } + }, }) diff --git a/package.json b/package.json index 679b4fb..add85e0 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "nuxt-app", + "name": "moodhelper-nuxt", "private": true, "type": "module", "scripts": { @@ -16,6 +16,7 @@ "@tailwindcss/typography": "^0.5.10", "express": "^4.18.2", "nuxt": "^3.10.2", + "nuxt-rate-limit": "^1.2.0", "openai": "^4.28.0", "vue": "^3.4.19", "vue-markdown-render": "^2.1.1", diff --git a/pages/docs/index.vue b/pages/docs/index.vue new file mode 100644 index 0000000..15ef4df --- /dev/null +++ b/pages/docs/index.vue @@ -0,0 +1,28 @@ + + + + + \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index 8798f50..e2a2103 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,32 +1,18 @@