diff --git a/api/openapi.yaml b/api/openapi.yaml index 9e28a3f..226e8df 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -1760,6 +1760,12 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + '409': + description: AI 议价与固定规则改价配置冲突 + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' '500': description: 统一错误响应 content: @@ -1855,6 +1861,12 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + '409': + description: AI 议价与固定规则改价配置冲突 + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' '500': description: 统一错误响应 content: @@ -3389,6 +3401,12 @@ paths: operationId: postApiV1ItemsPublish summary: postApiV1ItemsPublish security: [{cookieAuth: []}] + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/ItemPublishRequest' responses: '200': description: 成功 @@ -4749,12 +4767,11 @@ paths: requestBody: required: true content: - multipart/form-data: + application/json: schema: - type: object - properties: - cookie_id: {type: string} - status: {type: string} + $ref: '#/components/schemas/OrderRefreshRequest' + multipart/form-data: + schema: {$ref: '#/components/schemas/OrderRefreshRequest'} responses: '202': description: 成功 @@ -6254,6 +6271,12 @@ paths: schema: type: string security: [{cookieAuth: []}] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AIReplySettingsUpdateRequest' responses: '200': description: 成功 @@ -6285,6 +6308,12 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + '409': + description: AI 议价与固定规则改价配置冲突 + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' '500': description: 统一错误响应 content: @@ -6907,14 +6936,25 @@ components: items: {$ref: '#/components/schemas/ItemReplyResponse'} AIReplySettingsResponse: type: object - required: [ai_enabled, max_discount_percent, max_discount_amount, max_bargain_rounds, custom_prompts] + required: [ai_enabled, auto_adjust_price_enabled, max_discount_percent, max_discount_amount, max_bargain_rounds, custom_prompts] properties: cookie_id: {type: string} ai_enabled: {type: boolean} + auto_adjust_price_enabled: {type: boolean} max_discount_percent: {type: integer} max_discount_amount: {type: integer} max_bargain_rounds: {type: integer} custom_prompts: {type: string} + AIReplySettingsUpdateRequest: + type: object + required: [ai_enabled, auto_adjust_price_enabled, max_discount_percent, max_discount_amount, max_bargain_rounds, custom_prompts] + properties: + ai_enabled: {type: boolean} + auto_adjust_price_enabled: {type: boolean} + max_discount_percent: {type: integer, minimum: 0, maximum: 100} + max_discount_amount: {type: integer, minimum: 0} + max_bargain_rounds: {type: integer, minimum: 1, maximum: 10} + custom_prompts: {type: string} AIReplySettingsMapResponse: type: object additionalProperties: @@ -6975,6 +7015,22 @@ components: poi_id: {type: string} poi_name: {type: string} province: {type: string} + ItemPublishRequest: + type: object + required: [cookie_id, title, description, price, original_price, quantity, postage_mode, postage, images] + properties: + cookie_id: {type: string} + title: {type: string} + description: {type: string} + price: {type: string} + original_price: {type: string} + quantity: {type: integer, minimum: 1} + postage_mode: {type: string} + postage: {type: string} + location: {type: string} + images: + type: array + items: {type: string, format: binary} ItemPublishBatchPreviewRow: type: object required: [row_no, valid, cookie_id, title, price, quantity, images, category, automation] @@ -7736,6 +7792,11 @@ components: chat_id: {type: string} system_shipped: {type: boolean} item_title: {type: string} + OrderRefreshRequest: + type: object + properties: + cookie_id: {type: string} + status: {type: string} OrderRefreshDetail: type: object required: [quantity, spec_name, spec_value, order_status, amount] diff --git a/frontend/app/features/accounts/api.ts b/frontend/app/features/accounts/api.ts index 258d844..5f966cc 100644 --- a/frontend/app/features/accounts/api.ts +++ b/frontend/app/features/accounts/api.ts @@ -338,12 +338,13 @@ export const updateAccountAISettings = async (cookieId: string, settings: Partia // payload 请求载荷,用于当前 API 处理流程。 const payload = { ai_enabled: settings.ai_enabled ?? false, + auto_adjust_price_enabled: settings.auto_adjust_price_enabled ?? false, max_discount_percent: settings.max_discount_percent ?? 10, max_discount_amount: settings.max_discount_amount ?? 100, max_bargain_rounds: settings.max_bargain_rounds ?? 3, custom_prompts: settings.custom_prompts ?? '' }; - return runContractRequest(/* signal 控制账号 AI 设置更新的取消和超时。 */ signal => contractClient.PUT('/api/v1/settings/ai-reply/{cookie_id}', { params: { path: { cookie_id: cookieId } }, body: payload as never, signal }), options); + return runContractRequest(/* signal 控制账号 AI 设置更新的取消和超时。 */ signal => contractClient.PUT('/api/v1/settings/ai-reply/{cookie_id}', { params: { path: { cookie_id: cookieId } }, body: payload, signal }), options); } diff --git a/frontend/app/features/accounts/components/AccountAISettingsModal.tsx b/frontend/app/features/accounts/components/AccountAISettingsModal.tsx index e65adad..53c66da 100644 --- a/frontend/app/features/accounts/components/AccountAISettingsModal.tsx +++ b/frontend/app/features/accounts/components/AccountAISettingsModal.tsx @@ -24,7 +24,12 @@ export const AccountAISettingsModal: React.FC = ({ // updateSettings 使用最新草稿合并单个 AI 字段变化。 const updateSettings = (patch: Partial) => onChange({ ...settings, ...patch }); // handleEnabledChange 切换 AI 自动回复开关。 - const handleEnabledChange = () => updateSettings({ ai_enabled: !settings.ai_enabled }); + const handleEnabledChange = () => updateSettings(settings.ai_enabled ? { ai_enabled: false, auto_adjust_price_enabled: false } : { ai_enabled: true }); + // handleAutoAdjustChange 切换真实订单自动改价开关,AI 议价关闭时不允许单独开启。 + const handleAutoAdjustChange = () => { + if (!settings.ai_enabled) return; + updateSettings({ auto_adjust_price_enabled: !settings.auto_adjust_price_enabled }); + }; // handleDiscountPercentChange 更新最大折扣比例。 const handleDiscountPercentChange = (event: React.ChangeEvent) => updateSettings({ max_discount_percent: parseInt(event.target.value, 10) || 0 }); // handleDiscountAmountChange 更新最大折扣金额。 @@ -53,6 +58,13 @@ export const AccountAISettingsModal: React.FC = ({ +
+
自动执行 AI 报价改价
AI 明确报价后,买家在 30 分钟内拍下对应商品时自动修改待付款订单价格。开启 AI 议价后,固定自动化规则改价将不能同时启用。
+ +
+

砍价策略

@@ -65,7 +77,7 @@ export const AccountAISettingsModal: React.FC = ({