feat(client): generate API client SDK with auto-generated exports
Some checks are pending
CI / Rust Lint & Check (push) Waiting to run
CI / Rust Tests (push) Waiting to run
CI / Frontend Lint & Type Check (push) Waiting to run
CI / Frontend Build (push) Blocked by required conditions

This commit is contained in:
ZhenYi 2026-04-29 00:06:30 +08:00
parent 7ce113a765
commit c2b4553537
6 changed files with 310 additions and 438 deletions

View File

@ -41,6 +41,7 @@ use utoipa::OpenApi;
crate::agent::provider::provider_update, crate::agent::provider::provider_update,
crate::agent::provider::provider_delete, crate::agent::provider::provider_delete,
crate::agent::model::model_list, crate::agent::model::model_list,
crate::agent::model::model_catalog,
crate::agent::model::model_get, crate::agent::model::model_get,
crate::agent::model::model_create, crate::agent::model::model_create,
crate::agent::model::model_update, crate::agent::model::model_update,
@ -594,6 +595,8 @@ use utoipa::OpenApi;
service::agent::provider::CreateProviderRequest, service::agent::provider::CreateProviderRequest,
service::agent::provider::UpdateProviderRequest, service::agent::provider::UpdateProviderRequest,
service::agent::model::ModelResponse, service::agent::model::ModelResponse,
service::agent::model::ModelWithPricingResponse,
service::agent::model::ModelListResponse,
service::agent::model::CreateModelRequest, service::agent::model::CreateModelRequest,
service::agent::model::UpdateModelRequest, service::agent::model::UpdateModelRequest,
service::agent::model_version::ModelVersionResponse, service::agent::model_version::ModelVersionResponse,

View File

