Refactor frontend workspaces and centralize API contracts

Organize domain APIs and types under common/apis, shared components under named folders, and private workspace logic alongside each page.

Use Bearer sessions, explicit response envelopes, session-aware routing and streams, and configurable login captcha presentation for the deployed backend contract.

Preserve news, economic calendar, crawler, market, chat, Skills, settings, and demo trading workflows with responsive layouts and explicit configuration saves.

Validate with frontend lint, type checking, 22 test groups, production builds, and deployed desktop/mobile page checks.
This commit is contained in:
eezd committed 2026-10-26 11:39:52 +08:00
1 parent 77b33e5e77
commit bc480fb806
102 files changed
+4716 -1707

No files matched your search

+81
View File
@@ -0,0 +1,81 @@
import type * as Settings from "./type"
import { request } from "@/http/axios"
/** 读取模型配置(不返回密钥) */
export function listProvidersApi() {
return request<Settings.ListProvidersResponseData>({
url: "/settings/providers",
method: "get"
})
}
/** 新增模型配置 */
export function createProviderApi(body: Settings.ProviderForm) {
return request<Settings.CreateProviderResponseData>({
url: "/settings/providers",
method: "post",
data: body
})
}
/** 修改模型配置;空密钥保持原值 */
export function patchProviderApi(id: number, body: Partial<Settings.ProviderForm>) {
return request<Settings.PatchProviderResponseData>({
url: `/settings/providers/${id}`,
method: "patch",
data: body
})
}
/** 删除模型配置 */
export function deleteProviderApi(id: number) {
return request<Settings.DeleteProviderResponseData>({
url: `/settings/providers/${id}`,
method: "delete"
})
}
/** 测试模型连接;按后端 SDK 重试上限等待 */
export function testProviderApi(id: number) {
return request<Settings.TestProviderResponseData>({
url: `/settings/providers/${id}/test`,
method: "post",
data: null,
timeout: 1900000
})
}
/** 读取当前模拟盘交易所设置 */
export function getExchangeApi() {
return request<Settings.GetExchangeResponseData>({
url: "/settings/exchange",
method: "get"
})
}
/** 切换交易所或保存其凭证 */
export function putExchangeApi(body: Settings.PutExchangeBodyRequestData) {
return request<Settings.PutExchangeResponseData>({
url: "/settings/exchange",
method: "put",
data: body
})
}
/** 删除当前交易所凭证 */
export function deleteExchangeApi() {
return request<Settings.DeleteExchangeResponseData>({
url: "/settings/exchange",
method: "delete"
})
}
/** 测试当前模拟盘连接 */
export function testExchangeApi() {
return request<Settings.TestExchangeResponseData>({
url: "/settings/exchange/test",
method: "post",
data: null,
timeout: 30000
})
}