From 5810b15940ae72408529deffafe6e861bf93ca94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Sun, 22 Feb 2026 23:26:33 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[additional]=20Notion=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20=ED=86=A0=ED=81=B0=20=EC=82=AC=EC=9A=A9=EB=9F=89=20?= =?UTF-8?q?=EA=B8=B0=EB=A1=9D=20=EB=B0=8F=20=EB=B9=84=EC=9A=A9=20=EC=95=88?= =?UTF-8?q?=EB=82=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 검색어 정제/AI 답변 시 AiTokenHelper로 토큰 사용량 저장 - 상단 안내에 Gemini API 2회 호출 및 토큰 기록 안내 추가 --- app/Services/NotionService.php | 5 +++++ .../views/additional/notion-search/index.blade.php | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/Services/NotionService.php b/app/Services/NotionService.php index 0f7d3377..2a13bdee 100644 --- a/app/Services/NotionService.php +++ b/app/Services/NotionService.php @@ -2,6 +2,7 @@ namespace App\Services; +use App\Helpers\AiTokenHelper; use App\Models\System\AiConfig; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; @@ -151,6 +152,8 @@ public function searchWithAi(string $userMessage, array $history = []): array ]; } + AiTokenHelper::saveGeminiUsage($response->json(), $geminiModel, 'Notion 검색 > AI 답변'); + $reply = $response->json('candidates.0.content.parts.0.text') ?? '죄송합니다. 답변을 생성하지 못했습니다.'; @@ -189,6 +192,8 @@ private function refineQuery(string $userMessage, string $historyText, string $b ); if ($response->successful()) { + AiTokenHelper::saveGeminiUsage($response->json(), $model, 'Notion 검색 > 검색어 정제'); + $refined = $response->json('candidates.0.content.parts.0.text'); if ($refined) { return trim($refined); diff --git a/resources/views/additional/notion-search/index.blade.php b/resources/views/additional/notion-search/index.blade.php index 3ab2d0bf..5faf75ae 100644 --- a/resources/views/additional/notion-search/index.blade.php +++ b/resources/views/additional/notion-search/index.blade.php @@ -167,9 +167,14 @@ className={`underline font-medium break-all ${isUser ? 'text-blue-200 hover:text

Notion 검색

Notion 문서에서 검색하고 AI가 답변합니다

-
- - 실시간 검색 — 검색할 때마다 Notion API를 직접 호출합니다 +
+ + + 실시간 검색 — 검색할 때마다 Notion API를 직접 호출합니다 + + + 검색 1회당 Gemini API 2회 호출 (검색어 정제 + AI 답변) · 토큰 사용량 자동 기록 +