IT WORKS NOW :))))))) (The send groq api key part)

This commit is contained in:
吳元皓 2025-06-09 11:34:33 +08:00
parent e2b4acb68b
commit 2ef4cd9277
2 changed files with 9 additions and 4 deletions

View File

@ -45,7 +45,7 @@ export default defineEventHandler(async (event) => {
error: "CANNOT_CREATE_NEW_USER",
};
}
const createOtherFields = await sql`
await sql`
insert into user_other_data(user_id, username, translate_enabled, translate_provider, remove_translate_popup, starred_news)
values (${userUUID}, ${username}, false, 'google', false, '{}'::JSON)
`;

View File

@ -32,9 +32,13 @@ export default defineEventHandler(async (event) => {
if (!allowedColumns.includes(requestChange)) {
throw new Error("Invalid column name provided");
}
const sqlC = await sql.unsafe`
UPDATE user_other_data SET ${requestChange} = ${apiKeyqq[0]}
WHERE username = ${checkUserToken[0].username}`;
const sqlC = await sql.unsafe(
`
UPDATE user_other_data SET ${requestChange} = $1
WHERE username = $2`,
[apiKeyqq[0], checkUserToken[0].username],
);
/**
* // Example of how requestChange might be validated
@ -52,6 +56,7 @@ export default defineEventHandler(async (event) => {
body: body,
allowed: allowed,
data: body.value.match(clearBadDataRegex),
sqlC: sqlC,
};
}
});