From 5fb21093a7b2f60b4ca2c683c524a8d5e5e12192 Mon Sep 17 00:00:00 2001 From: Aykut Yalcin Date: Mon, 31 Aug 2026 10:21:00 +0200 Subject: [PATCH 1/2] update ai model on release notes generation --- .github/workflows/generate.yml | 1 + src/Command/GenerateCommitMessage.php | 4 +++- src/Command/GenerateReleaseNotes.php | 8 +++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index f5db9c3..fe8e175 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -63,6 +63,7 @@ jobs: env: GH_TOKEN: ${{ secrets.MACHINE_USER_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + OPENAI_MODEL: ${{ vars.OPENAI_MODEL }} run: | set -ex diff --git a/src/Command/GenerateCommitMessage.php b/src/Command/GenerateCommitMessage.php index 08b30a5..09d4482 100644 --- a/src/Command/GenerateCommitMessage.php +++ b/src/Command/GenerateCommitMessage.php @@ -10,6 +10,8 @@ class GenerateCommitMessage extends Command { + public const DefaultModel = 'gpt-oss-120b'; + private OpenAI\Client $client; protected function configure() @@ -46,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $result = $this->client->chat()->create([ - 'model' => getenv('OPENAI_MODEL') ?: 'gpt-4o-mini', + 'model' => getenv('OPENAI_MODEL') ?: self::DefaultModel, 'messages' => [ ['role' => 'system', 'content' => 'You will be provided a Git diff. Generate a commit message from it, following the conventional commit message format. Provide the output in plain text, without any additional formatting.'], ['role' => 'user', 'content' => $diff], diff --git a/src/Command/GenerateReleaseNotes.php b/src/Command/GenerateReleaseNotes.php index 9eb96e4..de4955e 100644 --- a/src/Command/GenerateReleaseNotes.php +++ b/src/Command/GenerateReleaseNotes.php @@ -29,11 +29,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $diff = substr($diff, 0, 256 * 1024); } - $yourApiKey = getenv('OPENAI_API_KEY'); - $client = OpenAI::client($yourApiKey); + $client = (new OpenAI\Factory) + ->withBaseUri(getenv('OPENAI_BASE_URL') ?: 'https://llm.aihosting.mittwald.de/v1') + ->withApiKey(getenv('OPENAI_API_KEY')) + ->make(); $result = $client->chat()->create([ - 'model' => 'gpt-4o-mini', + 'model' => getenv('OPENAI_MODEL') ?: GenerateCommitMessage::DefaultModel, 'messages' => [ ['role' => 'system', 'content' => 'You will be provided a Git diff. Generate a Github release notes document, in markdown format. Your response should include ONLY the release notes without any additional start or end markers. Do not include a generic heading or date information; start any intermediate headings at the h2 level. When features are added, also include a high-level summary of said features.'], ['role' => 'user', 'content' => $diff], From 393a81e5fc2d6e9965ba622310c07c59308ede9a Mon Sep 17 00:00:00 2001 From: Aykut Yalcin Date: Mon, 31 Aug 2026 10:23:37 +0200 Subject: [PATCH 2/2] secretvar --- .github/workflows/generate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index fe8e175..359060e 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -63,7 +63,7 @@ jobs: env: GH_TOKEN: ${{ secrets.MACHINE_USER_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - OPENAI_MODEL: ${{ vars.OPENAI_MODEL }} + OPENAI_MODEL: ${{ secrets.OPENAI_MODEL }} run: | set -ex