mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
feat: 请求体规则扩展(append/insert/regex_replace)、OAuth 代理节点支持与列表分页
- 请求体规则新增 append、insert、regex_replace 三种操作,路径语法支持数组索引 - OAuth 授权/导入/批量导入支持指定代理节点(proxy_node_id),Key 级代理避免 IP 污染 - 密钥列表、模型映射、模型列表添加智能分页(useSmartPagination) - AdvancedGuide 新增请求体规则使用指南与示例 - 简化 Codex enrich_codex 实现,README 添加 QQ 群二维码
This commit is contained in:
@@ -208,10 +208,12 @@ export interface BatchImportResult {
|
||||
|
||||
export async function batchImportOAuth(
|
||||
providerId: string,
|
||||
credentials: string
|
||||
credentials: string,
|
||||
proxyNodeId?: string
|
||||
): Promise<BatchImportResult> {
|
||||
const response = await client.post(`/api/admin/provider-oauth/providers/${providerId}/batch-import`, {
|
||||
credentials,
|
||||
proxy_node_id: proxyNodeId || undefined,
|
||||
})
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface ProviderOAuthStartResponse {
|
||||
export interface ProviderOAuthCompleteRequest {
|
||||
callback_url: string
|
||||
name?: string
|
||||
proxy_node_id?: string
|
||||
}
|
||||
|
||||
export interface ProviderOAuthCompleteResponse {
|
||||
@@ -49,7 +50,7 @@ export async function completeProviderLevelOAuth(
|
||||
|
||||
export async function importProviderRefreshToken(
|
||||
providerId: string,
|
||||
data: { refresh_token: string; name?: string }
|
||||
data: { refresh_token: string; name?: string; proxy_node_id?: string }
|
||||
): Promise<ProviderOAuthCompleteResponseWithKey> {
|
||||
const resp = await client.post(`/api/admin/provider-oauth/providers/${providerId}/import-refresh-token`, data)
|
||||
return resp.data
|
||||
|
||||
@@ -159,7 +159,51 @@ export interface BodyRuleRename {
|
||||
to: string
|
||||
}
|
||||
|
||||
export type BodyRule = BodyRuleSet | BodyRuleDrop | BodyRuleRename
|
||||
/**
|
||||
* 请求体规则 - 向数组追加元素
|
||||
*
|
||||
* - path 指向目标数组,如 "messages"
|
||||
* - value 为要追加的元素
|
||||
*/
|
||||
export interface BodyRuleAppend {
|
||||
action: 'append'
|
||||
path: string
|
||||
value: any
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求体规则 - 在数组指定位置插入元素
|
||||
*
|
||||
* - path 指向目标数组,如 "messages"
|
||||
* - index 为插入位置(支持负数)
|
||||
* - value 为要插入的元素
|
||||
*/
|
||||
export interface BodyRuleInsert {
|
||||
action: 'insert'
|
||||
path: string
|
||||
index: number
|
||||
value: any
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求体规则 - 正则替换字符串值
|
||||
*
|
||||
* - path 指向目标字符串字段,如 "messages[0].content"
|
||||
* - pattern 为正则表达式
|
||||
* - replacement 为替换字符串
|
||||
* - flags 可选,支持 i(忽略大小写)/m(多行)/s(dotall)
|
||||
* - count 替换次数,0=全部替换(默认)
|
||||
*/
|
||||
export interface BodyRuleRegexReplace {
|
||||
action: 'regex_replace'
|
||||
path: string
|
||||
pattern: string
|
||||
replacement: string
|
||||
flags?: string
|
||||
count?: number
|
||||
}
|
||||
|
||||
export type BodyRule = BodyRuleSet | BodyRuleDrop | BodyRuleRename | BodyRuleAppend | BodyRuleInsert | BodyRuleRegexReplace
|
||||
|
||||
/**
|
||||
* 格式接受策略配置
|
||||
|
||||
Reference in New Issue
Block a user