-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ci/static-check
- Loading branch information
Showing
119 changed files
with
4,398 additions
and
1,188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,12 +20,12 @@ jobs: | |
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y pip wget | ||
sudo pip install --upgrade pip | ||
sudo pip install --upgrade pip | ||
pip install huggingface_hub | ||
- name: 'Setup yq' | ||
uses: dcarbone/[email protected] | ||
with: | ||
version: 'v4.43.1' | ||
version: 'v4.44.2' | ||
download-compressed: true | ||
force: true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Comment PRs | ||
on: | ||
pull_request_target: | ||
|
||
jobs: | ||
comment-pr: | ||
env: | ||
MODEL_NAME: hermes-2-theta-llama-3-8b | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: "${{ github.event.pull_request.merge_commit_sha }}" | ||
- uses: mudler/localai-github-action@v1 | ||
with: | ||
model: 'hermes-2-theta-llama-3-8b' # Any from models.localai.io, or from huggingface.com with: "huggingface://<repository>/file" | ||
# Check the PR diff using the current branch and the base branch of the PR | ||
- uses: GrantBirki/[email protected] | ||
id: git-diff-action | ||
with: | ||
json_diff_file_output: diff.json | ||
raw_diff_file_output: diff.txt | ||
file_output_only: "true" | ||
- name: Show diff | ||
env: | ||
DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }} | ||
run: | | ||
cat $DIFF | ||
- name: Summarize | ||
env: | ||
DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }} | ||
id: summarize | ||
run: | | ||
input="$(cat $DIFF)" | ||
# Define the LocalAI API endpoint | ||
API_URL="http://localhost:8080/chat/completions" | ||
# Create a JSON payload using jq to handle special characters | ||
json_payload=$(jq -n --arg input "$input" '{ | ||
model: "'$MODEL_NAME'", | ||
messages: [ | ||
{ | ||
role: "system", | ||
content: "You are LocalAI-bot in Github that helps understanding PRs and assess complexity. Explain what has changed in this PR diff and why" | ||
}, | ||
{ | ||
role: "user", | ||
content: $input | ||
} | ||
] | ||
}') | ||
# Send the request to LocalAI | ||
response=$(curl -s -X POST $API_URL \ | ||
-H "Content-Type: application/json" \ | ||
-d "$json_payload") | ||
# Extract the summary from the response | ||
summary="$(echo $response | jq -r '.choices[0].message.content')" | ||
# Print the summary | ||
# -H "Authorization: Bearer $API_KEY" \ | ||
echo "Summary:" | ||
echo "$summary" | ||
echo "payload sent" | ||
echo "$json_payload" | ||
{ | ||
echo 'message<<EOF' | ||
echo "$summary" | ||
echo EOF | ||
} >> "$GITHUB_OUTPUT" | ||
docker logs --tail 10 local-ai | ||
- uses: mshick/add-pr-comment@v2 | ||
if: always() | ||
with: | ||
repo-token: ${{ secrets.UPDATE_BOT_TOKEN }} | ||
message: ${{ steps.summarize.outputs.message }} | ||
message-failure: | | ||
Uh oh! Could not analyze this PR, maybe it's too big? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,10 @@ jobs: | |
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # needed to checkout all branches for this Action to work | ||
- name: Start LocalAI | ||
run: | | ||
echo "Starting LocalAI..." | ||
docker run -e -ti -d --name local-ai -p 8080:8080 localai/localai:master-ffmpeg-core run --debug $MODEL_NAME | ||
until [ "`docker inspect -f {{.State.Health.Status}} local-ai`" == "healthy" ]; do echo "Waiting for container to be ready"; docker logs --tail 10 local-ai; sleep 2; done | ||
# Check the PR diff using the current branch and the base branch of the PR | ||
- uses: mudler/localai-github-action@v1 | ||
with: | ||
model: 'hermes-2-theta-llama-3-8b' # Any from models.localai.io, or from huggingface.com with: "huggingface://<repository>/file" | ||
# Check the PR diff using the current branch and the base branch of the PR | ||
- uses: GrantBirki/[email protected] | ||
id: git-diff-action | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.