Support billing based on input and output tokens

This commit is contained in:
Liujian committed 2025-07-30 11:33:27 +08:00
1 parent 360e2cd20d
commit 20903eeab5
4 files changed
+31 -9

No files matched your search

+7 -1
View File
@@ -44,7 +44,13 @@ class McpService(Base):
nullable=False,
comment="Charge type: free, per_call, per_token",
)
price: Mapped[float] = mapped_column(Numeric(10, 2), nullable=False, comment="Service price (2 decimal places)")
price: Mapped[float] = mapped_column(Numeric(10, 2), nullable=True, comment="Service price (2 decimal places)")
input_token_price: Mapped[float] = mapped_column(
Numeric(10, 2), nullable=True, comment="Input token price (2 decimal places, for per_token charge type)"
)
output_token_price: Mapped[float] = mapped_column(
Numeric(10, 2), nullable=True, comment="Output token price (2 decimal places, for per_token charge type)"
)
enabled: Mapped[int] = mapped_column(Integer, nullable=True, comment="Service status: 0=disabled, 1=enabled")
tags: Mapped[str] = mapped_column(String, nullable=True, comment="Tags")
created_at: Mapped[datetime] = mapped_column(
+7 -1
View File
@@ -44,7 +44,13 @@ class TempMcpService(Base):
nullable=False,
comment="Charge type: free, per_call, per_token",
)
price: Mapped[float] = mapped_column(Numeric(10, 2), nullable=False, comment="Service price (2 decimal places)")
price: Mapped[float] = mapped_column(Numeric(10, 2), nullable=True, comment="Service price (2 decimal places)")
input_token_price: Mapped[float] = mapped_column(
Numeric(10, 2), nullable=True, comment="Input token price (2 decimal places, for per_token charge type)"
)
output_token_price: Mapped[float] = mapped_column(
Numeric(10, 2), nullable=True, comment="Output token price (2 decimal places, for per_token charge type)"
)
enabled: Mapped[int] = mapped_column(Integer, nullable=True, comment="Service status: 0=disabled, 1=enabled")
tags: Mapped[str] = mapped_column(String, nullable=True, comment="Tags")
created_at: Mapped[datetime] = mapped_column(
+3 -4
View File
@@ -37,10 +37,9 @@ class User(Base):
default=False,
comment="Soft delete flag: 0=active, 1=deleted",
)
register_type: Mapped[str] = mapped_column(
# Enum(RegisterType, values_callable=lambda obj: [e.value for e in obj]),
String(36),
nullable=False,
register_type: Mapped[RegisterType] = mapped_column(
Enum(RegisterType, values_callable=lambda obj: [e.value for e in obj]),
nullable=False,
comment="Registration method"
)
role_id: Mapped[int] = mapped_column(