mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-09-04 06:16:54 +08:00
feat: maskpage&newchatpage adapt new ui framework done
This commit is contained in:
@@ -30,9 +30,26 @@ export type ChatMessage = RequestMessage & {
|
||||
model?: ModelType;
|
||||
};
|
||||
|
||||
export function createMessage(override: Partial<ChatMessage>): ChatMessage {
|
||||
let tempGlobalId = 0;
|
||||
|
||||
export function createMessage(
|
||||
override: Partial<ChatMessage>,
|
||||
options?: { temp?: boolean; customId?: string },
|
||||
): ChatMessage {
|
||||
const { temp, customId } = options ?? {};
|
||||
|
||||
let id: string;
|
||||
if (customId) {
|
||||
id = customId;
|
||||
} else if (temp) {
|
||||
tempGlobalId += 1;
|
||||
id = String(tempGlobalId);
|
||||
} else {
|
||||
id = nanoid();
|
||||
}
|
||||
|
||||
return {
|
||||
id: nanoid(),
|
||||
id,
|
||||
date: new Date().toLocaleString(),
|
||||
role: "user",
|
||||
content: "",
|
||||
|
Reference in New Issue
Block a user