feat(collect-channel): 专利与货源建单加「本单采集方式」单选框
执行方不再由全局开关定(后端 7469c710 起读 biz_file_task.collect_channel),
两个工具页建单时逐单选本机/线上,默认选中项取 /api/collect-routing 的模块默认。
- localCollectEnabled 改为从所选通道派生的 computed:启动分支、按钮文案、提示语
与建单入参同源,不再两处各判各的。
- 建完单即锁定单选框:通道在解析建单那一刻就写进任务行,事后再改只会被建单值覆盖,
界面会出现「选着线上、点启动却推本机」的假象。
- 货源查询 Tab 原本两条提示语都在讲「后台自动分批检测」(本机分支文案写错),
随本次一并改正。
- parse API 的 collect_channel 为可选参数:不传就不带这个键,服务端按模块默认兜,
新增两条用例把「传/不传」两种载荷形状钉住。
This commit is contained in:
@@ -5,6 +5,7 @@ import { getJavaDownloadUrl } from '../../download-url.ts'
|
||||
import { getTaskProgressCacheTtlMs, getTaskProgressTimeoutMs } from '../../../task-progress-config.ts'
|
||||
import { createTaskProgressRequestCache } from '../../../task-progress-request-cache.ts'
|
||||
import type { UploadedFileRef } from '../upload.ts'
|
||||
import type { CollectChannel } from './collect-routing.ts'
|
||||
import { API_ENDPOINTS } from '../../endpoints.ts'
|
||||
|
||||
export interface AppearancePatentParsedRow {
|
||||
@@ -176,16 +177,29 @@ async function postTaskProgressBatch<T>(
|
||||
return requestPromise;
|
||||
}
|
||||
|
||||
export function parseAppearancePatent(files: UploadedFileRef[], aiPrompt: string, apiKey?: string) {
|
||||
export function parseAppearancePatent(
|
||||
files: UploadedFileRef[],
|
||||
aiPrompt: string,
|
||||
apiKey?: string,
|
||||
collectChannel?: CollectChannel,
|
||||
) {
|
||||
return unwrapJavaResponse(
|
||||
post<
|
||||
JavaApiResponse<AppearancePatentParseVo>,
|
||||
{ user_id: number; files: UploadedFileRef[]; ai_prompt: string; api_key?: string }
|
||||
{
|
||||
user_id: number;
|
||||
files: UploadedFileRef[];
|
||||
ai_prompt: string;
|
||||
api_key?: string;
|
||||
collect_channel?: CollectChannel;
|
||||
}
|
||||
>(buildJavaUrl(API_ENDPOINTS.appearancePatent.parse), {
|
||||
user_id: getCurrentUserId(),
|
||||
files,
|
||||
ai_prompt: aiPrompt,
|
||||
api_key: apiKey,
|
||||
// 不传就不带这个键:服务端按「未登记通道」兜到模块默认,未升级前端的行为一字不变
|
||||
...(collectChannel ? { collect_channel: collectChannel } : {}),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,17 @@ import { buildJavaUrl } from '../../url.ts'
|
||||
import { API_ENDPOINTS } from '../../endpoints.ts'
|
||||
|
||||
/**
|
||||
* 专利/货源的本地采集开关(服务端唯一真源,前端只读)。
|
||||
* 这一单的采集执行通道:本机客户端采(LOCAL)还是 Linux/外机 Windows 采(ONLINE)。
|
||||
* 建单时随 `/parse` 的 `collect_channel` 交服务端(V183 `biz_file_task.collect_channel`)。
|
||||
*/
|
||||
export type CollectChannel = 'LOCAL' | 'ONLINE';
|
||||
|
||||
/**
|
||||
* 各模块「这一单没登记通道」时的默认执行方(服务端真源,前端只读)。
|
||||
*
|
||||
* 开着=页面把任务推本机客户端队列;关着=只建单、等 Linux 后台认领。
|
||||
* 每次进页面现取,不做模块级缓存:运维改开关后用户刷新页面就该看到新口径,
|
||||
* 2026-10-31 起执行方由建单时的单选框逐单决定,本接口只用来决定单选框默认选中哪一项:
|
||||
* true=默认本机(页面把任务推本机客户端队列),false=默认线上(只建单,等 Linux 后台认领)。
|
||||
* 每次进页面现取,不做模块级缓存:运维改默认后用户刷新页面就该看到新口径,
|
||||
* 一次小 GET 不值得换一个「改了没生效」的排查成本。
|
||||
*/
|
||||
export interface CollectRoutingVo {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { getJavaDownloadUrl } from '../../download-url.ts'
|
||||
import { getTaskProgressCacheTtlMs, getTaskProgressTimeoutMs } from '../../../task-progress-config.ts'
|
||||
import { createTaskProgressRequestCache } from '../../../task-progress-request-cache.ts'
|
||||
import type { UploadedFileRef } from '../upload.ts'
|
||||
import type { CollectChannel } from './collect-routing.ts'
|
||||
import { API_ENDPOINTS } from '../../endpoints.ts'
|
||||
|
||||
export interface SimilarAsinParsedRow {
|
||||
@@ -173,6 +174,7 @@ export function parseSimilarAsin(
|
||||
apiKey?: string,
|
||||
imgSwitch = false,
|
||||
categorySwitch = false,
|
||||
collectChannel?: CollectChannel,
|
||||
) {
|
||||
return unwrapJavaResponse(
|
||||
post<
|
||||
@@ -183,6 +185,7 @@ export function parseSimilarAsin(
|
||||
api_key?: string;
|
||||
img_switch: boolean;
|
||||
category_switch: boolean;
|
||||
collect_channel?: CollectChannel;
|
||||
}
|
||||
>(buildJavaUrl(API_ENDPOINTS.similarAsin.parse), {
|
||||
user_id: getCurrentUserId(),
|
||||
@@ -190,6 +193,8 @@ export function parseSimilarAsin(
|
||||
api_key: apiKey,
|
||||
img_switch: imgSwitch,
|
||||
category_switch: categorySwitch,
|
||||
// 不传就不带这个键:服务端按「未登记通道」兜到模块默认,未升级前端的行为一字不变
|
||||
...(collectChannel ? { collect_channel: collectChannel } : {}),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user