Skip to content

Commit

Permalink
Merge branch 'ztjhz:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Limour-dev authored Apr 10, 2023
2 parents 39d4f91 + c8f77bd commit 8c85781
Show file tree
Hide file tree
Showing 23 changed files with 89 additions and 39 deletions.
12 changes: 7 additions & 5 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Better ChatGPT 已经包含了大量的功能。您可以使用以下功能:
- 支持使用内置代理解決 ChatGPT 地区限制
- 支持自定义提示词资料库
- 支持使用文件夹整理聊天
- 支持筛选聊天和文件夹
- 支持实时计算 token 数量和价格
- 支持使用 ShareGPT 分享聊天
- 支持自定义 API 参数(例如存在惩罚)
Expand Down Expand Up @@ -157,10 +158,11 @@ Better ChatGPT 已经包含了大量的功能。您可以使用以下功能:

如果您想支持我们的团队,请考虑通过以下方法之一赞助我们。每一份贡献,无论多小,都有助于我们维护和改善我们的服务。

| 付款方式 | 链接 |
| -------------- | ---------------------------------------------------------------------------------------- |
| 支付宝 (Ayaka) | <img src="https://ayaka14732.github.io/sponsor/alipay.jpg" width=150 /> |
| 微信 (Ayaka) | <img src="https://ayaka14732.github.io/sponsor/wechat.png" width=150 /> |
| KoFi | [![support](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/betterchatgpt) |
| 付款方式 | 链接 |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| 支付宝 (Ayaka) | <img src="https://ayaka14732.github.io/sponsor/alipay.jpg" width=150 /> |
| 微信 (Ayaka) | <img src="https://ayaka14732.github.io/sponsor/wechat.png" width=150 /> |
| GitHub | [![GitHub Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/ztjhz) |
| KoFi | [![support](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/betterchatgpt) |

感谢您成为我们社区的一员,我们期待着在未来为您提供更好的服务。
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Better ChatGPT comes with a bundle of amazing features! Here are some of them:
- Proxy to bypass ChatGPT regional restrictions
- Prompt library
- Organize chats into folders
- Filter chats and folders
- Token count and pricing
- ShareGPT integration
- Custom model parameters (e.g. presence_penalty)
Expand Down Expand Up @@ -164,10 +165,11 @@ If you have enjoyed using our app, we kindly ask you to give this project a ⭐

If you would like to support the team, consider sponsoring us through one of the methods below. Every contribution, no matter how small, helps us to maintain and improve our service.

| Payment Method | Link |
| -------------- | ---------------------------------------------------------------------------------------- |
| KoFi | [![support](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/betterchatgpt) |
| Alipay (Ayaka) | <img src="https://ayaka14732.github.io/sponsor/alipay.jpg" width=150 /> |
| Wechat (Ayaka) | <img src="https://ayaka14732.github.io/sponsor/wechat.png" width=150 /> |
| Payment Method | Link |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| GitHub | [![GitHub Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/ztjhz) |
| KoFi | [![support](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/betterchatgpt) |
| Alipay (Ayaka) | <img src="https://ayaka14732.github.io/sponsor/alipay.jpg" width=150 /> |
| Wechat (Ayaka) | <img src="https://ayaka14732.github.io/sponsor/wechat.png" width=150 /> |

Thank you for being a part of our community, and we look forward to serving you better in the future.
41 changes: 38 additions & 3 deletions electron/index.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');

const { app, BrowserWindow } = require('electron');
const { app, BrowserWindow, Tray, Menu } = require('electron');
const isDev = require('electron-is-dev');
const { autoUpdater } = require('electron-updater');

Expand All @@ -9,16 +9,24 @@ if (require('electron-squirrel-startup')) app.quit();
function createWindow() {
let iconPath = '';
if (isDev) {
iconPath = path.join(__dirname, '../public/favicon-516x516.png');
iconPath = path.join(__dirname, '../public/icon-rounded.png');
} else {
iconPath = path.join(__dirname, '../dist/favicon-516x516.png');
iconPath = path.join(__dirname, '../dist/icon-rounded.png');
}
autoUpdater.checkForUpdatesAndNotify();

const win = new BrowserWindow({
show: false,
icon: iconPath,
});

createTray(win);

win.on('minimize', (event) => {
event.preventDefault();
win.hide();
});

win.maximize();
win.show();

Expand All @@ -31,8 +39,35 @@ function createWindow() {
if (isDev) {
win.webContents.openDevTools({ mode: 'detach' });
}

return win;
}

const createTray = (window) => {
const tray = new Tray(
path.join(
__dirname,
isDev ? '../public/icon-rounded.png' : '../dist/icon-rounded.png'
)
);
const contextMenu = Menu.buildFromTemplate([
{ label: 'Show', click: () => window.show() },
{
label: 'Exit',
click: () => {
app.isQuiting = true;
app.quit();
},
},
]);

tray.on('click', () => window.show());
tray.setToolTip('Better ChatGPT');
tray.setContextMenu(contextMenu);

return tray;
};

app.whenReady().then(createWindow);

app.on('window-all-closed', () => {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
},
"dmg": {
"title": "${productName} ${version}",
"icon": "dist/favicon-516x516.png"
"icon": "dist/icon-rounded.png"
},
"linux": {
"target": [
"tar.gz",
"AppImage"
],
"category": "Chat",
"icon": "dist/favicon-516x516.png"
"icon": "dist/icon-rounded.png"
},
"win": {
"target": "NSIS",
"icon": "dist/favicon-516x516.png"
"icon": "dist/icon-rounded.png"
}
},
"dependencies": {
Expand Down
Binary file added public/icon-rounded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/locales/da/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "Klon Chat",
"cloned": "Klonet",
"enterToSubmit": "Tryk Enter for at sende",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/en-US/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "Clone Chat",
"cloned": "Cloned",
"enterToSubmit": "Enter to submit",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "Clone Chat",
"cloned": "Cloned",
"enterToSubmit": "Enter to submit",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/es/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "Clone Chat",
"cloned": "Cloned",
"enterToSubmit": "Enter to submit",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/fr/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "Cloner la Conversation",
"cloned": "Clonée",
"enterToSubmit": "Entrée pour soumettre",
"submitPlaceholder": "Saisissez un message ou sélectionnez [/] pour un prompt prédéfini..."
"submitPlaceholder": "Saisissez un message ou cliquez sur [/] pour des prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/it/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "Duplica Conversazione",
"cloned": "Duplicata",
"enterToSubmit": "Invio per inviare",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/ja/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "チャットのコピーを作成",
"cloned": "完了しました",
"enterToSubmit": "Enterキーを押して送信",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/ms/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "Buat salinan perbualan ini",
"cloned": "Dicipta",
"enterToSubmit": "Tekan Enter untuk hantar",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/nb/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "Klone chat",
"cloned": "Klonet",
"enterToSubmit": "Trykk enter for å sende",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/sv/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "Klona chatt",
"cloned": "Klonad",
"enterToSubmit": "Tryck på Enter för att skicka",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/zh-CN/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "创建聊天副本",
"cloned": "已创建副本",
"enterToSubmit": "按回车键提交",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "输入消息或点击 [/] 以使用提示词…"
}
2 changes: 1 addition & 1 deletion public/locales/zh-HK/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "建立傾偈副本",
"cloned": "建立成功",
"enterToSubmit": "撳 Enter 鍵提交",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
2 changes: 1 addition & 1 deletion public/locales/zh-TW/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"cloneChat": "創建聊天副本",
"cloned": "已創建副本",
"enterToSubmit": "按回車鍵提交",
"submitPlaceholder": "Type a message or select [/] for a predefined prompt..."
"submitPlaceholder": "Type a message or click [/] for prompts..."
}
4 changes: 2 additions & 2 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export const getChatCompletionStream = async (
if (text.includes('insufficient_quota')) {
error +=
'\nMessage from Better ChatGPT:\nWe recommend changing your API endpoint or API key';
} else {
error += '\nRate limited! Please try again later.';
} else if (response.status === 429) {
error += '\nRate limited!';
}
throw new Error(error);
}
Expand Down
7 changes: 7 additions & 0 deletions src/components/AboutMenu/AboutMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ const AboutMenu = () => {
<p>{t('support.paragraph3', { ns: 'about' })}</p>

<div className='flex flex-col items-center gap-4 my-4'>
<a href='https://github.com/sponsors/ztjhz' target='_blank'>
<img
src='https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86'
width='120px'
alt='Support us through GitHub Sponsors'
/>
</a>
<a href='https://ko-fi.com/betterchatgpt' target='_blank'>
<img
src='./kofi.svg'
Expand Down
1 change: 1 addition & 0 deletions src/components/ConfigMenu/ConfigMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const ConfigMenu = ({
title={t('configuration') as string}
setIsModalOpen={setIsModalOpen}
handleConfirm={handleConfirm}
handleClickBackdrop={handleConfirm}
>
<div className='p-6 border-b border-gray-200 dark:border-gray-600'>
<ModelSelector _model={_model} _setModel={_setModel} />
Expand Down
10 changes: 3 additions & 7 deletions src/components/Menu/NewChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ const NewChat = ({ folder }: { folder?: string }) => {

return (
<a
className={`flex flex-1 items-center max-md:hidden rounded-md hover:bg-gray-500/10 transition-all duration-200 text-white text-sm flex-shrink-0 ${
className={`flex flex-1 items-center rounded-md hover:bg-gray-500/10 transition-all duration-200 text-white text-sm flex-shrink-0 ${
generating
? 'cursor-not-allowed opacity-40'
: 'cursor-pointer opacity-100'
} ${
folder
? 'justify-start'
: 'py-2 px-2 gap-3 md:mb-2 md:border md:border-white/20'
folder ? 'justify-start' : 'py-2 px-2 gap-3 mb-2 border border-white/20'
}`}
onClick={() => {
if (!generating) addChat(folder);
Expand All @@ -34,9 +32,7 @@ const NewChat = ({ folder }: { folder?: string }) => {
) : (
<>
<PlusIcon />
<span className='hidden md:inline-flex text-white text-sm'>
{t('newChat')}
</span>
<span className='inline-flex text-white text-sm'>{t('newChat')}</span>
</>
)}
</a>
Expand Down
9 changes: 8 additions & 1 deletion src/components/PopupModal/PopupModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const PopupModal = ({
setIsModalOpen,
handleConfirm,
handleClose,
handleClickBackdrop,
cancelButton = true,
children,
}: {
Expand All @@ -18,6 +19,7 @@ const PopupModal = ({
setIsModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
handleConfirm?: () => void;
handleClose?: () => void;
handleClickBackdrop?: () => void;
cancelButton?: boolean;
children?: React.ReactElement;
}) => {
Expand All @@ -29,6 +31,11 @@ const PopupModal = ({
setIsModalOpen(false);
};

const _handleBackdropClose = () => {
if (handleClickBackdrop) handleClickBackdrop();
else _handleClose();
};

if (modalRoot) {
return ReactDOM.createPortal(
<div className='fixed top-0 left-0 z-[999] w-full p-4 overflow-x-hidden overflow-y-auto h-full flex justify-center items-center'>
Expand Down Expand Up @@ -81,7 +88,7 @@ const PopupModal = ({
</div>
<div
className='bg-gray-800/90 absolute top-0 left-0 h-full w-full z-[-1]'
onClick={_handleClose}
onClick={_handleBackdropClose}
/>
</div>,
modalRoot
Expand Down

0 comments on commit 8c85781

Please sign in to comment.