For new users give 200 credits

This commit is contained in:
Harshith Mullapudi 2025-07-24 15:54:37 +05:30
parent b380f2657f
commit 24038a4789
2 changed files with 6 additions and 2 deletions

View File

@ -156,6 +156,11 @@ export async function findOrCreateGoogleUser({
authIdentifier,
email,
authenticationMethod: "GOOGLE",
UserUsage: {
create: {
availableCredits: 200,
},
},
},
});

View File

@ -91,7 +91,6 @@ export const chat = task({
let conversationStatus = "success";
for await (const step of stream) {
if (step.type === "STEP") {
creditForChat += 1;
const stepDetails = JSON.parse(step.message as string);
if (stepDetails.skillStatus === ActionStatusEnum.TOOL_REQUEST) {
@ -123,7 +122,7 @@ export const chat = task({
payload.conversationId,
);
usageCredits && (await updateUserCredits(usageCredits, creditForChat));
usageCredits && (await updateUserCredits(usageCredits, 1));
if (init?.tokenId) {
await deletePersonalAccessToken(init.tokenId);