Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/bcat95/ChatGPT-Web
Browse files Browse the repository at this point in the history
  • Loading branch information
bcat95 committed Apr 21, 2024
2 parents 26aa4c2 + 2af0180 commit ce20481
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 26 deletions.
14 changes: 8 additions & 6 deletions service/src/chatgpt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ const { HttpsProxyAgent } = httpsProxyAgent
dotenv.config()

const ErrorCodeMessage: Record<string, string> = {
401: '[OpenAI] 提供错误的API密钥 | Incorrect API key provided',
403: '[OpenAI] 服务器拒绝访问,请稍后再试 | Server refused to access, please try again later',
502: '[OpenAI] 错误的网关 | Bad Gateway',
503: '[OpenAI] 服务器繁忙,请稍后再试 | Server is busy, please try again later',
504: '[OpenAI] 网关超时 | Gateway Time-out',
500: '[OpenAI] 服务器繁忙,请稍后再试 | Internal Server Error',
401: '[OpenAI] Đã cung cấp khóa API không chính xác',
403: '[OpenAI] Máy chủ từ chối truy cập, vui lòng thử lại sau',
502: '[OpenAI] Cổng xấu',
503: '[OpenAI] Máy chủ đang bận, vui lòng thử lại sau',
504: '[OpenAI] Hết thời gian yêu cầu',
500: '[OpenAI] Lỗi máy chủ nội bộ',
429: '[OpenAI] Máy chủ quá tải, hãy dùng luân phiên mentor.chatvn.org và chatgpt.chatvn.org hoặc chatgpt2.chatvn.org .Thông báo lý do quá tải: https://chatvn.org/page/thong-bao-ve-tinh-trang-may-chu-va-ngan-sach-cho-chatvn-org/',
}

const timeoutMs: number = !isNaN(+process.env.TIMEOUT_MS) ? +process.env.TIMEOUT_MS : 100 * 1000
Expand Down Expand Up @@ -78,6 +79,7 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
apiModel = 'ChatGPTAPI'
}
else {
console.log('OPENAI_ACCESS_TOKEN',OPENAI_ACCESS_TOKEN);

Check failure on line 82 in service/src/chatgpt/index.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
const options: ChatGPTUnofficialProxyAPIOptions = {
accessToken: process.env.OPENAI_ACCESS_TOKEN,
apiReverseProxyUrl: isNotEmptyString(process.env.API_REVERSE_PROXY) ? process.env.API_REVERSE_PROXY : 'https://ai.fakeopen.com/api/conversation',
Expand Down
2 changes: 1 addition & 1 deletion service/src/middleware/limiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const limiter = rateLimit({
max: maxCount,
statusCode: 200, // 200 means success,but the message is 'Too many request from this IP in 1 hour'
message: async (req, res) => {
res.send({ status: 'Fail', message: 'Too many request from this IP in 1 hour', data: null })
res.send({ status: 'Fail', message: 'Giới hạn trò chuyện trong 1h, bạn hãy sử dụng https://mentor.chatvn.org để chat không giới hạn.', data: null })
},
})

Expand Down
2 changes: 1 addition & 1 deletion src/assets/recommend.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"key": "chatgpt-prompt-collection",
"desc": "Prompt được thu thập bởi Nothing1024",
"downloadUrl": "https://chatgptvietnam.org/chatgpt/awesome-chatgpt-prompts-vi.php",
"downloadUrl": "https://chatvn.org/chatgpt/awesome-chatgpt-prompts-vi.php",
"url": "https://github.com/bcat95/chatgpt-prompt-collection"
}
]
12 changes: 3 additions & 9 deletions src/hooks/useLanguage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { computed } from 'vue'
import { viVN, enUS, zhCN, zhTW } from 'naive-ui'
import { viVN, enUS } from 'naive-ui'
import { useAppStore } from '@/store'
import { setLocale } from '@/locales'

