mirror of
https://github.com/primedigitaltech/market-assistant.git
synced 2026-07-22 08:01:34 +08:00
feat: default LLM for report regen, job report_config, and API defaults
Made-with: Cursor
This commit is contained in:
parent
48ed337310
commit
134faffbe8
@ -168,11 +168,11 @@ def get_default_report_config() -> dict[str, Any]:
|
||||
"""与 ``jd_competitor_report`` 模块常量一致的默认报告调参(供前端回填)。"""
|
||||
jcr, _ = _jd_crawler_modules()
|
||||
return {
|
||||
"llm_comment_sentiment": False,
|
||||
"llm_section_bridges": False,
|
||||
"llm_matrix_group_summaries": False,
|
||||
"llm_comment_group_summaries": False,
|
||||
"llm_price_group_summaries": False,
|
||||
"llm_comment_sentiment": True,
|
||||
"llm_section_bridges": True,
|
||||
"llm_matrix_group_summaries": True,
|
||||
"llm_comment_group_summaries": True,
|
||||
"llm_price_group_summaries": True,
|
||||
"comment_focus_words": list(jcr.COMMENT_FOCUS_WORDS),
|
||||
"comment_scenario_groups": [
|
||||
{"label": lbl, "triggers": list(trs)}
|
||||
|
||||
@ -144,6 +144,11 @@ class JobListCreateView(APIView):
|
||||
ser = CreatePipelineJobSerializer(data=request.data)
|
||||
ser.is_valid(raise_exception=True)
|
||||
data = ser.validated_data
|
||||
raw_rc = data.get("report_config")
|
||||
if not isinstance(raw_rc, dict) or raw_rc == {}:
|
||||
report_config_initial = get_default_report_config()
|
||||
else:
|
||||
report_config_initial = raw_rc
|
||||
job = PipelineJob.objects.create(
|
||||
platform=data["platform"],
|
||||
keyword=data["keyword"],
|
||||
@ -157,7 +162,7 @@ class JobListCreateView(APIView):
|
||||
request_delay=data.get("request_delay") or "",
|
||||
list_pages=data.get("list_pages") or "",
|
||||
scenario_filter_enabled=data.get("scenario_filter_enabled"),
|
||||
report_config=data.get("report_config") or {},
|
||||
report_config=report_config_initial,
|
||||
status=JobStatus.PENDING,
|
||||
)
|
||||
t = threading.Thread(target=execute_job, args=(job.id,), daemon=True)
|
||||
|
||||
@ -11,6 +11,8 @@ import { useReportConfigForm } from '../../composables/useReportConfigForm'
|
||||
|
||||
const { jobs } = useJobs()
|
||||
const selectedId = ref('')
|
||||
/** 勾选则本次重新生成不走整篇大模型合并(仍先跑规则引擎落盘) */
|
||||
const useRulesOnly = ref(false)
|
||||
const regenErr = ref('')
|
||||
const genInFlight = generationInFlightKey()
|
||||
const REGEN_PREFIX = 'regenerate-report:'
|
||||
@ -156,7 +158,9 @@ async function regenerateReport() {
|
||||
try {
|
||||
const r = await api(`/api/jobs/${id}/regenerate-report/`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ generator: 'rules' }),
|
||||
body: JSON.stringify({
|
||||
generator: useRulesOnly.value ? 'rules' : 'llm',
|
||||
}),
|
||||
})
|
||||
const text = await r.text()
|
||||
if (!r.ok) {
|
||||
@ -210,12 +214,18 @@ watch(
|
||||
<section class="ma-card">
|
||||
<h2>分析报告生成</h2>
|
||||
<p class="hint-top">
|
||||
选择<strong>已成功</strong>的任务,调整下方统计规则后点「保存以上设置」,再点「重新生成报告」。本页<strong>始终按规则引擎</strong>更新
|
||||
<code>competitor_analysis.md</code>(统计图与表格),不重新爬取。若需大模型整篇稿或 §8.2 等开关,请用「高级 JSON」写入对应字段后保存,或通过 API 调用。
|
||||
选择<strong>已成功</strong>的任务,调整下方统计规则后点「保存以上设置」,再点「重新生成报告」。默认<strong>先规则引擎</strong>写出统计稿,再<strong>合并大模型补充</strong>(需网关与密钥);不重新爬取。各章评价解读等开关由「填入推荐示例」或「高级 JSON」中的
|
||||
<code>llm_*</code> 字段控制。
|
||||
阅读与下载请至
|
||||
<RouterLink to="/jd/analysis-view">报告查看</RouterLink>。
|
||||
</p>
|
||||
|
||||
<div class="toolbar">
|
||||
<label class="chk-inline chk-rules-only">
|
||||
<input v-model="useRulesOnly" type="checkbox" />
|
||||
本次仅用规则引擎(跳过整篇大模型合并,更快、不调 LLM 全文接口)
|
||||
</label>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<label class="sel-label">任务</label>
|
||||
<select v-model="selectedId" class="job-select">
|
||||
@ -280,8 +290,8 @@ watch(
|
||||
<p class="rc-help">
|
||||
打开时会根据上面表单生成内容;改完后点「写回表单」再保存。可在此加入
|
||||
<code>llm_comment_sentiment</code>、<code>llm_section_bridges</code>、<code>llm_matrix_group_summaries</code>
|
||||
等布尔字段(须为 <code>true</code>/<code>false</code>)。重新生成整篇大模型稿需调接口
|
||||
<code>POST …/regenerate-report/</code> 且 body 含 <code>"generator":"llm"</code>。
|
||||
等布尔字段(须为 <code>true</code>/<code>false</code>)。页顶「重新生成报告」默认已使用
|
||||
<code>generator:"llm"</code>;若只要规则稿请勾选「本次仅用规则引擎」。
|
||||
</p>
|
||||
<textarea v-model="advancedJsonText" class="report-config-editor" rows="10" spellcheck="false" />
|
||||
<button type="button" class="ma-btn ma-btn-secondary rc-add" @click="applyAdvancedJsonToForm">将 JSON 写回表单</button>
|
||||
@ -319,6 +329,10 @@ watch(
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.chk-rules-only {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
.chk-inline {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user