Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge upstream/main to main #6

Merged
merged 53 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6a61fe5
Update chat.tsx
Algorithm5838 Sep 26, 2023
398e229
Update chat.tsx
Algorithm5838 Sep 26, 2023
144200e
Merge pull request #2912 from Algorithm5838/Algorithm5838-patch-1
Yidadaa Sep 27, 2023
3bfcdf9
[ADDED] MacOS detect
lifeeric Sep 28, 2023
f3d5fc7
[FIXED] now the default key should be CMD on MacOS
lifeeric Sep 28, 2023
f1ca03e
[FIXED] now it should detects all macintosh
lifeeric Sep 28, 2023
4a599e9
UI Page [Auth Page]
H0llyW00dzZ Sep 30, 2023
bc00be9
Feat & Fix UI Page [Auth Page]
H0llyW00dzZ Sep 30, 2023
31e3090
Refactor Locale Indonesia
H0llyW00dzZ Sep 30, 2023
04b638a
Fix & Refactor UI Page [Auth Page]
H0llyW00dzZ Sep 30, 2023
64a17ab
Client App [Notification]
H0llyW00dzZ Oct 3, 2023
d2ad01a
Client App Fix Issue [Bug] 'export' button does not work #2884
H0llyW00dzZ Oct 3, 2023
ddfd05b
Fix & Feat Client App [Notification]
H0llyW00dzZ Oct 3, 2023
b558d1a
Feat & Fix "Client App [Notification]"
H0llyW00dzZ Oct 3, 2023
ad5093c
Change log
hongji7 Oct 4, 2023
1505372
Change log
hongji7 Oct 4, 2023
ef3e8e6
Merge pull request #2933 from H0llyW00dzZ/authpage
Yidadaa Oct 7, 2023
88f8c43
Improve tw locale
PeterDaveHello Oct 3, 2023
5a2cc6f
Merge pull request #2927 from lifeeric/MACOS
Yidadaa Oct 7, 2023
e35c807
Update tauri.conf.json
Yidadaa Oct 7, 2023
13c1d2f
Merge pull request #2946 from H0llyW00dzZ/ClientApp
Yidadaa Oct 7, 2023
4c8d606
Merge pull request #2950 from PeterDaveHello/locale-tw
Yidadaa Oct 7, 2023
5933b3d
Merge branch 'main' of https://github.com/Yidadaa/ChatGPT-Next-Web
actions-user Oct 8, 2023
bdb49b1
修改界面
luckykong Oct 9, 2023
3e2c5af
Merge pull request #2975 from luckykong/patch-1
Yidadaa Oct 9, 2023
fd413c7
Merge pull request #2947 from KeithHello/main
Yidadaa Oct 9, 2023
f21f922
Update tauri.conf.json
Yidadaa Oct 9, 2023
f54db69
fix: #2981 full screen button not works
Yidadaa Oct 10, 2023
f78008c
Merge pull request #2983 from Yidadaa/Yidadaa-patch-1
Yidadaa Oct 10, 2023
ea59ab5
Fix type in sync.ts
ograycode Oct 10, 2023
adee435
Merge pull request #2992 from ograycode/patch-1
Yidadaa Oct 10, 2023
74fcaab
Refactor Mask UI Page [Masks]
H0llyW00dzZ Oct 10, 2023
1604ed9
Merge branch 'Yidadaa:main' into masks
Oct 11, 2023
ba67f13
Merge pull request #2993 from H0llyW00dzZ/masks
Yidadaa Oct 11, 2023
ec33281
提供同步聊天记录教程,同时翻译多国语言
MCheping8108 Oct 11, 2023
1e77df3
Update constant.ts
Yidadaa Oct 12, 2023
b5d3348
已拆分单个文件、翻译多国语言版本
MCheping8108 Oct 12, 2023
5296ab1
Merge pull request #2996 from MCheping8108/main
Yidadaa Oct 12, 2023
986d34f
docs: fix typo in app/masks/en.ts
suravshrestha Oct 12, 2023
06e043d
Merge pull request #3003 from suravshrestha/patch1
Yidadaa Oct 12, 2023
0dcbfd7
fix serviceWorker cache
jessemoe Oct 13, 2023
f5a2ce5
Fix typo in README.md
eltociear Oct 14, 2023
55bcf78
Update README.md
Yidadaa Oct 15, 2023
65c4a0c
feat: close #3031 user can set larger font size
Yidadaa Oct 16, 2023
d11d906
Merge pull request #3033 from Yidadaa/Yidadaa-patch-1
Yidadaa Oct 16, 2023
4a56e9c
Merge pull request #3019 from eltociear/patch-2
Yidadaa Oct 16, 2023
cc565cf
Merge pull request #3013 from jessegpt/main
Yidadaa Oct 16, 2023
f92fefb
Update synchronise-chat-logs-cn.md
Yidadaa Oct 23, 2023
ccac85b
Update README_CN.md
Yidadaa Oct 23, 2023
e8a4ad1
Update README_KO.md
Yidadaa Oct 23, 2023
d1c3d90
Update README_KO.md
Yidadaa Oct 23, 2023
70e67a6
Revert "fix serviceWorker cache: auto caching files by workbox"
Yidadaa Oct 25, 2023
b90dfb4
Merge pull request #3095 from Yidadaa/revert-3013-main
Yidadaa Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Your openai api key.

