Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 28, 2023
2 parents 0480c0e + 2c12be6 commit 55d9e40
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 22 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ One-Click to get well-designed cross-platform ChatGPT web UI.
- 预制角色功能(面具),方便地创建、分享和调试你的个性化对话
- 海量的内置 prompt 列表,来自[中文](https://github.com/PlexPt/awesome-chatgpt-prompts-zh)[英文](https://github.com/f/awesome-chatgpt-prompts)
- 自动压缩上下文聊天记录,在节省 Token 的同时支持超长对话
- 多国语言支持:English, 简体中文, 繁体中文, 日本語, Español, Italiano, Türkçe, Deutsch, Tiếng Việt, Русский, Čeština
- 多国语言支持:English, 简体中文, 繁体中文, 日本語, Español, Italiano, Türkçe, Deutsch, Tiếng Việt, Русский, Čeština, 한국어, Indonesia
- 拥有自己的域名?好上加好,绑定后即可在任何地方**无障碍**快速访问

## 开发计划
Expand Down Expand Up @@ -348,6 +348,7 @@ If you want to add a new translation, read this [document](./docs/translation.md
[@wenjiavv](https://github.com/wenjiavv)
[@LeXwDeX](https://github.com/LeXwDeX)
[@Licoy](https://github.com/Licoy)
[@shangmin2009](https://github.com/shangmin2009)

### Contributor

Expand Down
5 changes: 4 additions & 1 deletion app/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export async function requestOpenai(req: NextRequest) {

console.log("[Proxy] ", path);
console.log("[Base Url]", baseUrl);
console.log("[Org ID]", serverConfig.openaiOrgId);
// this fix [Org ID] undefined in server side if not using custom point
if (serverConfig.openaiOrgId !== undefined) {
console.log("[Org ID]", serverConfig.openaiOrgId);
}

const timeoutId = setTimeout(
() => {
Expand Down
3 changes: 1 addition & 2 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,7 @@ export function ChatActions(props: {
);
showToast(nextModel);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentModel, models]);
}, [chatStore, currentModel, models]);

return (
<div className={styles["chat-input-actions"]}>
Expand Down
40 changes: 25 additions & 15 deletions app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,11 @@ export function Settings() {
navigate(Path.Home);
}
};
if (clientConfig?.isApp) { // Force to set custom endpoint to true if it's app
accessStore.update((state) => {
state.useCustomConfig = true;
});
}
document.addEventListener("keydown", keydownEvent);
return () => {
document.removeEventListener("keydown", keydownEvent);
Expand Down Expand Up @@ -909,21 +914,26 @@ export function Settings() {

{!accessStore.hideUserApiKey && (
<>
<ListItem
title={Locale.Settings.Access.CustomEndpoint.Title}
subTitle={Locale.Settings.Access.CustomEndpoint.SubTitle}
>
<input
type="checkbox"
checked={accessStore.useCustomConfig}
onChange={(e) =>
accessStore.update(
(access) =>
(access.useCustomConfig = e.currentTarget.checked),
)
}
></input>
</ListItem>
{
// Conditionally render the following ListItem based on clientConfig.isApp
!clientConfig?.isApp && ( // only show if isApp is false
<ListItem
title={Locale.Settings.Access.CustomEndpoint.Title}
subTitle={Locale.Settings.Access.CustomEndpoint.SubTitle}
>
<input
type="checkbox"
checked={accessStore.useCustomConfig}
onChange={(e) =>
accessStore.update(
(access) =>
(access.useCustomConfig = e.currentTarget.checked),
)
}
></input>
</ListItem>
)
}
{accessStore.useCustomConfig && (
<>
<ListItem
Expand Down
4 changes: 2 additions & 2 deletions app/locales/pt.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { SubmitKey } from "../store/config";
import { LocaleType } from "../locales/index";
import { PartialLocaleType } from "../locales/index";
import { getClientConfig } from "../config/client";

const isApp = !!getClientConfig()?.isApp;

const pt: LocaleType = {
const pt: PartialLocaleType = {
WIP: "Em breve...",
Error: {
Unauthorized: isApp
Expand Down
5 changes: 4 additions & 1 deletion app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,10 @@ export const useChatStore = createPersistStore(
},
onFinish(message) {
console.log("[Memory] ", message);
session.lastSummarizeIndex = lastSummarizeIndex;
get().updateCurrentSession((session) => {
session.lastSummarizeIndex = lastSummarizeIndex;
session.memoryPrompt = message; // Update the memory prompt for stored it in local storage
});
},
onError(err) {
console.error("[Summarize] ", err);
Expand Down

0 comments on commit 55d9e40

Please sign in to comment.