Codex/beta application review #5
+2
-3
@@ -21,9 +21,8 @@ const CREDIT_UNITS_PER_CREDIT = 100;
|
|||||||
const CREDITS_PER_CNY = 100;
|
const CREDITS_PER_CNY = 100;
|
||||||
const CREDIT_UNITS_PER_CNY_CENT = 100;
|
const CREDIT_UNITS_PER_CNY_CENT = 100;
|
||||||
const CREDIT_UNITS_PER_CNY_MILL = 10;
|
const CREDIT_UNITS_PER_CNY_MILL = 10;
|
||||||
const IMAGE_GENERATION_FLAT_COST_CNY = 20;
|
const IMAGE_GENERATION_FLAT_COST_CREDITS = 20;
|
||||||
const IMAGE_GENERATION_FLAT_COST_CENTS =
|
const IMAGE_GENERATION_FLAT_COST_CENTS = IMAGE_GENERATION_FLAT_COST_CREDITS * CREDIT_UNITS_PER_CREDIT;
|
||||||
IMAGE_GENERATION_FLAT_COST_CNY * CREDITS_PER_CNY * CREDIT_UNITS_PER_CREDIT;
|
|
||||||
|
|
||||||
function creditsToCreditUnits(credits) {
|
function creditsToCreditUnits(credits) {
|
||||||
return Math.max(0, Math.round(Number(credits || 0) * CREDIT_UNITS_PER_CREDIT));
|
return Math.max(0, Math.round(Number(credits || 0) * CREDIT_UNITS_PER_CREDIT));
|
||||||
|
|||||||
+3
-3
@@ -136,7 +136,7 @@ function registerUserRoutes(router) {
|
|||||||
CASE
|
CASE
|
||||||
WHEN billing_refunded = 1 THEN 0
|
WHEN billing_refunded = 1 THEN 0
|
||||||
WHEN cost_cents > 0 THEN cost_cents
|
WHEN cost_cents > 0 THEN cost_cents
|
||||||
WHEN status = 'completed' AND type = 'image' THEN 200000
|
WHEN status = 'completed' AND type = 'image' THEN 2000
|
||||||
WHEN status = 'completed' AND type = 'video' THEN 50000
|
WHEN status = 'completed' AND type = 'video' THEN 50000
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END
|
END
|
||||||
@@ -162,7 +162,7 @@ function registerUserRoutes(router) {
|
|||||||
resolution = params.resolution || params.quality || params.ratio || null;
|
resolution = params.resolution || params.quality || params.ratio || null;
|
||||||
if (row.status === "completed") {
|
if (row.status === "completed") {
|
||||||
if (row.type === "image") {
|
if (row.type === "image") {
|
||||||
estimatedCents = 200000;
|
estimatedCents = 2000;
|
||||||
} else if (row.type === "video") {
|
} else if (row.type === "video") {
|
||||||
const dur = params.duration || 5;
|
const dur = params.duration || 5;
|
||||||
const res = String(params.resolution || params.quality || "").toUpperCase();
|
const res = String(params.resolution || params.quality || "").toUpperCase();
|
||||||
@@ -209,7 +209,7 @@ function registerUserRoutes(router) {
|
|||||||
CASE
|
CASE
|
||||||
WHEN billing_refunded = 1 THEN 0
|
WHEN billing_refunded = 1 THEN 0
|
||||||
WHEN cost_cents > 0 THEN cost_cents
|
WHEN cost_cents > 0 THEN cost_cents
|
||||||
WHEN status = 'completed' AND type = 'image' THEN 200000
|
WHEN status = 'completed' AND type = 'image' THEN 2000
|
||||||
WHEN status = 'completed' AND type = 'video' THEN 50000
|
WHEN status = 'completed' AND type = 'video' THEN 50000
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END
|
END
|
||||||
|
|||||||
Reference in New Issue
Block a user