### `CODE` (optional)

Access passsword, separated by comma.
Access password, separated by comma.

### `BASE_URL` (optional)

Expand Down Expand Up @@ -257,6 +257,10 @@ If your proxy needs password, use:
bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/scripts/setup.sh)
```

## Synchronizing Chat Records (UpStash)

| [简体中文](./docs/synchronise-chat-logs-cn.md) | [English](./docs/synchronise-chat-logs-en.md) | [Italiano](./docs/synchronise-chat-logs-es.md) | [日本語](./docs/synchronise-chat-logs-ja.md) | [한국어](./docs/synchronise-chat-logs-ko.md)

## Documentation

> Please go to the [docs][./docs] directory for more documentation instructions.
Expand Down Expand Up @@ -309,6 +313,7 @@ If you want to add a new translation, read this [document](./docs/translation.md
[@AnsonHyq](https://github.com/AnsonHyq)
[@synwith](https://github.com/synwith)
[@piksonGit](https://github.com/piksonGit)
[@ouyangzhiping](https://github.com/ouyangzhiping)

### Contributor

Expand Down
2 changes: 2 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s

⚠️ 注意:如果你安装过程中遇到了问题,请使用 docker 部署。


## 鸣谢

### 捐赠者
Expand All @@ -185,3 +186,4 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s
## 开源协议

[MIT](https://opensource.org/license/mit/)

2 changes: 2 additions & 0 deletions README_KO.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s

⚠️ 주의: 설치 중 문제가 발생한 경우, docker로 배포하세요.


## 감사의 말

### 기부자
Expand All @@ -185,3 +186,4 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s
## 오픈소스 라이센스

[MIT](https://opensource.org/license/mit/)

30 changes: 24 additions & 6 deletions app/components/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export function AuthPage() {
const access = useAccessStore();

const goHome = () => navigate(Path.Home);
const resetAccessCode = () => access.updateCode(""); // Reset access code to empty string
const goChat = () => navigate(Path.Chat);
const resetAccessCode = () => { access.updateCode(""); access.updateToken(""); }; // Reset access code to empty string

useEffect(() => {
if (getClientConfig()?.isApp) {
Expand All @@ -42,17 +43,34 @@ export function AuthPage() {
access.updateCode(e.currentTarget.value);
}}
/>
{!access.hideUserApiKey ? (
<>
<div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div>
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Settings.Token.Placeholder}
value={access.token}
onChange={(e) => {
access.updateToken(e.currentTarget.value);
}}
/>
</>
) : null}

<div className={styles["auth-actions"]}>
<IconButton
text={Locale.Auth.Confirm}
type="primary"
onClick={goHome}
onClick={goChat}
/>
<IconButton
text={Locale.Auth.Later}
onClick={() => {
resetAccessCode();
goHome();
}}
/>
<IconButton text={Locale.Auth.Later} onClick={() => {
resetAccessCode();
goHome();
}} />
</div>
</div>
);
Expand Down
8 changes: 7 additions & 1 deletion app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,13 @@ function _Chat() {
{isUser ? (
<Avatar avatar={config.avatar} />
) : (
<MaskAvatar mask={session.mask} />
<>
{["system"].includes(message.role) ? (
<Avatar avatar="2699-fe0f" />
) : (
<MaskAvatar mask={session.mask} />
)}
</>
)}
</div>

Expand Down
58 changes: 44 additions & 14 deletions app/components/exporter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -433,25 +433,55 @@ export function ImagePreviewer(props: {

const isMobile = useMobileScreen();

const download = () => {
const download = async () => {
showToast(Locale.Export.Image.Toast);
const dom = previewRef.current;
if (!dom) return;
toPng(dom)
.then((blob) => {
if (!blob) return;

if (isMobile || getClientConfig()?.isApp) {
showImageModal(blob);

const isApp = getClientConfig()?.isApp;

try {
const blob = await toPng(dom);
if (!blob) return;

if (isMobile || (isApp && window.__TAURI__)) {
if (isApp && window.__TAURI__) {
const result = await window.__TAURI__.dialog.save({
defaultPath: `${props.topic}.png`,
filters: [
{
name: "PNG Files",
extensions: ["png"],
},
{
name: "All Files",
extensions: ["*"],
},
],
});

if (result !== null) {
const response = await fetch(blob);
const buffer = await response.arrayBuffer();
const uint8Array = new Uint8Array(buffer);
await window.__TAURI__.fs.writeBinaryFile(result, uint8Array);
showToast(Locale.Download.Success);
} else {
showToast(Locale.Download.Failed);
}
} else {
const link = document.createElement("a");
link.download = `${props.topic}.png`;
link.href = blob;
link.click();
refreshPreview();
showImageModal(blob);
}
})
.catch((e) => console.log("[Export Image] ", e));
} else {
const link = document.createElement("a");
link.download = `${props.topic}.png`;
link.href = blob;
link.click();
refreshPreview();
}
} catch (error) {
showToast(Locale.Download.Failed);
}
};

const refreshPreview = () => {
Expand Down
3 changes: 1 addition & 2 deletions app/components/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ function Screen() {
const isHome = location.pathname === Path.Home;
const isAuth = location.pathname === Path.Auth;
const isMobileScreen = useMobileScreen();
const shouldTightBorder =
config.tightBorder && !isMobileScreen && !getClientConfig()?.isApp;
const shouldTightBorder = getClientConfig()?.isApp || (config.tightBorder && !isMobileScreen);

useEffect(() => {
loadAsyncGoogleFont();
Expand Down
6 changes: 4 additions & 2 deletions app/components/mask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,13 @@ export function MaskPage() {
const [searchText, setSearchText] = useState("");
const masks = searchText.length > 0 ? searchMasks : allMasks;

// simple search, will refactor later
// refactored already, now it accurate
const onSearch = (text: string) => {
setSearchText(text);
if (text.length > 0) {
const result = allMasks.filter((m) => m.name.includes(text));
const result = allMasks.filter((m) =>
m.name.toLowerCase().includes(text.toLowerCase())
);
setSearchMasks(result);
} else {
setSearchMasks(allMasks);
Expand Down
2 changes: 1 addition & 1 deletion app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ export function Settings() {
title={`${config.fontSize ?? 14}px`}
value={config.fontSize}
min="12"
max="18"
max="40"
step="1"
onChange={(e) =>
updateConfig(
Expand Down
2 changes: 1 addition & 1 deletion app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const FETCH_COMMIT_URL = `https://api.github.com/repos/${OWNER}/${REPO}/c
export const FETCH_TAG_URL = `https://api.github.com/repos/${OWNER}/${REPO}/tags?per_page=1`;
export const RUNTIME_CONFIG_DOM = "danger-runtime-config";