@ -9,105 +9,6 @@
"version": "0.2.9" "version": "0.2.9"
}, },
"paths": { "paths": {
"/api/admin/ai/sync": {
"post": {
"tags": [
"Admin"
],
"operationId": "admin_sync_models",
"responses": {
"200": {
"description": "Sync result",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiResponse_SyncModelsResponse"
}
}
}
},
"401": {
"description": "Invalid or missing admin API key"
},
"500": {
"description": "Sync failed"
}
}
}
},
"/api/admin/alerts/check": {
"post": {
"tags": [
"Admin"
],
"operationId": "admin_check_alerts",
"responses": {
"200": {
"description": "Alert check result",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiResponse_CheckAlertsResponse"
}
}
}
},
"401": {
"description": "Invalid or missing admin API key"
}
}
}
},
"/api/admin/workspaces/{slug}/add-credit": {
"post": {
"tags": [
"Admin"
],
"operationId": "admin_workspace_add_credit",
"parameters": [
{
"name": "slug",
"in": "path",
"description": "Workspace slug",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WorkspaceBillingAddCreditParams"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Credit added",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiResponse_WorkspaceBillingCurrentResponse"
}
}
}
},
"400": {
"description": "Invalid amount"
},
"401": {
"description": "Invalid or missing admin API key"
},
"404": {
"description": "Workspace not found"
}
}
}
},
"/api/agents/capabilities": { "/api/agents/capabilities": {
"post": { "post": {
"tags": [ "tags": [
@ -392,6 +293,79 @@
} }
} }
}, },
"/api/agents/models/catalog": {
"get": {
"tags": [
"Agent"
],
"operationId": "model_catalog",
"parameters": [
{
"name": "provider_id",
"in": "query",
"required": false,
"schema": {
"type": [
"string",
"null"
]
}
},
{
"name": "search",
"in": "query",
"required": false,
"schema": {
"type": [
"string",
"null"
]
}
},
{
"name": "page",
"in": "query",
"required": false,
"schema": {
"type": [
"integer",
"null"
],
"format": "int64",
"minimum": 0
}
},
{
"name": "per_page",
"in": "query",
"required": false,
"schema": {
"type": [
"integer",
"null"
],
"format": "int64",
"minimum": 0
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelListResponse"
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/api/agents/models/{id}": { "/api/agents/models/{id}": {
"get": { "get": {
"tags": [ "tags": [
@ -20090,6 +20064,25 @@
"format": "int32", "format": "int32",
"minimum": 0 "minimum": 0
} }
},
{
"name": "room",
"in": "query",
"description": "Scope search to a specific room by UUID",
"required": false,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "pn",
"in": "query",
"description": "Scope search to a specific project by name",
"required": false,
"schema": {
"type": "string"
}
} }
], ],
"responses": { "responses": {
@ -22041,43 +22034,6 @@
} }
} }
}, },
"AlertDetail": {
"type": "object",
"required": [
"workspace_id",
"workspace_name",
"alert_type",
"threshold",
"current_value",
"recipients"
],
"properties": {
"workspace_id": {
"type": "string",
"format": "uuid"
},
"workspace_name": {
"type": "string"
},
"alert_type": {
"type": "string"
},
"threshold": {
"type": "number",
"format": "double"
},
"current_value": {
"type": "number",
"format": "double"
},
"recipients": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"AnswerRequest": { "AnswerRequest": {
"type": "object", "type": "object",
"required": [ "required": [
@ -23606,46 +23562,6 @@
} }
} }
}, },
"ApiResponse_CheckAlertsResponse": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"data": {
"type": "object",
"required": [
"workspaces_checked",
"alerts_sent",
"details"
],
"properties": {
"workspaces_checked": {
"type": "integer",
"minimum": 0
},
"alerts_sent": {
"type": "integer",
"minimum": 0
},
"details": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AlertDetail"
}
}
}
}
}
},
"ApiResponse_ColumnResponse": { "ApiResponse_ColumnResponse": {
"type": "object", "type": "object",
"required": [ "required": [
@ -27914,6 +27830,13 @@
"content_type": { "content_type": {
"type": "string" "type": "string"
}, },
"thinking_content": {
"type": [
"string",
"null"
],
"description": "Accumulated AI reasoning/thinking text."
},
"edited_at": { "edited_at": {
"type": [ "type": [
"string", "string",
@ -28573,59 +28496,6 @@
} }
} }
}, },
"ApiResponse_SyncModelsResponse": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"data": {
"type": "object",
"required": [
"models_created",
"models_updated",
"versions_created",
"pricing_created",
"capabilities_created",
"profiles_created"
],
"properties": {
"models_created": {
"type": "integer",
"format": "int64"
},
"models_updated": {
"type": "integer",
"format": "int64"
},
"versions_created": {
"type": "integer",
"format": "int64"
},
"pricing_created": {
"type": "integer",
"format": "int64"
},
"capabilities_created": {
"type": "integer",
"format": "int64"
},
"profiles_created": {
"type": "integer",
"format": "int64"
}
}
}
}
},
"ApiResponse_TagCountResponse": { "ApiResponse_TagCountResponse": {
"type": "object", "type": "object",
"required": [ "required": [
@ -32062,7 +31932,6 @@
}, },
"BillingRecord": { "BillingRecord": {
"type": "object", "type": "object",
"description": "Breakdown of a billing record.",
"required": [ "required": [
"cost", "cost",
"currency", "currency",
@ -32072,8 +31941,7 @@
"properties": { "properties": {
"cost": { "cost": {
"type": "number", "type": "number",
"format": "double", "format": "double"
"description": "Total cost in the billing currency."
}, },
"currency": { "currency": {
"type": "string" "type": "string"
@ -32921,30 +32789,6 @@
} }
} }
}, },
"CheckAlertsResponse": {
"type": "object",
"required": [
"workspaces_checked",
"alerts_sent",
"details"
],
"properties": {
"workspaces_checked": {
"type": "integer",
"minimum": 0
},
"alerts_sent": {
"type": "integer",
"minimum": 0
},
"details": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AlertDetail"
}
}
}
},
"ColumnResponse": { "ColumnResponse": {
"type": "object", "type": "object",
"required": [ "required": [
@ -36477,6 +36321,38 @@
} }
} }
}, },
"ModelListResponse": {
"type": "object",
"required": [
"data",
"total",
"page",
"per_page"
],
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ModelWithPricingResponse"
}
},
"total": {
"type": "integer",
"format": "int64",
"minimum": 0
},
"page": {
"type": "integer",
"format": "int64",
"minimum": 0
},
"per_page": {
"type": "integer",
"format": "int64",
"minimum": 0
}
}
},
"ModelParameterProfileResponse": { "ModelParameterProfileResponse": {
"type": "object", "type": "object",
"required": [ "required": [
@ -36669,6 +36545,90 @@
} }
} }
}, },
"ModelWithPricingResponse": {
"type": "object",
"required": [
"id",
"provider_id",
"name",
"modality",
"capability",
"context_length",
"is_open_source",
"status",
"created_at",
"updated_at"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"provider_id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string"
},
"modality": {
"type": "string"
},
"capability": {
"type": "string"
},
"context_length": {
"type": "integer",
"format": "int64"
},
"max_output_tokens": {
"type": [
"integer",
"null"
],
"format": "int64"
},
"training_cutoff": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"is_open_source": {
"type": "boolean"
},
"status": {
"type": "string"
},
"input_price": {
"type": [
"string",
"null"
]
},
"output_price": {
"type": [
"string",
"null"
]
},
"currency": {
"type": [
"string",
"null"
]
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
}
},
"MoveCardParams": { "MoveCardParams": {
"type": "object", "type": "object",
"required": [ "required": [
@ -39562,6 +39522,13 @@
"content_type": { "content_type": {
"type": "string" "type": "string"
}, },
"thinking_content": {
"type": [
"string",
"null"
],
"description": "Accumulated AI reasoning/thinking text."
},
"edited_at": { "edited_at": {
"type": [ "type": [
"string", "string",
@ -40562,6 +40529,8 @@
"required": [ "required": [
"models_created", "models_created",
"models_updated", "models_updated",
"models_offline",
"models_deactivated",
"versions_created", "versions_created",
"pricing_created", "pricing_created",
"capabilities_created", "capabilities_created",
@ -40576,6 +40545,14 @@
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"models_offline": {
"type": "integer",
"format": "int64"
},
"models_deactivated": {
"type": "integer",
"format": "int64"
},
"versions_created": { "versions_created": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -56,15 +56,6 @@ export type AddSshKeyParams = {
public_key: string; public_key: string;
}; };
export type AlertDetail = {
workspace_id: string;
workspace_name: string;
alert_type: string;
threshold: number;
current_value: number;
recipients: Array<string>;
};
export type AnswerRequest = { export type AnswerRequest = {
question: string; question: string;
answer: string; answer: string;
@ -487,16 +478,6 @@ export type ApiResponseCardResponse = {
}; };
}; };
export type ApiResponseCheckAlertsResponse = {
code: number;
message: string;
data?: {
workspaces_checked: number;
alerts_sent: number;
details: Array<AlertDetail>;
};
};
export type ApiResponseColumnResponse = { export type ApiResponseColumnResponse = {
code: number; code: number;
message: string; message: string;
@ -1566,6 +1547,10 @@ export type ApiResponseRoomMessageResponse = {
in_reply_to?: string | null; in_reply_to?: string | null;
content: string; content: string;
content_type: string; content_type: string;
/**
* Accumulated AI reasoning/thinking text.
*/
thinking_content?: string | null;
edited_at?: string | null; edited_at?: string | null;
send_at: string; send_at: string;
revoked?: string | null; revoked?: string | null;
@ -1726,19 +1711,6 @@ export type ApiResponseString = {
data?: string; data?: string;
}; };
export type ApiResponseSyncModelsResponse = {
code: number;
message: string;
data?: {
models_created: number;
models_updated: number;
versions_created: number;
pricing_created: number;
capabilities_created: number;
profiles_created: number;
};
};
export type ApiResponseTagCountResponse = { export type ApiResponseTagCountResponse = {
code: number; code: number;
message: string; message: string;
@ -2587,13 +2559,7 @@ export type AuditLogResponse = {
}; };
}; };
/**
* Breakdown of a billing record.
*/
export type BillingRecord = { export type BillingRecord = {
/**
* Total cost in the billing currency.
*/
cost: number; cost: number;
currency: string; currency: string;
input_tokens: number; input_tokens: number;
@ -2829,12 +2795,6 @@ export type ChangePasswordParams = {
new_password: string; new_password: string;
}; };
export type CheckAlertsResponse = {
workspaces_checked: number;
alerts_sent: number;
details: Array<AlertDetail>;
};
export type ColumnResponse = { export type ColumnResponse = {
id: string; id: string;
board: string; board: string;
@ -3828,6 +3788,13 @@ export type ModelCapabilityResponse = {
created_at: string; created_at: string;
}; };
export type ModelListResponse = {
data: Array<ModelWithPricingResponse>;
total: number;
page: number;
per_page: number;
};
export type ModelParameterProfileResponse = { export type ModelParameterProfileResponse = {
id: number; id: number;
model_version_id: string; model_version_id: string;
@ -3874,6 +3841,24 @@ export type ModelVersionResponse = {
created_at: string; created_at: string;
}; };
export type ModelWithPricingResponse = {
id: string;
provider_id: string;
name: string;
modality: string;
capability: string;
context_length: number;
max_output_tokens?: number | null;
training_cutoff?: string | null;
is_open_source: boolean;
status: string;
input_price?: string | null;
output_price?: string | null;
currency?: string | null;
created_at: string;
updated_at: string;
};
export type MoveCardParams = { export type MoveCardParams = {
target_column_id: string; target_column_id: string;
position: number; position: number;
@ -4622,6 +4607,10 @@ export type RoomMessageResponse = {
in_reply_to?: string | null; in_reply_to?: string | null;
content: string; content: string;
content_type: string; content_type: string;
/**
* Accumulated AI reasoning/thinking text.
*/
thinking_content?: string | null;
edited_at?: string | null; edited_at?: string | null;
send_at: string; send_at: string;
revoked?: string | null; revoked?: string | null;
@ -4874,6 +4863,8 @@ export type SubscriptionInfo = {
export type SyncModelsResponse = { export type SyncModelsResponse = {
models_created: number; models_created: number;
models_updated: number; models_updated: number;
models_offline: number;
models_deactivated: number;
versions_created: number; versions_created: number;
pricing_created: number; pricing_created: number;
capabilities_created: number; capabilities_created: number;
@ -5436,92 +5427,6 @@ export type WorkspaceUpdateParams = {
billing_email?: string | null; billing_email?: string | null;
}; };
export type AdminSyncModelsData = {
body?: never;
path?: never;
query?: never;
url: '/api/admin/ai/sync';
};
export type AdminSyncModelsErrors = {
/**
* Invalid or missing admin API key
*/
401: unknown;
/**
* Sync failed
*/
500: unknown;
};
export type AdminSyncModelsResponses = {
/**
* Sync result
*/
200: ApiResponseSyncModelsResponse;
};
export type AdminSyncModelsResponse = AdminSyncModelsResponses[keyof AdminSyncModelsResponses];
export type AdminCheckAlertsData = {
body?: never;
path?: never;
query?: never;
url: '/api/admin/alerts/check';
};
export type AdminCheckAlertsErrors = {
/**
* Invalid or missing admin API key
*/
401: unknown;
};
export type AdminCheckAlertsResponses = {
/**
* Alert check result
*/
200: ApiResponseCheckAlertsResponse;
};
export type AdminCheckAlertsResponse = AdminCheckAlertsResponses[keyof AdminCheckAlertsResponses];
export type AdminWorkspaceAddCreditData = {
body: WorkspaceBillingAddCreditParams;
path: {
/**
* Workspace slug
*/
slug: string;
};
query?: never;
url: '/api/admin/workspaces/{slug}/add-credit';
};
export type AdminWorkspaceAddCreditErrors = {
/**
* Invalid amount
*/
400: unknown;
/**
* Invalid or missing admin API key
*/
401: unknown;
/**
* Workspace not found
*/
404: unknown;
};
export type AdminWorkspaceAddCreditResponses = {
/**
* Credit added
*/
200: ApiResponseWorkspaceBillingCurrentResponse;
};
export type AdminWorkspaceAddCreditResponse = AdminWorkspaceAddCreditResponses[keyof AdminWorkspaceAddCreditResponses];
export type ModelCapabilityCreateData = { export type ModelCapabilityCreateData = {
body: CreateModelCapabilityRequest; body: CreateModelCapabilityRequest;
path?: never; path?: never;
@ -5659,7 +5564,7 @@ export type ModelListResponses = {
200: Array<ModelResponse>; 200: Array<ModelResponse>;
}; };
export type ModelListResponse = ModelListResponses[keyof ModelListResponses]; export type ModelListResponse2 = ModelListResponses[keyof ModelListResponses];
export type ModelCreateData = { export type ModelCreateData = {
body: CreateModelRequest; body: CreateModelRequest;
@ -5680,6 +5585,31 @@ export type ModelCreateResponses = {
export type ModelCreateResponse = ModelCreateResponses[keyof ModelCreateResponses]; export type ModelCreateResponse = ModelCreateResponses[keyof ModelCreateResponses];
export type ModelCatalogData = {
body?: never;
path?: never;
query?: {
provider_id?: string | null;
search?: string | null;
page?: number | null;
per_page?: number | null;
};
url: '/api/agents/models/catalog';
};
export type ModelCatalogErrors = {
/**
* Unauthorized
*/
401: unknown;
};
export type ModelCatalogResponses = {
200: ModelListResponse;
};
export type ModelCatalogResponse = ModelCatalogResponses[keyof ModelCatalogResponses];
export type ModelDeleteData = { export type ModelDeleteData = {
body?: never; body?: never;
path: { path: {

View File

@ -1,5 +1,5 @@
import React, { memo, useState, useEffect, useCallback, useRef } from 'react'; import React, { memo, useState, useEffect, useCallback, useRef } from 'react';
import type { RoomResponse, RoomAiResponse, RoomAiUpsertRequest } from '@/client'; import type { RoomResponse, RoomAiResponse, RoomAiUpsertRequest, ModelWithPricingResponse, ModelListResponse } from '@/client';
import { aiList, aiUpsert, aiDelete } from '@/client'; import { aiList, aiUpsert, aiDelete } from '@/client';
import { client } from '@/client/client.gen'; import { client } from '@/client/client.gen';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
@ -37,30 +37,8 @@ interface RoomSettingsPanelProps {
isPending: boolean; isPending: boolean;
} }
interface CatalogModel { type CatalogModel = ModelWithPricingResponse;
id: string; type CatalogResponse = ModelListResponse;
provider_id: string;
name: string;
modality: string;
capability: string;
context_length: number;
max_output_tokens?: number;
training_cutoff?: string;
is_open_source: boolean;
status: string;
input_price?: string;
output_price?: string;
currency?: string;
created_at: string;
updated_at: string;
}
interface CatalogResponse {
data: CatalogModel[];
total: number;
page: number;
per_page: number;
}
function formatContextLength(n: number): string { function formatContextLength(n: number): string {
if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(n % 1_000_000 === 0 ? 0 : 1)}M`; if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(n % 1_000_000 === 0 ? 0 : 1)}M`;
@ -68,7 +46,7 @@ function formatContextLength(n: number): string {
return String(n); return String(n);
} }
function formatPrice(price?: string): string { function formatPrice(price?: string | null): string {
if (!price) return 'N/A'; if (!price) return 'N/A';
const n = parseFloat(price); const n = parseFloat(price);
if (isNaN(n)) return price; if (isNaN(n)) return price;