Skip to content

Commit

Permalink
allow passing custom settings to chatgpt api
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Jan 12, 2025
1 parent 88b3028 commit 4e3c508
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/_shared-run-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,12 @@ jobs:
chatgpt_url="https://api.openai.com/v1/chat/completions"
chatgpt_model="gpt-4-turbo-preview"
chatgpt_extra_cfg=""
if [ "$chatgpt_config" != "true" ]; then
chatgpt_url=$(echo "$chatgpt_config" | jq -r ".url // \"$chatgpt_url\"")
chatgpt_model=$(echo "$chatgpt_config" | jq -r ".model // \"$chatgpt_model\"")
chatgpt_extra_cfg=$(echo "$chatgpt_config" | jq -c ".extra_cfg // {}")
fi
touch ./temp/chatgpt_query.txt
Expand Down Expand Up @@ -345,6 +347,8 @@ jobs:
EOF
)
query_json=$(echo "$query_json" | jq -c ".+=${chatgpt_extra_cfg}")
result=$(curl $chatgpt_url \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CHATGPT_KEY" \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
config: ${{ fromJson(needs.get_tests.outputs.test_configs) }}
with:
config: ${{ toJSON(matrix.config) }}
use_chatgpt: '{"url": "${{ vars.CHATGPT_URL }}", "model": "${{ vars.CHATGPT_MODEL }}"}'
use_chatgpt: '{"url": "${{ vars.CHATGPT_URL }}", "model": "${{ vars.CHATGPT_MODEL }}", "extra_cfg": ${{ vars.CHATGPT_EXTRA_CFG }}}'
secrets:
RANCHER_URL: ${{ secrets.RANCHER_URL }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
with:
config: ${{ toJSON(matrix.config) }}
send_notification: "true"
use_chatgpt: '{"url": "${{ vars.CHATGPT_URL }}", "model": "${{ vars.CHATGPT_MODEL }}"}'
use_chatgpt: '{"url": "${{ vars.CHATGPT_URL }}", "model": "${{ vars.CHATGPT_MODEL }}", "extra_cfg": ${{ vars.CHATGPT_EXTRA_CFG }}}'
secrets:
RANCHER_URL: ${{ secrets.RANCHER_URL }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
Expand Down

0 comments on commit 4e3c508

Please sign in to comment.