mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-16 22:13:47 +08:00
init
This commit is contained in:
16
app/utils/custom.ts
Normal file
16
app/utils/custom.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export function getCurrentTime(): string {
|
||||
const now = new Date();
|
||||
const formatter = new Intl.DateTimeFormat("zh-CN", {
|
||||
timeZone: "Asia/Shanghai", // 设置为中国标准时间
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
});
|
||||
|
||||
// console.log(formattedDateTime); // 输出中国标准时间格式
|
||||
|
||||
return formatter.format(now);
|
||||
}
|
||||
@@ -9,8 +9,13 @@ export function useAllModels() {
|
||||
return collectModels(
|
||||
configStore.models,
|
||||
[configStore.customModels, accessStore.customModels].join(","),
|
||||
);
|
||||
}, [accessStore.customModels, configStore.customModels, configStore.models]);
|
||||
).filter((m) => !configStore.dontUseModel.includes(m.name as any));
|
||||
}, [
|
||||
accessStore.customModels,
|
||||
configStore.customModels,
|
||||
configStore.models,
|
||||
configStore.dontUseModel,
|
||||
]);
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
export function merge(target: any, source: any) {
|
||||
Object.keys(source).forEach(function (key) {
|
||||
if (
|
||||
source.hasOwnProperty(key) && // Check if the property is not inherited
|
||||
source[key] &&
|
||||
typeof source[key] === "object" || key === "__proto__" || key === "constructor"
|
||||
(source.hasOwnProperty(key) && // Check if the property is not inherited
|
||||
source[key] &&
|
||||
typeof source[key] === "object") ||
|
||||
key === "__proto__" ||
|
||||
key === "constructor"
|
||||
) {
|
||||
merge((target[key] = target[key] || {}), source[key]);
|
||||
return;
|
||||
}
|
||||
target[key] = source[key];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ export function collectModelTable(
|
||||
) {
|
||||
const modelTable: Record<
|
||||
string,
|
||||
{ available: boolean; name: string; displayName: string }
|
||||
{ available: boolean; name: string; displayName: string; describe: string }
|
||||
> = {};
|
||||
|
||||
// default models
|
||||
@@ -37,6 +37,7 @@ export function collectModelTable(
|
||||
name,
|
||||
displayName: displayName || name,
|
||||
available,
|
||||
describe: "",
|
||||
};
|
||||
});
|
||||
return modelTable;
|
||||
|
||||
Reference in New Issue
Block a user