|
@@ -88,6 +88,10 @@ function logSearch($keyword, $category_id, $dataset_id) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 示例调用
|
|
|
$token = 'dataset-Emh5R5hCGorTuqG0dkQe7tMf'; // 传入实际的 token
|
|
|
$datasets = 'c08ae7fa-c4e7-4fae-8138-2097ff19e1a6'; // 传入实际的 datasets ID
|
|
@@ -287,9 +291,18 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
|
|
|
$index++;
|
|
|
$content = $record['segment']['content'];
|
|
|
|
|
|
+
|
|
|
// 提取开头的数字
|
|
|
preg_match('/^\[(\d+)\]/', $content, $matches);
|
|
|
- $number = $matches[1] ?? null;
|
|
|
+ $postId = $matches[1] ?? null;
|
|
|
+
|
|
|
+
|
|
|
+ $postContent=null;
|
|
|
+ // 从数据库获取完整内容
|
|
|
+
|
|
|
+
|
|
|
+ $postContent = $postId ? getPost($postId) : null;
|
|
|
+
|
|
|
|
|
|
// 移除开头的数字部分
|
|
|
$contentWithoutNumber = preg_replace('/^\[\d+\]\s*/', '', $content);
|
|
@@ -338,6 +351,19 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
|
|
|
$question = trim($contentWithoutNumber);
|
|
|
$answer = ''; // 答案部分为空
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ if($postContent)
|
|
|
+ {
|
|
|
+
|
|
|
+ $answer=$postContent['text'];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
?>
|
|
|
|
|
|
<div class="uk-card uk-card-category uk-card-default uk-card-hover uk-card-body uk-inline uk-border-rounded uk-width-1-1">
|
|
@@ -346,7 +372,7 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
|
|
|
<!-- <span id="icon---><?php //= $index ?><!--" class="toggle-icon">▼</span>-->
|
|
|
|
|
|
</div>
|
|
|
- <div id="answer-<?= $index ?>" class="answer" style="display: none;">
|
|
|
+ <div id="answer-<?= $index ?>" class="answer" style="display: none;white-space: pre-line;">
|
|
|
<?= $answer ?>
|
|
|
</div>
|
|
|
</div>
|