mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-19 20:20:16 +09:00
新增 webdav 一键填入
This commit is contained in:
parent
1cccaa2e80
commit
88f8ca822f
@ -107,6 +107,7 @@ import {
|
||||
} from "../constant";
|
||||
import { Avatar } from "./emoji";
|
||||
import { ContextPrompts, MaskAvatar, MaskConfig } from "./mask";
|
||||
import { useSyncStore } from "../store/sync";
|
||||
import { useMaskStore } from "../store/mask";
|
||||
import { ChatCommandPrefix, useChatCommand, useCommand } from "../command";
|
||||
import { prettyObject } from "../utils/format";
|
||||
@ -948,6 +949,8 @@ function _Chat() {
|
||||
const fontSize = config.fontSize;
|
||||
const fontFamily = config.fontFamily;
|
||||
|
||||
const syncStore = useSyncStore();
|
||||
|
||||
const [showExport, setShowExport] = useState(false);
|
||||
|
||||
const inputRef = useRef<HTMLTextAreaElement>(null);
|
||||
@ -1395,45 +1398,27 @@ function _Chat() {
|
||||
submit: (text) => {
|
||||
doSubmit(text);
|
||||
},
|
||||
code: (text) => {
|
||||
if (accessStore.disableFastLink) return;
|
||||
console.log("[Command] got code from url: ", text);
|
||||
showConfirm(Locale.URLCommand.Code + `code = ${text}`).then((res) => {
|
||||
if (res) {
|
||||
accessStore.update((access) => (access.accessCode = text));
|
||||
}
|
||||
});
|
||||
},
|
||||
// code: (text) => {
|
||||
// if (accessStore.disableFastLink) return;
|
||||
// console.log("[Command] got code from url: ", text);
|
||||
// showConfirm(Locale.URLCommand.Code + `code = ${text}`).then((res) => {
|
||||
// if (res) {
|
||||
// accessStore.update((access) => (access.accessCode = text));
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
settings: (text) => {
|
||||
if (accessStore.disableFastLink) return;
|
||||
|
||||
try {
|
||||
const payload = JSON.parse(text) as {
|
||||
key?: string;
|
||||
url?: string;
|
||||
code?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
};
|
||||
|
||||
console.log("[Command] got settings from url: ", payload);
|
||||
|
||||
if (payload.key || payload.url) {
|
||||
showConfirm(
|
||||
Locale.URLCommand.Settings +
|
||||
`\n${JSON.stringify(payload, null, 4)}`,
|
||||
).then((res) => {
|
||||
if (!res) return;
|
||||
if (payload.key) {
|
||||
accessStore.update(
|
||||
(access) => (access.openaiApiKey = payload.key!),
|
||||
);
|
||||
}
|
||||
if (payload.url) {
|
||||
accessStore.update((access) => (access.openaiUrl = payload.url!));
|
||||
}
|
||||
accessStore.update((access) => (access.useCustomConfig = true));
|
||||
});
|
||||
}
|
||||
|
||||
if (payload.code) {
|
||||
accessStore.update((access) => (access.accessCode = payload.code!));
|
||||
if (accessStore.isAuthorized()) {
|
||||
@ -1443,6 +1428,22 @@ function _Chat() {
|
||||
setUserInput(" ");
|
||||
}
|
||||
}
|
||||
|
||||
if (payload.username) {
|
||||
syncStore.update(
|
||||
(config) => (config.webdav.username = payload.username!),
|
||||
);
|
||||
}
|
||||
|
||||
if (payload.password) {
|
||||
syncStore.update(
|
||||
(config) => (config.webdav.password = payload.password!),
|
||||
);
|
||||
}
|
||||
|
||||
if (payload.username && payload.password) {
|
||||
syncStore.sync();
|
||||
}
|
||||
} catch {
|
||||
console.error("[Command] failed to get settings from url: ", text);
|
||||
}
|
||||
|
16
nextchat.json
Normal file
16
nextchat.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "nextchat",
|
||||
"cwd": "/www/nextchat",
|
||||
"script": "server.js",
|
||||
"env": {
|
||||
"PORT": 8032,
|
||||
"CODE": "scut",
|
||||
"BASE_URL": "https://oneapi.jyj.cx",
|
||||
"OPENAI_API_KEY": "sk-jiangyj",
|
||||
"HIDE_USER_API_KEY": true,
|
||||
"CUSTOM_MODELS": "-all,gemini-2.0-pro-exp-02-05@openai,gemini-2.0-flash-thinking-exp-01-21@openai,gemini-2.0-flash-exp@openai,gemini-2.0-flash@openai,gemini-2.0-flash-lite@openai,gpt-4o-2024-11-20@openai,o3-mini@openai,deepseek-ai/deepseek-v3@openai,deepseek-ai/deepseek-r1@openai,deepseek-chat@openai,deepseek-reasoner@openai,ep-20250124104315-zsg4p@openai",
|
||||
"DEFAULT_MODEL": "gemini-2.0-pro-exp-02-05@openai",
|
||||
"WHITE_WEBDAV_ENDPOINTS": "https://dav.jyj.cx",
|
||||
"VISION_MODELS": "gemini-2.0-flash-thinking-exp-01-21@openai,gemini-2.0-pro-exp-02-05@openai,gemini-2.0-flash-exp@openai,gemini-2.0-flash@openai,gemini-2.0-flash-lite@openai,gpt-4o-2024-11-20@openai,o3-mini@openai,deepseek-ai/DeepSeek-V3@openai,deepseek-ai/DeepSeek-R1@openai,deepseek-chat@openai,deepseek-reasoner@openai,ep-20250124104315-zsg4p@openai"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user