Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.MACHINE_USER_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_MODEL: ${{ secrets.OPENAI_MODEL }}
run: |
set -ex

Expand Down
4 changes: 3 additions & 1 deletion src/Command/GenerateCommitMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

class GenerateCommitMessage extends Command
{
public const DefaultModel = 'gpt-oss-120b';

private OpenAI\Client $client;

protected function configure()
Expand Down Expand Up @@ -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],
Expand Down
8 changes: 5 additions & 3 deletions src/Command/GenerateReleaseNotes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Loading