diff --git a/README.md b/README.md index b7c350f..631b546 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych. ## Instalacja -W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.29). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.30). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.43.30.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.43.30.sql new file mode 100644 index 0000000..d5b08a9 --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.43.30.sql @@ -0,0 +1 @@ +-- Wydanie 1.43.30: odczyt tokenów Gemini z pola usageMetadata. diff --git a/administrator/components/com_testquestions/src/Service/AiService.php b/administrator/components/com_testquestions/src/Service/AiService.php index 0104ca1..4dde040 100644 --- a/administrator/components/com_testquestions/src/Service/AiService.php +++ b/administrator/components/com_testquestions/src/Service/AiService.php @@ -147,7 +147,9 @@ class AiService private function getUsage(array $body, string $provider, string $model): ?array { - $usage = $body['usage'] ?? null; + // Gemini uses camelCase UsageMetadata at the response root; the + // OpenAI-compatible providers return their counters in `usage`. + $usage = $body['usageMetadata'] ?? $body['usage'] ?? null; if (!is_array($usage)) { return null; } diff --git a/com_testquestions.xml b/com_testquestions.xml index 4f4c1ca..6409028 100644 --- a/com_testquestions.xml +++ b/com_testquestions.xml @@ -4,7 +4,7 @@ 2026-10-14 Komponent GNU General Public License version 2 or later - 1.43.29 + 1.43.30 COM_TESTQUESTIONS_DESCRIPTION com_testquestions Komponent\Component\Testquestions