feature/ui:1.0 feature,like mcp price method support use token and set more config about home page
This commit is contained in:
1 parent
2262a7f49a
commit
8946be619d
69 files changed
+4189
-1021
No files matched your search
@@ -19,6 +19,8 @@ export interface BaseMCPService {
|
||||
long_description?: string;
|
||||
charge_type: ChargeType;
|
||||
price?: string;
|
||||
input_token_price?: string;
|
||||
output_token_price?: string;
|
||||
apis: MCPServiceAPIItem[];
|
||||
tags?: string[];
|
||||
}
|
||||
@@ -34,6 +36,7 @@ export interface MCPServiceAPIItem {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
// form data interface, used to create and edit service
|
||||
@@ -48,6 +51,8 @@ export interface MCPServiceFormData {
|
||||
auth_token?: string;
|
||||
charge_type: ChargeType;
|
||||
price?: string;
|
||||
input_token_price?: string; // Price for input tokens when charge_type is PerToken
|
||||
output_token_price?: string; // Price for output tokens when charge_type is PerToken
|
||||
enabled: EnabledEnum; // API requires string type
|
||||
apis: MCPServiceAPIItem[];
|
||||
tags?: string[];
|
||||
@@ -89,41 +94,6 @@ 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
|
||||
@@ -138,6 +108,8 @@ export function convertFormToAPI(
|
||||
auth_token: formData.auth_token,
|
||||
charge_type: formData.charge_type,
|
||||
price: formData.price,
|
||||
input_token_price: formData.input_token_price,
|
||||
output_token_price: formData.output_token_price,
|
||||
enabled: formData.enabled,
|
||||
apis: formData.apis,
|
||||
tags: formData.tags,
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// payment channel type
|
||||
export type PaymentChannelType = "stripe";
|
||||
export type PaymentChannelType = "stripe" | "alipay" | "wechat";
|
||||
|
||||
// stripe config - admin need to configure
|
||||
export interface StripeConfig {
|
||||
secret: string;
|
||||
webhook_secret: string;
|
||||
is_enabled?: boolean;
|
||||
}
|
||||
|
||||
// alipay config - admin need to configure
|
||||
export interface AlipayConfig {
|
||||
app_id: string;
|
||||
app_private_key: string;
|
||||
alipay_public_key: string;
|
||||
is_enabled?: boolean;
|
||||
}
|
||||
|
||||
// wechat config - admin need to configure
|
||||
export interface WechatConfig {
|
||||
app_id: string;
|
||||
mch_id: string;
|
||||
is_enabled?: boolean;
|
||||
}
|
||||
|
||||
// union type for all payment configs
|
||||
export type PaymentConfig = StripeConfig | AlipayConfig | WechatConfig;
|
||||
|
||||
// API return payment channel item structure
|
||||
export interface PaymentChannelApiItem {
|
||||
id: PaymentChannelType;
|
||||
name: string;
|
||||
is_enabled: boolean;
|
||||
config: StripeConfig;
|
||||
config: PaymentConfig;
|
||||
update_time: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@ import {
|
||||
GoogleAuthConfig,
|
||||
PlatformConfig,
|
||||
LoginConfig,
|
||||
FaqItem,
|
||||
TopNavigationItem,
|
||||
EmbeddedHtmlConfig,
|
||||
PaymentChannel,
|
||||
} from "@/shared/types/system";
|
||||
|
||||
// API return system config data structure
|
||||
@@ -12,6 +16,11 @@ export interface SystemConfigApiData {
|
||||
account: AdminConfig;
|
||||
email: EmailConfig;
|
||||
login: LoginConfig;
|
||||
faq?: FaqItem[];
|
||||
top_navigation?: TopNavigationItem[];
|
||||
embeded_html?: EmbeddedHtmlConfig;
|
||||
payment_channels?: PaymentChannel[];
|
||||
is_installed?: boolean;
|
||||
}
|
||||
// admin config
|
||||
export interface AdminConfig {
|
||||
|
||||
Reference in new issue
Block a user