Merge branch 'Yidadaa:main' into main

This commit is contained in:
Hk-Gosuto 2023-07-12 11:10:21 +08:00 committed by GitHub
commit be560a7485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -35,12 +35,12 @@ export async function requestOpenai(req: NextRequest) {
const fetchOptions: RequestInit = {
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-store",
Authorization: authValue,
...(process.env.OPENAI_ORG_ID && {
"OpenAI-Organization": process.env.OPENAI_ORG_ID,
}),
},
cache: "no-store",
method: req.method,
body: req.body,
// @ts-ignore

View File

@ -109,7 +109,7 @@ export const useMaskStore = create<MaskStore>()(
}),
{
name: StoreKey.Mask,
version: 3,
version: 3.1,
migrate(state, version) {
const newState = JSON.parse(JSON.stringify(state)) as MaskState;
@ -119,6 +119,14 @@ export const useMaskStore = create<MaskStore>()(
Object.values(newState.masks).forEach((m) => (m.id = nanoid()));
}
if (version < 3.1) {
const updatedMasks: Record<string, Mask> = {};
Object.values(newState.masks).forEach((m) => {
updatedMasks[m.id] = m;
});
newState.masks = updatedMasks;
}
return newState as any;
},
},