Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangjinlei
2026-06-08 17:19:04 +08:00
9 changed files with 342 additions and 13 deletions

View File

@@ -989,9 +989,14 @@ class AuthorBackgroundService
}
$papers = $this->pubmedFetchSummaries($ids);
}
$urlTerm = $usedTerm;
if (preg_match('/^(.+)\[ORCID\]$/i', $usedTerm, $m)) {
$urlTerm = $m[1];
}
return [
'total' => $total, 'papers' => $papers, 'query' => $usedTerm,
'pubmed_url' => 'https://pubmed.ncbi.nlm.nih.gov/?term=' . urlencode($usedTerm),
'pubmed_url' => 'https://pubmed.ncbi.nlm.nih.gov/?term=' . urlencode($urlTerm),
];
}

View File

@@ -120,6 +120,35 @@ class LLMService
];
}
/**
* 通用对话请求(与参考文献校对共用 postChat / [promotion] 配置)
*
* @param array $messages OpenAI messages
* @param float $temperature
* @return string|null 助手回复正文
*/
public function requestChat(array $messages, $temperature = 0)
{
if ($this->url === '' || $this->model === '') {
\think\Log::warning('LLM requestChat: url or model not configured');
return null;
}
$payload = [
'model' => $this->model,
'temperature' => $temperature,
'messages' => $messages,
];
return $this->postChat($payload);
}
/**
* 解析模型返回的 JSON 对象(去除 markdown 代码块等)
*/
public function parseJsonResponse($raw)
{
return $this->parseJson($raw);
}
/**
* 解析 can_support兼容 is_match 字段
*/