归纳总结病例

This commit is contained in:
wangjinlei
2025-09-02 10:17:21 +08:00
parent 4fe268d73e
commit d77f9ae56d
2 changed files with 57 additions and 0 deletions

View File

@@ -32,6 +32,39 @@ class Auto extends Base
} }
public function incaptar(){
$file = "D:/33.docx";
$cc = docxReader($file);
// echo $cc;die;
$ch = curl_init("http://chat.taimed.cn/v1/chat/completions");
$content = "阅读下面内容按照医生学者的标准总结。内容要求要有疾病诊断、主要症状、六经辨证、药方、思想应用。如果某些内容没有请留空。这些内容可能有多个比如患者多次求医的历史记录。都需要总结。不要带list符号药方无需讲药理直接列出多版本的需要分别列出。";
$content .= "内容开始:".$cc . " 内容结束";
$data = [
"model" => "llama3",
"messages" => [["role" => "user", "content" => $content]],
"stream" => false
];
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_WRITEFUNCTION, function ($ch, $data) {
echo $data; // 一边输出
return strlen($data);
});
curl_exec($ch);
curl_close($ch);
// return jsonSuccess($content);
}
public function ZQTest(){ public function ZQTest(){
$data = $this->request->post(); $data = $this->request->post();
$rule = new Validate([ $rule = new Validate([

View File

@@ -201,6 +201,30 @@ function proofState($article_id)
$p_article_obj->where('article_id', $article_id)->where('state', '<>', 1)->where('proof_etime', '<', time())->where('proof_state', 1)->update(['proof_state' => 2]); $p_article_obj->where('article_id', $article_id)->where('state', '<>', 1)->where('proof_etime', '<', time())->where('proof_state', 1)->update(['proof_state' => 2]);
} }
function docxReader($file){
$phpWord = IOFactory::load($file);
$content = '';
foreach ($phpWord->getSections() as $section) {
foreach ($section->getElements() as $element) {
if ($element instanceof \PhpOffice\PhpWord\Element\TextRun) {
foreach ($element->getElements() as $text) {
if ($text instanceof \PhpOffice\PhpWord\Element\Text) {
$content .= $text->getText();
}
}
$content .= ";";
}
elseif ($element instanceof \PhpOffice\PhpWord\Element\Text) {
$content .= $element->getText() . ";";
}
}
}
return $content;
}
function readWordImg($article_id,$file){ function readWordImg($article_id,$file){
$phpWord = IOFactory::load($file); $phpWord = IOFactory::load($file);