export const DEFAULT_CORS_HOST = "https://nb.nextweb.fun";
export const DEFAULT_CORS_HOST = "https://ab.nextweb.fun";
export const DEFAULT_API_HOST = `${DEFAULT_CORS_HOST}/api/proxy`;

export enum Path {
Expand Down
12 changes: 12 additions & 0 deletions app/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,17 @@ declare module "*.svg";
declare interface Window {
__TAURI__?: {
writeText(text: string): Promise<void>;
invoke(command: string, payload?: Record<string, unknown>): Promise<any>;
dialog: {
save(options?: Record<string, unknown>): Promise<string | null>;
};
fs: {
writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
};
notification:{
requestPermission(): Promise<Permission>;
isPermissionGranted(): Promise<boolean>;
sendNotification(options: string | Options): void;
};
};
}
1 change: 1 addition & 0 deletions app/locales/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ar: PartialLocaleType = {
Auth: {
Title: "تحتاج إلى رمز الوصول",
Tips: "يرجى إدخال رمز الوصول أدناه",
SubTips: "أو أدخل مفتاح واجهة برمجة تطبيقات OpenAI الخاص بك",
Input: "رمز الوصول",
Confirm: "تأكيد",
Later: "لاحقًا",
Expand Down
1 change: 1 addition & 0 deletions app/locales/bn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const bn: PartialLocaleType = {
Auth: {
Title: "একটি অ্যাক্সেস কোড প্রয়োজন",
Tips: "নীচে অ্যাক্সেস কোড ইনপুট করুন",
SubTips: "অথবা আপনার OpenAI API কী প্রবেশ করুন",
Input: "অ্যাক্সেস কোড",
Confirm: "নিশ্চিত করুন",
Later: "পরে",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const cn = {
Auth: {
Title: "需要密码",
Tips: "管理员开启了密码验证,请在下方填入访问码",
SubTips: "或者输入你的 OpenAI API 密钥",
Input: "在此处填写访问码",
Confirm: "确认",
Later: "稍后再说",
Expand Down Expand Up @@ -323,6 +324,10 @@ const cn = {
Success: "已写入剪切板",
Failed: "复制失败,请赋予剪切板权限",
},
Download: {
Success: "内容已下载到您的目录。",
Failed: "下载失败。",
},
Context: {
Toast: (x: any) => `包含 ${x} 条预设提示词`,
Edit: "当前对话设置",
Expand Down
5 changes: 5 additions & 0 deletions app/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const en: LocaleType = {
Auth: {
Title: "Need Access Code",
Tips: "Please enter access code below",
SubTips: "Or enter your OpenAI API Key",
Input: "access code",
Confirm: "Confirm",
Later: "Later",
Expand Down Expand Up @@ -329,6 +330,10 @@ const en: LocaleType = {
Success: "Copied to clipboard",
Failed: "Copy failed, please grant permission to access clipboard",
},
Download: {
Success: "Content downloaded to your directory.",
Failed: "Download failed.",
},
Context: {
Toast: (x: any) => `With ${x} contextual prompts`,
Edit: "Current Chat Settings",
Expand Down
10 changes: 7 additions & 3 deletions app/locales/id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { PartialLocaleType } from "./index";
const id: PartialLocaleType = {
WIP: "Coming Soon...",
Error: {
Unauthorized:
"Akses tidak diizinkan. Silakan [otorisasi](/#/auth) dengan memasukkan kode akses.",
},
Unauthorized: "Akses tidak diizinkan, silakan masukkan kode akses atau masukkan kunci API OpenAI Anda. di halaman [autentikasi](/#/auth) atau di halaman [Pengaturan](/#/settings).",
},
Auth: {
Title: "Diperlukan Kode Akses",
Tips: "Masukkan kode akses di bawah",
SubTips: "Atau masukkan kunci API OpenAI Anda",
Input: "Kode Akses",
Confirm: "Konfirmasi",
Later: "Nanti",
Expand Down Expand Up @@ -301,6 +301,10 @@ const id: PartialLocaleType = {
Failed:
"Gagal menyalin, mohon berikan izin untuk mengakses clipboard atau Clipboard API tidak didukung (Tauri)",
},
Download: {
Success: "Konten berhasil diunduh ke direktori Anda.",
Failed: "Unduhan gagal.",
},
Context: {
Toast: (x: any) => `Dengan ${x} promp kontekstual`,
Edit: "Pengaturan Obrolan Saat Ini",
Expand Down
Loading