Skip to content
Open

Test #24

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
17 changes: 12 additions & 5 deletions .github/workflows/ai_code_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,29 @@ jobs:
code_review:
runs-on: ubuntu-latest
name: AI Code Review
outputs:
git_diff: ${{ steps.git_diff.outputs.diff }}
steps:
- name: Checkout Code
uses: actions/checkout@v4.1.2
with:
fetch-depth: 0

- name: List directory contents
run: ls -la
- name: Fetch main branch
run: git fetch origin master:master

- name: Print working directory
run: echo "The working directory is $GITHUB_WORKSPACE"
# This step is optional and for debugging purposes.
- name: Generate Git Diff
id: git_diff
run: |
git diff -U20 master...HEAD > diff.txt
# Base64 encode the diff to safely handle new lines
DIFF_OUTPUT=$(base64 -w 0 diff.txt)
echo "diff=$DIFF_OUTPUT" >> $GITHUB_OUTPUT

- name: AI Code Review
uses: seandearnaley/ai-code-reviewer@v1
with:
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
git_diff: ${{ steps.git_diff.outputs.diff }}
2 changes: 1 addition & 1 deletion app/data_types/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RedditData(TypedDict):


class GenerateSettings(TypedDict):
"""Settings for generating a summary ds."""
"""Settings for generating a summary."""

query: str
chunk_token_length: int
Expand Down
11 changes: 10 additions & 1 deletion app/services/openai_connector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""OpenAI Connector."""

import os
import openai
from config import OPEN_AI_CHAT_TYPE, ConfigVars
from data_types.summary import GenerateSettings
Expand Down Expand Up @@ -73,5 +73,14 @@ def complete_openai_text(

except openai.OpenAIError as err:
return f"OpenAI Error: {err}"









except ValueError as err:
return f"Value error: {err}"