First commit to the code repository
This commit is contained in:
1 parent
692cdee407
commit
0c0dd1cb56
323 files changed
+45712
No files matched your search
@@ -0,0 +1,12 @@
|
||||
export interface Admin {
|
||||
username: string;
|
||||
}
|
||||
|
||||
export interface AdminLoginFormData {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface AdminLoginResponse {
|
||||
user_token: string;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// dashboard related type definitions
|
||||
|
||||
// platform overview data structure (API return)
|
||||
export interface PlatformOverviewData {
|
||||
total_user: number;
|
||||
total_balance: number;
|
||||
total_service: number;
|
||||
invoke_count: {
|
||||
today: number;
|
||||
};
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import { PlatformConfigResponse } from "@/shared/types/system";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__PLATFORM_CONFIG__?: PlatformConfigResponse | null;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@@ -0,0 +1,146 @@
|
||||
import { ChargeType } from "@/shared/types/marketplace";
|
||||
|
||||
export enum AuthMethod {
|
||||
None = "none",
|
||||
APIKey = "apikey",
|
||||
BearerToken = "token",
|
||||
}
|
||||
|
||||
export enum EnabledEnum {
|
||||
Offline = 0,
|
||||
Online = 1,
|
||||
}
|
||||
|
||||
// API data interface, match OpenAPI specification
|
||||
export interface BaseMCPService {
|
||||
id: string;
|
||||
name: string;
|
||||
short_description: string;
|
||||
long_description?: string;
|
||||
charge_type: ChargeType;
|
||||
price?: string;
|
||||
apis: MCPServiceAPIItem[];
|
||||
tags?: string[];
|
||||
}
|
||||
export interface MCPService extends BaseMCPService {
|
||||
base_url: string;
|
||||
auth_method: AuthMethod;
|
||||
auth_header?: string;
|
||||
auth_token?: string;
|
||||
enabled: EnabledEnum; // 0: offline, 1: online
|
||||
}
|
||||
|
||||
export interface MCPServiceAPIItem {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
// form data interface, used to create and edit service
|
||||
export interface MCPServiceFormData {
|
||||
id?: string; // edit needed
|
||||
name: string;
|
||||
short_description: string;
|
||||
long_description?: string;
|
||||
base_url: string;
|
||||
auth_method: AuthMethod;
|
||||
auth_header?: string;
|
||||
auth_token?: string;
|
||||
charge_type: ChargeType;
|
||||
price?: string;
|
||||
enabled: EnabledEnum; // API requires string type
|
||||
apis: MCPServiceAPIItem[];
|
||||
tags?: string[];
|
||||
update_type?: string; // 用于标识更新类型,如 "openapi"
|
||||
}
|
||||
|
||||
// OpenAPI generator data interface
|
||||
export interface OpenAPIGeneratorData {
|
||||
url?: string;
|
||||
file?: File;
|
||||
}
|
||||
|
||||
// OpenAPI parse response interface
|
||||
export interface OpenAPIParseResponse {
|
||||
service_id: string;
|
||||
}
|
||||
|
||||
// service filter interface
|
||||
export interface ServiceFilters {
|
||||
search: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
// service stats interface
|
||||
export interface ServiceStats {
|
||||
total: number;
|
||||
online: number;
|
||||
offline: number;
|
||||
}
|
||||
|
||||
// service enable/disable request interface
|
||||
export interface ServiceEnabledRequest {
|
||||
id: string;
|
||||
enabled: EnabledEnum; // 0: offline, 1: online
|
||||
}
|
||||
|
||||
// delete service request interface
|
||||
export interface ServiceDeleteRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
// predefined auth methods
|
||||
export const AUTH_METHODS = [
|
||||
{ value: "free", label: "free" },
|
||||
{ value: "apikey", label: "API key" },
|
||||
] as const;
|
||||
|
||||
// predefined charge types
|
||||
export const CHARGE_TYPES = [
|
||||
{ value: "free", label: "free" },
|
||||
{ value: "per_call", label: "per call" },
|
||||
{ value: "per_token", label: "per token" },
|
||||
] as const;
|
||||
|
||||
// predefined service categories
|
||||
export const SERVICE_CATEGORIES = [
|
||||
"Web Services",
|
||||
"Database",
|
||||
"AI/ML",
|
||||
"Authentication",
|
||||
"Payment",
|
||||
"Communication",
|
||||
"Analytics",
|
||||
"Storage",
|
||||
"Security",
|
||||
"Development Tools",
|
||||
"Financial",
|
||||
"Logistics & Transportation",
|
||||
"E-commerce",
|
||||
"Social Media",
|
||||
"Content Management",
|
||||
"Other",
|
||||
] as const;
|
||||
|
||||
export type ServiceCategory = (typeof SERVICE_CATEGORIES)[number];
|
||||
|
||||
// tool function: convert frontend form data to API data
|
||||
export function convertFormToAPI(
|
||||
formData: MCPServiceFormData
|
||||
): Omit<MCPService, "id"> & { update_type?: string } {
|
||||
return {
|
||||
name: formData.name,
|
||||
short_description: formData.short_description,
|
||||
long_description: formData.long_description,
|
||||
base_url: formData.base_url,
|
||||
auth_method: formData.auth_method,
|
||||
auth_header: formData.auth_header,
|
||||
auth_token: formData.auth_token,
|
||||
charge_type: formData.charge_type,
|
||||
price: formData.price,
|
||||
enabled: formData.enabled,
|
||||
apis: formData.apis,
|
||||
tags: formData.tags,
|
||||
update_type: formData.update_type,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// payment channel type
|
||||
export type PaymentChannelType = "stripe";
|
||||
|
||||
// stripe config - admin need to configure
|
||||
export interface StripeConfig {
|
||||
secret: string;
|
||||
webhook_secret: string;
|
||||
}
|
||||
|
||||
// API return payment channel item structure
|
||||
export interface PaymentChannelApiItem {
|
||||
id: PaymentChannelType;
|
||||
name: string;
|
||||
is_enabled: boolean;
|
||||
config: StripeConfig;
|
||||
update_time: string;
|
||||
}
|
||||
|
||||
// API return payment channel list response
|
||||
export interface PaymentChannelListResponse {
|
||||
data: PaymentChannelApiItem[];
|
||||
}
|
||||
|
||||
// payment channel test result
|
||||
export interface PaymentChannelTestResult {
|
||||
success: boolean;
|
||||
message: string;
|
||||
details?: any;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
export enum PaymentState {
|
||||
Pending = 0,
|
||||
Completed = 1,
|
||||
Failed = 2,
|
||||
}
|
||||
|
||||
// revenue record
|
||||
export interface RevenueRecord {
|
||||
id: string;
|
||||
email: string;
|
||||
amount: number;
|
||||
create_at: string; //transaction time
|
||||
payment_type?: string;
|
||||
order_id?: string;
|
||||
payment_state: PaymentState;
|
||||
}
|
||||
|
||||
// revenue filters
|
||||
export interface RevenueFilters {
|
||||
search: string;
|
||||
status?: PaymentState;
|
||||
dateRange?: {
|
||||
start: string;
|
||||
end: string;
|
||||
};
|
||||
}
|
||||
|
||||
// pagination params
|
||||
export interface PaginationParams {
|
||||
page: number;
|
||||
limit: number;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// 系统设置相关类型定义
|
||||
|
||||
import { GoogleAuthConfig, PlatformConfig } from "@/shared/types/system";
|
||||
|
||||
// API return system config data structure
|
||||
export interface SystemConfigApiData {
|
||||
platform: PlatformConfig;
|
||||
account: AdminConfig;
|
||||
email: EmailConfig;
|
||||
login: {
|
||||
google: GoogleAuthConfig;
|
||||
};
|
||||
}
|
||||
// admin config
|
||||
export interface AdminConfig {
|
||||
username: string; // admin username
|
||||
password: string; // admin password
|
||||
}
|
||||
|
||||
// email config
|
||||
export interface EmailConfig {
|
||||
smtp_host: string; // SMTP host
|
||||
smtp_port: string; // SMTP port
|
||||
smtp_user: string; // SMTP username
|
||||
smtp_password: string; // SMTP password
|
||||
smtp_sender: string; // sender email
|
||||
}
|
||||
|
||||
// client-side google auth config (without sensitive data)
|
||||
export interface ClientGoogleAuthConfig {
|
||||
client_id: string; // Google Client ID
|
||||
is_enabled: boolean; // whether to enable google login
|
||||
}
|
||||
|
||||
// system config
|
||||
export interface SystemConfig {
|
||||
platform: PlatformConfig;
|
||||
admin: AdminConfig;
|
||||
email: EmailConfig;
|
||||
googleAuth: GoogleAuthConfig;
|
||||
}
|
||||
|
||||
// system config form data
|
||||
export interface SystemConfigFormData {
|
||||
platform: Partial<PlatformConfig>;
|
||||
admin: Partial<AdminConfig>;
|
||||
email: Partial<EmailConfig>;
|
||||
googleAuth: Partial<GoogleAuthConfig>;
|
||||
}
|
||||
|
||||
// system config test result
|
||||
export interface SystemConfigTestResult {
|
||||
success: boolean;
|
||||
message: string;
|
||||
details?: any;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
export interface User {
|
||||
created_at: string;
|
||||
id: string;
|
||||
email: string;
|
||||
balance: number;
|
||||
}
|
||||
|
||||
// user management related filter interface
|
||||
export interface UserFilters {
|
||||
search: string;
|
||||
}
|
||||
|
||||
// pagination params interface
|
||||
export interface PaginationParams {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
// user list response interface
|
||||
export interface UserListResponse {
|
||||
users: User[];
|
||||
total: number;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
}
|
||||
Reference in new issue
Block a user