mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-09-01 03:56:55 +08:00
Compare commits
1 Commits
v2.15.5
...
update-max
Author | SHA1 | Date | |
---|---|---|---|
|
ebe617b733 |
4
.github/workflows/deploy_preview.yml
vendored
4
.github/workflows/deploy_preview.yml
vendored
@@ -3,7 +3,9 @@ name: VercelPreviewDeployment
|
|||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types:
|
types:
|
||||||
- review_requested
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
|
||||||
env:
|
env:
|
||||||
VERCEL_TEAM: ${{ secrets.VERCEL_TEAM }}
|
VERCEL_TEAM: ${{ secrets.VERCEL_TEAM }}
|
||||||
|
39
.github/workflows/test.yml
vendored
39
.github/workflows/test.yml
vendored
@@ -1,39 +0,0 @@
|
|||||||
name: Run Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- "!*"
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- review_requested
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
cache: "yarn"
|
|
||||||
|
|
||||||
- name: Cache node_modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node_modules-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: Run Jest tests
|
|
||||||
run: yarn test:ci
|
|
@@ -63,7 +63,7 @@ export interface RequestPayload {
|
|||||||
presence_penalty: number;
|
presence_penalty: number;
|
||||||
frequency_penalty: number;
|
frequency_penalty: number;
|
||||||
top_p: number;
|
top_p: number;
|
||||||
max_tokens?: number;
|
max_completions_tokens?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DalleRequestPayload {
|
export interface DalleRequestPayload {
|
||||||
@@ -228,13 +228,16 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
presence_penalty: !isO1 ? modelConfig.presence_penalty : 0,
|
presence_penalty: !isO1 ? modelConfig.presence_penalty : 0,
|
||||||
frequency_penalty: !isO1 ? modelConfig.frequency_penalty : 0,
|
frequency_penalty: !isO1 ? modelConfig.frequency_penalty : 0,
|
||||||
top_p: !isO1 ? modelConfig.top_p : 1,
|
top_p: !isO1 ? modelConfig.top_p : 1,
|
||||||
// max_tokens: Math.max(modelConfig.max_tokens, 1024),
|
// max_completions_tokens: Math.max(modelConfig.max_completions_tokens, 1024),
|
||||||
// Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
|
// Please do not ask me why not send max_completions_tokens, no reason, this param is just shit, I dont want to explain anymore.
|
||||||
};
|
};
|
||||||
|
|
||||||
// add max_tokens to vision model
|
// add max_completions_tokens to vision model
|
||||||
if (visionModel) {
|
if (visionModel) {
|
||||||
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
|
requestPayload["max_completions_tokens"] = Math.max(
|
||||||
|
modelConfig.max_completions_tokens,
|
||||||
|
4000,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +355,7 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
// make a fetch request
|
// make a fetch request
|
||||||
const requestTimeoutId = setTimeout(
|
const requestTimeoutId = setTimeout(
|
||||||
() => controller.abort(),
|
() => controller.abort(),
|
||||||
isDalle3 || isO1 ? REQUEST_TIMEOUT_MS * 4 : REQUEST_TIMEOUT_MS, // dalle3 using b64_json is slow.
|
isDalle3 || isO1 ? REQUEST_TIMEOUT_MS * 2 : REQUEST_TIMEOUT_MS, // dalle3 using b64_json is slow.
|
||||||
);
|
);
|
||||||
|
|
||||||
const res = await fetch(chatPath, chatPayload);
|
const res = await fetch(chatPath, chatPayload);
|
||||||
|
@@ -115,14 +115,11 @@ import { getClientConfig } from "../config/client";
|
|||||||
import { useAllModels } from "../utils/hooks";
|
import { useAllModels } from "../utils/hooks";
|
||||||
import { MultimodalContent } from "../client/api";
|
import { MultimodalContent } from "../client/api";
|
||||||
|
|
||||||
|
const localStorage = safeLocalStorage();
|
||||||
import { ClientApi } from "../client/api";
|
import { ClientApi } from "../client/api";
|
||||||
import { createTTSPlayer } from "../utils/audio";
|
import { createTTSPlayer } from "../utils/audio";
|
||||||
import { MsEdgeTTS, OUTPUT_FORMAT } from "../utils/ms_edge_tts";
|
import { MsEdgeTTS, OUTPUT_FORMAT } from "../utils/ms_edge_tts";
|
||||||
|
|
||||||
import { isEmpty } from "lodash-es";
|
|
||||||
|
|
||||||
const localStorage = safeLocalStorage();
|
|
||||||
|
|
||||||
const ttsPlayer = createTTSPlayer();
|
const ttsPlayer = createTTSPlayer();
|
||||||
|
|
||||||
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
||||||
@@ -1018,7 +1015,7 @@ function _Chat() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const doSubmit = (userInput: string) => {
|
const doSubmit = (userInput: string) => {
|
||||||
if (userInput.trim() === "" && isEmpty(attachImages)) return;
|
if (userInput.trim() === "") return;
|
||||||
const matchCommand = chatCommands.match(userInput);
|
const matchCommand = chatCommands.match(userInput);
|
||||||
if (matchCommand.matched) {
|
if (matchCommand.matched) {
|
||||||
setUserInput("");
|
setUserInput("");
|
||||||
|
@@ -140,9 +140,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
&-narrow {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-logo {
|
.sidebar-logo {
|
||||||
|
@@ -169,12 +169,6 @@ export function PreCode(props: { children: any }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function CustomCode(props: { children: any; className?: string }) {
|
function CustomCode(props: { children: any; className?: string }) {
|
||||||
const chatStore = useChatStore();
|
|
||||||
const session = chatStore.currentSession();
|
|
||||||
const config = useAppConfig();
|
|
||||||
const enableCodeFold =
|
|
||||||
session.mask?.enableCodeFold !== false && config.enableCodeFold;
|
|
||||||
|
|
||||||
const ref = useRef<HTMLPreElement>(null);
|
const ref = useRef<HTMLPreElement>(null);
|
||||||
const [collapsed, setCollapsed] = useState(true);
|
const [collapsed, setCollapsed] = useState(true);
|
||||||
const [showToggle, setShowToggle] = useState(false);
|
const [showToggle, setShowToggle] = useState(false);
|
||||||
@@ -190,30 +184,25 @@ function CustomCode(props: { children: any; className?: string }) {
|
|||||||
const toggleCollapsed = () => {
|
const toggleCollapsed = () => {
|
||||||
setCollapsed((collapsed) => !collapsed);
|
setCollapsed((collapsed) => !collapsed);
|
||||||
};
|
};
|
||||||
const renderShowMoreButton = () => {
|
|
||||||
if (showToggle && enableCodeFold && collapsed) {
|
|
||||||
return (
|
|
||||||
<div className={`show-hide-button ${collapsed ? "collapsed" : "expanded"}`}>
|
|
||||||
<button onClick={toggleCollapsed}>{Locale.NewChat.More}</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<code
|
<code
|
||||||
className={props?.className}
|
className={props?.className}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
style={{
|
style={{
|
||||||
maxHeight: enableCodeFold && collapsed ? "400px" : "none",
|
maxHeight: collapsed ? "400px" : "none",
|
||||||
overflowY: "hidden",
|
overflowY: "hidden",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</code>
|
</code>
|
||||||
|
{showToggle && collapsed && (
|
||||||
{renderShowMoreButton()}
|
<div
|
||||||
|
className={`show-hide-button ${collapsed ? "collapsed" : "expanded"}`}
|
||||||
|
>
|
||||||
|
<button onClick={toggleCollapsed}>{Locale.NewChat.More}</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -183,23 +183,6 @@ export function MaskConfig(props: {
|
|||||||
></input>
|
></input>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
)}
|
)}
|
||||||
{globalConfig.enableCodeFold && (
|
|
||||||
<ListItem
|
|
||||||
title={Locale.Mask.Config.CodeFold.Title}
|
|
||||||
subTitle={Locale.Mask.Config.CodeFold.SubTitle}
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
aria-label={Locale.Mask.Config.CodeFold.Title}
|
|
||||||
type="checkbox"
|
|
||||||
checked={props.mask.enableCodeFold !== false}
|
|
||||||
onChange={(e) => {
|
|
||||||
props.updateMask((mask) => {
|
|
||||||
mask.enableCodeFold = e.currentTarget.checked;
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
></input>
|
|
||||||
</ListItem>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!props.shouldSyncFromGlobal ? (
|
{!props.shouldSyncFromGlobal ? (
|
||||||
<ListItem
|
<ListItem
|
||||||
|
@@ -49,7 +49,7 @@ import Locale, {
|
|||||||
changeLang,
|
changeLang,
|
||||||
getLang,
|
getLang,
|
||||||
} from "../locales";
|
} from "../locales";
|
||||||
import { copyToClipboard, clientUpdate, semverCompare } from "../utils";
|
import { copyToClipboard } from "../utils";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import {
|
import {
|
||||||
Anthropic,
|
Anthropic,
|
||||||
@@ -585,7 +585,7 @@ export function Settings() {
|
|||||||
const [checkingUpdate, setCheckingUpdate] = useState(false);
|
const [checkingUpdate, setCheckingUpdate] = useState(false);
|
||||||
const currentVersion = updateStore.formatVersion(updateStore.version);
|
const currentVersion = updateStore.formatVersion(updateStore.version);
|
||||||
const remoteId = updateStore.formatVersion(updateStore.remoteVersion);
|
const remoteId = updateStore.formatVersion(updateStore.remoteVersion);
|
||||||
const hasNewVersion = semverCompare(currentVersion, remoteId) === -1;
|
const hasNewVersion = currentVersion !== remoteId;
|
||||||
const updateUrl = getClientConfig()?.isApp ? RELEASE_URL : UPDATE_URL;
|
const updateUrl = getClientConfig()?.isApp ? RELEASE_URL : UPDATE_URL;
|
||||||
|
|
||||||
function checkUpdate(force = false) {
|
function checkUpdate(force = false) {
|
||||||
@@ -1357,17 +1357,9 @@ export function Settings() {
|
|||||||
{checkingUpdate ? (
|
{checkingUpdate ? (
|
||||||
<LoadingIcon />
|
<LoadingIcon />
|
||||||
) : hasNewVersion ? (
|
) : hasNewVersion ? (
|
||||||
clientConfig?.isApp ? (
|
<Link href={updateUrl} target="_blank" className="link">
|
||||||
<IconButton
|
{Locale.Settings.Update.GoToUpdate}
|
||||||
icon={<ResetIcon></ResetIcon>}
|
</Link>
|
||||||
text={Locale.Settings.Update.GoToUpdate}
|
|
||||||
onClick={() => clientUpdate()}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Link href={updateUrl} target="_blank" className="link">
|
|
||||||
{Locale.Settings.Update.GoToUpdate}
|
|
||||||
</Link>
|
|
||||||
)
|
|
||||||
) : (
|
) : (
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={<ResetIcon></ResetIcon>}
|
icon={<ResetIcon></ResetIcon>}
|
||||||
@@ -1517,22 +1509,6 @@ export function Settings() {
|
|||||||
}
|
}
|
||||||
></input>
|
></input>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem
|
|
||||||
title={Locale.Mask.Config.CodeFold.Title}
|
|
||||||
subTitle={Locale.Mask.Config.CodeFold.SubTitle}
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
aria-label={Locale.Mask.Config.CodeFold.Title}
|
|
||||||
type="checkbox"
|
|
||||||
checked={config.enableCodeFold}
|
|
||||||
data-testid="enable-code-fold-checkbox"
|
|
||||||
onChange={(e) =>
|
|
||||||
updateConfig(
|
|
||||||
(config) => (config.enableCodeFold = e.currentTarget.checked),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
></input>
|
|
||||||
</ListItem>
|
|
||||||
</List>
|
</List>
|
||||||
|
|
||||||
<SyncItems />
|
<SyncItems />
|
||||||
|
@@ -165,17 +165,11 @@ export function SideBarHeader(props: {
|
|||||||
subTitle?: string | React.ReactNode;
|
subTitle?: string | React.ReactNode;
|
||||||
logo?: React.ReactNode;
|
logo?: React.ReactNode;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
shouldNarrow?: boolean;
|
|
||||||
}) {
|
}) {
|
||||||
const { title, subTitle, logo, children, shouldNarrow } = props;
|
const { title, subTitle, logo, children } = props;
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div
|
<div className={styles["sidebar-header"]} data-tauri-drag-region>
|
||||||
className={`${styles["sidebar-header"]} ${
|
|
||||||
shouldNarrow ? styles["sidebar-header-narrow"] : ""
|
|
||||||
}`}
|
|
||||||
data-tauri-drag-region
|
|
||||||
>
|
|
||||||
<div className={styles["sidebar-title-container"]}>
|
<div className={styles["sidebar-title-container"]}>
|
||||||
<div className={styles["sidebar-title"]} data-tauri-drag-region>
|
<div className={styles["sidebar-title"]} data-tauri-drag-region>
|
||||||
{title}
|
{title}
|
||||||
@@ -233,7 +227,6 @@ export function SideBar(props: { className?: string }) {
|
|||||||
title="NextChat"
|
title="NextChat"
|
||||||
subTitle="Build your own AI assistant."
|
subTitle="Build your own AI assistant."
|
||||||
logo={<ChatGptIcon />}
|
logo={<ChatGptIcon />}
|
||||||
shouldNarrow={shouldNarrow}
|
|
||||||
>
|
>
|
||||||
<div className={styles["sidebar-header-bar"]}>
|
<div className={styles["sidebar-header-bar"]}>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
7
app/global.d.ts
vendored
7
app/global.d.ts
vendored
@@ -26,13 +26,6 @@ declare interface Window {
|
|||||||
isPermissionGranted(): Promise<boolean>;
|
isPermissionGranted(): Promise<boolean>;
|
||||||
sendNotification(options: string | Options): void;
|
sendNotification(options: string | Options): void;
|
||||||
};
|
};
|
||||||
updater: {
|
|
||||||
checkUpdate(): Promise<UpdateResult>;
|
|
||||||
installUpdate(): Promise<void>;
|
|
||||||
onUpdaterEvent(
|
|
||||||
handler: (status: UpdateStatusResult) => void,
|
|
||||||
): Promise<UnlistenFn>;
|
|
||||||
};
|
|
||||||
http: {
|
http: {
|
||||||
fetch<T>(
|
fetch<T>(
|
||||||
url: string,
|
url: string,
|
||||||
|
@@ -205,8 +205,6 @@ const cn = {
|
|||||||
IsChecking: "正在检查更新...",
|
IsChecking: "正在检查更新...",
|
||||||
FoundUpdate: (x: string) => `发现新版本:${x}`,
|
FoundUpdate: (x: string) => `发现新版本:${x}`,
|
||||||
GoToUpdate: "前往更新",
|
GoToUpdate: "前往更新",
|
||||||
Success: "更新成功!",
|
|
||||||
Failed: "更新失败",
|
|
||||||
},
|
},
|
||||||
SendKey: "发送键",
|
SendKey: "发送键",
|
||||||
Theme: "主题",
|
Theme: "主题",
|
||||||
@@ -497,8 +495,8 @@ const cn = {
|
|||||||
|
|
||||||
Model: "模型 (model)",
|
Model: "模型 (model)",
|
||||||
CompressModel: {
|
CompressModel: {
|
||||||
Title: "对话摘要模型",
|
Title: "压缩模型",
|
||||||
SubTitle: "用于压缩历史记录、生成对话标题的模型",
|
SubTitle: "用于压缩历史记录的模型",
|
||||||
},
|
},
|
||||||
Temperature: {
|
Temperature: {
|
||||||
Title: "随机性 (temperature)",
|
Title: "随机性 (temperature)",
|
||||||
@@ -667,10 +665,6 @@ const cn = {
|
|||||||
Title: "启用Artifacts",
|
Title: "启用Artifacts",
|
||||||
SubTitle: "启用之后可以直接渲染HTML页面",
|
SubTitle: "启用之后可以直接渲染HTML页面",
|
||||||
},
|
},
|
||||||
CodeFold: {
|
|
||||||
Title: "启用代码折叠",
|
|
||||||
SubTitle: "启用之后可以自动折叠/展开过长的代码块",
|
|
||||||
},
|
|
||||||
Share: {
|
Share: {
|
||||||
Title: "分享此面具",
|
Title: "分享此面具",
|
||||||
SubTitle: "生成此面具的直达链接",
|
SubTitle: "生成此面具的直达链接",
|
||||||
|
@@ -207,8 +207,6 @@ const en: LocaleType = {
|
|||||||
IsChecking: "Checking update...",
|
IsChecking: "Checking update...",
|
||||||
FoundUpdate: (x: string) => `Found new version: ${x}`,
|
FoundUpdate: (x: string) => `Found new version: ${x}`,
|
||||||
GoToUpdate: "Update",
|
GoToUpdate: "Update",
|
||||||
Success: "Update Successful.",
|
|
||||||
Failed: "Update Failed.",
|
|
||||||
},
|
},
|
||||||
SendKey: "Send Key",
|
SendKey: "Send Key",
|
||||||
Theme: "Theme",
|
Theme: "Theme",
|
||||||
@@ -502,8 +500,8 @@ const en: LocaleType = {
|
|||||||
|
|
||||||
Model: "Model",
|
Model: "Model",
|
||||||
CompressModel: {
|
CompressModel: {
|
||||||
Title: "Summary Model",
|
Title: "Compression Model",
|
||||||
SubTitle: "Model used to compress history and generate title",
|
SubTitle: "Model used to compress history",
|
||||||
},
|
},
|
||||||
Temperature: {
|
Temperature: {
|
||||||
Title: "Temperature",
|
Title: "Temperature",
|
||||||
@@ -677,11 +675,6 @@ const en: LocaleType = {
|
|||||||
Title: "Enable Artifacts",
|
Title: "Enable Artifacts",
|
||||||
SubTitle: "Can render HTML page when enable artifacts.",
|
SubTitle: "Can render HTML page when enable artifacts.",
|
||||||
},
|
},
|
||||||
CodeFold: {
|
|
||||||
Title: "Enable CodeFold",
|
|
||||||
SubTitle:
|
|
||||||
"Automatically collapse/expand overly long code blocks when CodeFold is enabled",
|
|
||||||
},
|
|
||||||
Share: {
|
Share: {
|
||||||
Title: "Share This Mask",
|
Title: "Share This Mask",
|
||||||
SubTitle: "Generate a link to this mask",
|
SubTitle: "Generate a link to this mask",
|
||||||
|
@@ -372,16 +372,22 @@ export const useChatStore = createPersistStore(
|
|||||||
|
|
||||||
if (attachImages && attachImages.length > 0) {
|
if (attachImages && attachImages.length > 0) {
|
||||||
mContent = [
|
mContent = [
|
||||||
...(userContent
|
{
|
||||||
? [{ type: "text" as const, text: userContent }]
|
type: "text",
|
||||||
: []),
|
text: userContent,
|
||||||
...attachImages.map((url) => ({
|
},
|
||||||
type: "image_url" as const,
|
|
||||||
image_url: { url },
|
|
||||||
})),
|
|
||||||
];
|
];
|
||||||
|
mContent = mContent.concat(
|
||||||
|
attachImages.map((url) => {
|
||||||
|
return {
|
||||||
|
type: "image_url",
|
||||||
|
image_url: {
|
||||||
|
url: url,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let userMessage: ChatMessage = createMessage({
|
let userMessage: ChatMessage = createMessage({
|
||||||
role: "user",
|
role: "user",
|
||||||
content: mContent,
|
content: mContent,
|
||||||
|
@@ -52,8 +52,6 @@ export const DEFAULT_CONFIG = {
|
|||||||
|
|
||||||
enableArtifacts: true, // show artifacts config
|
enableArtifacts: true, // show artifacts config
|
||||||
|
|
||||||
enableCodeFold: true, // code fold config
|
|
||||||
|
|
||||||
disablePromptHint: false,
|
disablePromptHint: false,
|
||||||
|
|
||||||
dontShowMaskSplashScreen: false, // dont show splash screen when create chat
|
dontShowMaskSplashScreen: false, // dont show splash screen when create chat
|
||||||
@@ -67,7 +65,7 @@ export const DEFAULT_CONFIG = {
|
|||||||
providerName: "OpenAI" as ServiceProvider,
|
providerName: "OpenAI" as ServiceProvider,
|
||||||
temperature: 0.5,
|
temperature: 0.5,
|
||||||
top_p: 1,
|
top_p: 1,
|
||||||
max_tokens: 4000,
|
max_completions_tokens: 4000,
|
||||||
presence_penalty: 0,
|
presence_penalty: 0,
|
||||||
frequency_penalty: 0,
|
frequency_penalty: 0,
|
||||||
sendMemory: true,
|
sendMemory: true,
|
||||||
@@ -129,7 +127,7 @@ export const ModalConfigValidator = {
|
|||||||
model(x: string) {
|
model(x: string) {
|
||||||
return x as ModelType;
|
return x as ModelType;
|
||||||
},
|
},
|
||||||
max_tokens(x: number) {
|
max_completions_tokens(x: number) {
|
||||||
return limitNumber(x, 0, 512000, 1024);
|
return limitNumber(x, 0, 512000, 1024);
|
||||||
},
|
},
|
||||||
presence_penalty(x: number) {
|
presence_penalty(x: number) {
|
||||||
|
@@ -19,7 +19,6 @@ export type Mask = {
|
|||||||
builtin: boolean;
|
builtin: boolean;
|
||||||
plugin?: string[];
|
plugin?: string[];
|
||||||
enableArtifacts?: boolean;
|
enableArtifacts?: boolean;
|
||||||
enableCodeFold?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DEFAULT_MASK_STATE = {
|
export const DEFAULT_MASK_STATE = {
|
||||||
|
@@ -6,7 +6,6 @@ import {
|
|||||||
} from "../constant";
|
} from "../constant";
|
||||||
import { getClientConfig } from "../config/client";
|
import { getClientConfig } from "../config/client";
|
||||||
import { createPersistStore } from "../utils/store";
|
import { createPersistStore } from "../utils/store";
|
||||||
import { clientUpdate } from "../utils";
|
|
||||||
import ChatGptIcon from "../icons/chatgpt.png";
|
import ChatGptIcon from "../icons/chatgpt.png";
|
||||||
import Locale from "../locales";
|
import Locale from "../locales";
|
||||||
import { ClientApi } from "../client/api";
|
import { ClientApi } from "../client/api";
|
||||||
@@ -120,7 +119,6 @@ export const useUpdateStore = createPersistStore(
|
|||||||
icon: `${ChatGptIcon.src}`,
|
icon: `${ChatGptIcon.src}`,
|
||||||
sound: "Default",
|
sound: "Default",
|
||||||
});
|
});
|
||||||
clientUpdate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
34
app/utils.ts
34
app/utils.ts
@@ -386,37 +386,3 @@ export function getOperationId(operation: {
|
|||||||
`${operation.method.toUpperCase()}${operation.path.replaceAll("/", "_")}`
|
`${operation.method.toUpperCase()}${operation.path.replaceAll("/", "_")}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function clientUpdate() {
|
|
||||||
// this a wild for updating client app
|
|
||||||
return window.__TAURI__?.updater
|
|
||||||
.checkUpdate()
|
|
||||||
.then((updateResult) => {
|
|
||||||
if (updateResult.shouldUpdate) {
|
|
||||||
window.__TAURI__?.updater
|
|
||||||
.installUpdate()
|
|
||||||
.then((result) => {
|
|
||||||
showToast(Locale.Settings.Update.Success);
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
console.error("[Install Update Error]", e);
|
|
||||||
showToast(Locale.Settings.Update.Failed);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
console.error("[Check Update Error]", e);
|
|
||||||
showToast(Locale.Settings.Update.Failed);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://gist.github.com/iwill/a83038623ba4fef6abb9efca87ae9ccb
|
|
||||||
export function semverCompare(a: string, b: string) {
|
|
||||||
if (a.startsWith(b + "-")) return -1;
|
|
||||||
if (b.startsWith(a + "-")) return 1;
|
|
||||||
return a.localeCompare(b, undefined, {
|
|
||||||
numeric: true,
|
|
||||||
sensitivity: "case",
|
|
||||||
caseFirst: "upper",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
10
package.json
10
package.json
@@ -6,13 +6,13 @@
|
|||||||
"mask": "npx tsx app/masks/build.ts",
|
"mask": "npx tsx app/masks/build.ts",
|
||||||
"mask:watch": "npx watch \"yarn mask\" app/masks",
|
"mask:watch": "npx watch \"yarn mask\" app/masks",
|
||||||
"dev": "concurrently -r \"yarn run mask:watch\" \"next dev\"",
|
"dev": "concurrently -r \"yarn run mask:watch\" \"next dev\"",
|
||||||
"build": "yarn mask && cross-env BUILD_MODE=standalone next build",
|
"build": "yarn test:ci && yarn mask && cross-env BUILD_MODE=standalone next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"export": "yarn mask && cross-env BUILD_MODE=export BUILD_APP=1 next build",
|
"export": "yarn test:ci && yarn mask && cross-env BUILD_MODE=export BUILD_APP=1 next build",
|
||||||
"export:dev": "concurrently -r \"yarn mask:watch\" \"cross-env BUILD_MODE=export BUILD_APP=1 next dev\"",
|
"export:dev": "concurrently -r \"yarn mask:watch\" \"cross-env BUILD_MODE=export BUILD_APP=1 next dev\"",
|
||||||
"app:dev": "concurrently -r \"yarn mask:watch\" \"yarn tauri dev\"",
|
"app:dev": "concurrently -r \"yarn mask:watch\" \"yarn tauri dev\"",
|
||||||
"app:build": "yarn mask && yarn tauri build",
|
"app:build": "yarn test:ci && yarn mask && yarn tauri build",
|
||||||
"prompts": "node ./scripts/fetch-prompts.mjs",
|
"prompts": "node ./scripts/fetch-prompts.mjs",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"proxy-dev": "sh ./scripts/init-proxy.sh && proxychains -f ./scripts/proxychains.conf yarn dev",
|
"proxy-dev": "sh ./scripts/init-proxy.sh && proxychains -f ./scripts/proxychains.conf yarn dev",
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
"@tauri-apps/cli": "1.5.11",
|
"@tauri-apps/cli": "1.5.11",
|
||||||
"@testing-library/jest-dom": "^6.4.8",
|
"@testing-library/jest-dom": "^6.4.8",
|
||||||
"@testing-library/react": "^16.0.0",
|
"@testing-library/react": "^16.0.0",
|
||||||
"@types/jest": "^29.5.13",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/js-yaml": "4.0.9",
|
"@types/js-yaml": "4.0.9",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^20.11.30",
|
"@types/node": "^20.11.30",
|
||||||
@@ -88,4 +88,4 @@
|
|||||||
"lint-staged/yaml": "^2.2.2"
|
"lint-staged/yaml": "^2.2.2"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@1.22.19"
|
"packageManager": "yarn@1.22.19"
|
||||||
}
|
}
|
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "NextChat",
|
"productName": "NextChat",
|
||||||
"version": "2.15.5"
|
"version": "2.15.4"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
"endpoints": [
|
"endpoints": [
|
||||||
"https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/releases/latest/download/latest.json"
|
"https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/releases/latest/download/latest.json"
|
||||||
],
|
],
|
||||||
"dialog": true,
|
"dialog": false,
|
||||||
"windows": {
|
"windows": {
|
||||||
"installMode": "passive"
|
"installMode": "passive"
|
||||||
},
|
},
|
||||||
|
@@ -2263,10 +2263,10 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/istanbul-lib-report" "*"
|
"@types/istanbul-lib-report" "*"
|
||||||
|
|
||||||
"@types/jest@^29.5.13":
|
"@types/jest@^29.5.12":
|
||||||
version "29.5.13"
|
version "29.5.12"
|
||||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.13.tgz#8bc571659f401e6a719a7bf0dbcb8b78c71a8adc"
|
resolved "https://registry.npmmirror.com/@types/jest/-/jest-29.5.12.tgz#7f7dc6eb4cf246d2474ed78744b05d06ce025544"
|
||||||
integrity sha512-wd+MVEZCHt23V0/L642O5APvspWply/rGY5BcW4SUETo2UzPU3Z26qr8jC2qxpimI2jjx9h7+2cj2FwIr01bXg==
|
integrity sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==
|
||||||
dependencies:
|
dependencies:
|
||||||
expect "^29.0.0"
|
expect "^29.0.0"
|
||||||
pretty-format "^29.0.0"
|
pretty-format "^29.0.0"
|
||||||
|
Reference in New Issue
Block a user