mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 18:48:27 +00:00
For new users give 200 credits
This commit is contained in:
parent
b380f2657f
commit
24038a4789
@ -156,6 +156,11 @@ export async function findOrCreateGoogleUser({
|
|||||||
authIdentifier,
|
authIdentifier,
|
||||||
email,
|
email,
|
||||||
authenticationMethod: "GOOGLE",
|
authenticationMethod: "GOOGLE",
|
||||||
|
UserUsage: {
|
||||||
|
create: {
|
||||||
|
availableCredits: 200,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,6 @@ export const chat = task({
|
|||||||
let conversationStatus = "success";
|
let conversationStatus = "success";
|
||||||
for await (const step of stream) {
|
for await (const step of stream) {
|
||||||
if (step.type === "STEP") {
|
if (step.type === "STEP") {
|
||||||
creditForChat += 1;
|
|
||||||
const stepDetails = JSON.parse(step.message as string);
|
const stepDetails = JSON.parse(step.message as string);
|
||||||
|
|
||||||
if (stepDetails.skillStatus === ActionStatusEnum.TOOL_REQUEST) {
|
if (stepDetails.skillStatus === ActionStatusEnum.TOOL_REQUEST) {
|
||||||
@ -123,7 +122,7 @@ export const chat = task({
|
|||||||
payload.conversationId,
|
payload.conversationId,
|
||||||
);
|
);
|
||||||
|
|
||||||
usageCredits && (await updateUserCredits(usageCredits, creditForChat));
|
usageCredits && (await updateUserCredits(usageCredits, 1));
|
||||||
|
|
||||||
if (init?.tokenId) {
|
if (init?.tokenId) {
|
||||||
await deletePersonalAccessToken(init.tokenId);
|
await deletePersonalAccessToken(init.tokenId);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user