mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-18 16:03:43 +08:00
Compare commits
9 Commits
Leizhenpen
...
2bf5ff4c1e
Author | SHA1 | Date | |
---|---|---|---|
|
2bf5ff4c1e | ||
|
3809375694 | ||
|
1b0de25986 | ||
|
865c45dd29 | ||
|
1f5d8e6d9c | ||
|
2d7229d2b8 | ||
|
138548ad45 | ||
|
e05af75891 | ||
|
67ce78cac2 |
@@ -22,7 +22,7 @@ English / [简体中文](./README_CN.md)
|
|||||||
[![MacOS][MacOS-image]][download-url]
|
[![MacOS][MacOS-image]][download-url]
|
||||||
[![Linux][Linux-image]][download-url]
|
[![Linux][Linux-image]][download-url]
|
||||||
|
|
||||||
[NextChatAI](https://nextchat.club?utm_source=readme) / [Web App Demo](https://app.nextchat.dev) / [Desktop App](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [Discord](https://discord.gg/YCkeafCafC) / [Enterprise Edition](#enterprise-edition) / [Twitter](https://twitter.com/NextChatDev)
|
[NextChatAI](https://nextchat.club?utm_source=readme) / [iOS APP](https://apps.apple.com/us/app/nextchat-ai/id6743085599) / [Web App Demo](https://app.nextchat.dev) / [Desktop App](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [Enterprise Edition](#enterprise-edition)
|
||||||
|
|
||||||
|
|
||||||
[saas-url]: https://nextchat.club?utm_source=readme
|
[saas-url]: https://nextchat.club?utm_source=readme
|
||||||
@@ -41,7 +41,9 @@ English / [简体中文](./README_CN.md)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
## 🥳 Cheer for NextChat iOS Version Online!
|
## 🥳 Cheer for NextChat iOS Version Online!
|
||||||
> [ 👉 Click Here Install Now](https://apps.apple.com/us/app/nextchat-ai/id6743085599)
|
> [👉 Click Here to Install Now](https://apps.apple.com/us/app/nextchat-ai/id6743085599)
|
||||||
|
|
||||||
|
> [❤️ Source Code Coming Soon](https://github.com/ChatGPTNextWeb/NextChat-iOS)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@@ -198,7 +198,8 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
const isDalle3 = _isDalle3(options.config.model);
|
const isDalle3 = _isDalle3(options.config.model);
|
||||||
const isO1OrO3 =
|
const isO1OrO3 =
|
||||||
options.config.model.startsWith("o1") ||
|
options.config.model.startsWith("o1") ||
|
||||||
options.config.model.startsWith("o3");
|
options.config.model.startsWith("o3") ||
|
||||||
|
options.config.model.startsWith("o4-mini");
|
||||||
if (isDalle3) {
|
if (isDalle3) {
|
||||||
const prompt = getMessageTextContent(
|
const prompt = getMessageTextContent(
|
||||||
options.messages.slice(-1)?.pop() as any,
|
options.messages.slice(-1)?.pop() as any,
|
||||||
@@ -243,7 +244,7 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add max_tokens to vision model
|
// add max_tokens to vision model
|
||||||
if (visionModel) {
|
if (visionModel && !isO1OrO3) {
|
||||||
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
|
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1494,20 +1494,36 @@ function _Chat() {
|
|||||||
|
|
||||||
// remember unfinished input
|
// remember unfinished input
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// try to load from local storage
|
// Define the key for storing unfinished input based on the session ID.
|
||||||
const key = UNFINISHED_INPUT(session.id);
|
const key = UNFINISHED_INPUT(session.id);
|
||||||
|
|
||||||
|
// Attempt to load unfinished input from local storage.
|
||||||
const mayBeUnfinishedInput = localStorage.getItem(key);
|
const mayBeUnfinishedInput = localStorage.getItem(key);
|
||||||
if (mayBeUnfinishedInput && userInput.length === 0) {
|
if (mayBeUnfinishedInput && userInput.length === 0) {
|
||||||
setUserInput(mayBeUnfinishedInput);
|
setUserInput(mayBeUnfinishedInput);
|
||||||
|
// Clear the unfinished input from local storage after loading it.
|
||||||
localStorage.removeItem(key);
|
localStorage.removeItem(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dom = inputRef.current;
|
// Capture the current value of the input reference.
|
||||||
|
const currentInputRef = inputRef.current;
|
||||||
|
|
||||||
|
// This function will be called when the component unmounts or dependencies change.
|
||||||
return () => {
|
return () => {
|
||||||
localStorage.setItem(key, dom?.value ?? "");
|
// Save the current input to local storage only if it is not a command.
|
||||||
|
// Use the captured value from the input reference.
|
||||||
|
const currentInputValue = currentInputRef?.value ?? "";
|
||||||
|
// Save the input to local storage only if it's not empty and not a command.
|
||||||
|
if (currentInputValue && !currentInputValue.startsWith(ChatCommandPrefix)) {
|
||||||
|
localStorage.setItem(key, currentInputValue);
|
||||||
|
} else {
|
||||||
|
// If there's no value, ensure we don't create an empty key in local storage.
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
// The effect should depend on the session ID to ensure it runs when the session changes.
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, [session.id]);
|
||||||
|
|
||||||
const handlePaste = useCallback(
|
const handlePaste = useCallback(
|
||||||
async (event: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
async (event: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
||||||
|
@@ -478,6 +478,8 @@ export const VISION_MODEL_REGEXES = [
|
|||||||
/^dall-e-3$/, // Matches exactly "dall-e-3"
|
/^dall-e-3$/, // Matches exactly "dall-e-3"
|
||||||
/glm-4v/,
|
/glm-4v/,
|
||||||
/vl/i,
|
/vl/i,
|
||||||
|
/o3/,
|
||||||
|
/o4-mini/,
|
||||||
];
|
];
|
||||||
|
|
||||||
export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/];
|
export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/];
|
||||||
@@ -516,6 +518,8 @@ const openaiModels = [
|
|||||||
"o1-mini",
|
"o1-mini",
|
||||||
"o1-preview",
|
"o1-preview",
|
||||||
"o3-mini",
|
"o3-mini",
|
||||||
|
"o3",
|
||||||
|
"o4-mini",
|
||||||
];
|
];
|
||||||
|
|
||||||
const googleModels = [
|
const googleModels = [
|
||||||
|
Reference in New Issue
Block a user