GuXiaopeng commited on
Commit
b7dfb4d
·
verified ·
1 Parent(s): 5ec7357

Update core/pipeline_agent.py

Browse files
Files changed (1) hide show
  1. core/pipeline_agent.py +0 -29
core/pipeline_agent.py CHANGED
@@ -98,35 +98,6 @@ class SSciPipelineAgent:
98
  sys_prompt = f"Translate the following text into {target_lang}. Preserve all formatting, line breaks, and [CITE-XX] tags exactly. Output ONLY the translation."
99
  return self.call_deepseek(sys_prompt, text, max_tokens=max_tokens, temp=0.2, model_name="deepseek-chat")
100
 
101
- def _is_empirical_business_research(self, topic, keywords):
102
- combined_text = f"{topic} {keywords}".lower()
103
- empirical_strong_keywords = ["实证", "问卷", "定量", "量表", "empirical", "sem", "pls", "回归", "中介", "调节", "假设检验"]
104
- if any(kw in combined_text for kw in empirical_strong_keywords):
105
- st.success("🎯 规则拦截:命中强显式实证关键字,强制启用 AMJ 顶级期刊写作风格引擎。")
106
- return True
107
-
108
- sys_prompt = "You are an expert academic classifier. Your task is to determine if a given research topic falls into the category of 'empirical business/management research'."
109
- user_prompt = f"""
110
- Research Topic: {topic}
111
- Keywords: {keywords}
112
- Based on the topic and keywords, answer ONLY with a JSON object: {{"is_empirical": true/false, "reason": "brief justification"}}.
113
- """
114
- try:
115
- response = self.call_deepseek(sys_prompt, user_prompt, max_tokens=100, temp=0.1)
116
- json_match = re.search(r'\{.*\}', response, re.DOTALL)
117
- if json_match:
118
- result = json.loads(json_match.group(0))
119
- is_empirical = result.get("is_empirical", False)
120
- reason = result.get("reason", "")
121
- if is_empirical:
122
- st.success(f"🎯 LLM嗅探:识别为工商管理实证研究,启用 AMJ 写作引擎。理由:{reason}")
123
- else:
124
- st.info(f"ℹ️ LLM嗅探:未识别为实证研究,采用通用学术规范引擎。理由:{reason}")
125
- return is_empirical
126
- return False
127
- except Exception:
128
- return False
129
-
130
  @retry(stop=stop_after_attempt(3), wait=wait_random_exponential(multiplier=1, max=10), retry=retry_if_exception_type((requests.exceptions.Timeout, requests.exceptions.ConnectionError, requests.exceptions.HTTPError)))
131
  def _requests_get_with_retry(self, url, headers=None, params=None, timeout=15):
132
  resp = requests.get(url, headers=headers, params=params, timeout=timeout)
 
98
  sys_prompt = f"Translate the following text into {target_lang}. Preserve all formatting, line breaks, and [CITE-XX] tags exactly. Output ONLY the translation."
99
  return self.call_deepseek(sys_prompt, text, max_tokens=max_tokens, temp=0.2, model_name="deepseek-chat")
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  @retry(stop=stop_after_attempt(3), wait=wait_random_exponential(multiplier=1, max=10), retry=retry_if_exception_type((requests.exceptions.Timeout, requests.exceptions.ConnectionError, requests.exceptions.HTTPError)))
102
  def _requests_get_with_retry(self, url, headers=None, params=None, timeout=15):
103
  resp = requests.get(url, headers=headers, params=params, timeout=timeout)