归纳总结病例
This commit is contained in:
@@ -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(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
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){
|
||||
$phpWord = IOFactory::load($file);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user