Expand All @@ -14,15 +14,9 @@ export function useLanguage() {
case 'en-US':
setLocale('en-US')
return enUS
case 'zh-CN':
setLocale('zh-CN')
return zhCN
case 'zh-TW':
setLocale('zh-TW')
return zhTW
default:
setLocale('en-US')
return enUS
setLocale('vi-VN')
return viVN
}
})

Expand Down
2 changes: 2 additions & 0 deletions src/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default {
failed: 'Failed',
verify: 'Verify',
unauthorizedTips: 'Unauthorized, please verify first.',
stopResponding: 'Stop Responding',
},
chat: {
newChatButton: 'New Chat',
Expand Down Expand Up @@ -74,6 +75,7 @@ export default {
monthlyUsage: 'Monthly Usage',
},
store: {
siderButton: 'Prompt Store',
local: 'Local',
online: 'Online',
title: 'Title',
Expand Down
2 changes: 1 addition & 1 deletion src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const i18n = createI18n({
messages: {
'vi-VN': viVN,
'en-US': enUS,
'zh-CN': zhCN,
'zh-CN': zhCN,
'zh-TW': zhTW,
},
})
Expand Down
1 change: 1 addition & 0 deletions src/locales/vi-VN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default {
monthlyUsage: 'Sử dụng hàng tháng',
},
store: {
siderButton: 'Thư viện Prompt',
local: 'Địa phương',
online: 'Trực tuyến',
title: 'Tiêu đề',
Expand Down
4 changes: 3 additions & 1 deletion src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default {
failed: '操作失败',
verify: '验证',
unauthorizedTips: '未经授权,请先进行验证。',
stopResponding: '停止响应',
},
chat: {
newChatButton: '新建聊天',
Expand Down Expand Up @@ -74,6 +75,7 @@ export default {
monthlyUsage: '本月使用量',
},
store: {
siderButton: '提示词商店',
local: '本地',
online: '在线',
title: '标题',
Expand All @@ -90,4 +92,4 @@ export default {
onlineImportWarning: '注意:请检查 JSON 文件来源!',
downloadError: '请检查网络状态与 JSON 文件有效性',
},
}
}
10 changes: 6 additions & 4 deletions src/locales/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ export default {
failed: '操作失敗',
verify: '驗證',
unauthorizedTips: '未經授權,請先進行驗證。',
stopResponding: '停止回應',
},
chat: {
newChatButton: '新建對話',
newChatButton: '新增對話',
placeholder: '來說點什麼...(Shift + Enter = 換行,"/" 觸發提示詞)',
placeholderMobile: '來說點什麼...',
copy: '複製',
Expand All @@ -53,7 +54,7 @@ export default {
setting: {
setting: '設定',
general: '總覽',
advanced: '高級',
advanced: '進階',
config: '設定',
avatarLink: '頭貼連結',
name: '名稱',
Expand All @@ -70,10 +71,11 @@ export default {
timeout: '逾時',
socks: 'Socks',
httpsProxy: 'HTTPS Proxy',
balance: 'API余額',
balance: 'API Credit 餘額',
monthlyUsage: '本月使用量',
},
store: {
siderButton: '提示詞商店',
local: '本機',
online: '線上',
title: '標題',
Expand All @@ -90,4 +92,4 @@ export default {
onlineImportWarning: '注意:請檢查 JSON 檔案來源!',
downloadError: '請檢查網路狀態與 JSON 檔案有效性',
},
}
}
6 changes: 3 additions & 3 deletions src/store/modules/user/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export interface UserState {
export function defaultSetting(): UserState {
return {
userInfo: {
avatar: 'https://chatgptvietnam.org/assets/favicon.png',
name: 'chatgptvietnam.org',
description: 'Trải nghiệm ngay <a href="https://chatgptvietnam.org" class="text-blue-500" target="_blank" >ChatGPT Vietnamese không cần tài khoản</a>',
avatar: 'https://chatvn.org/assets/favicon.png',
name: 'chatvn.org',
description: 'Trải nghiệm ngay <a href="https://chatvn.org" class="text-blue-500" target="_blank" >Chat GPT không cần tài khoản</a>',
},
}
}
Expand Down

0 comments on commit ce20481

Please sign in to comment.