Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler committed Jul 3, 2024
1 parent 38400f3 commit 5d0f738
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/notify-models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ on:

jobs:
notify-discord:
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'area/ai-model')) }}
# if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'area/ai-model')) }}
env:
MODEL_NAME: hermes-2-theta-llama-3-8b
runs-on: ubuntu-latest
steps:
- 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:latest-aio-cpu run --debug $MODEL_NAME
until [ "`docker inspect -f {{.State.Health.Status}} local-ai`"=="healthy" ]; do
echo "Waiting for container to be ready"
sleep 2;
done;
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: GrantBirki/[email protected]
id: git-diff-action
Expand All @@ -32,18 +32,18 @@ jobs:
id: summarize
run: |
# Read the content of file.txt
input="$DIFF"
input="$(cat $DIFF)"
# Define the OpenAI 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",
model: "'$MODEL_NAME'",
messages: [
{
role: "system",
content: "Write a discord message to notify everyone about the new model."
content: "Write a discord message to notify everyone about the new model from the git diff. Make it informal. An example can include: the URL of the model, the name, and a brief description of the model if exists."
},
{
role: "user",
Expand All @@ -58,13 +58,20 @@ jobs:
-d "$json_payload")
# Extract the summary from the response
summary=$(echo $response | jq -r '.choices[0].message.content')
summary="$(echo $response | jq -r '.choices[0].message.content')"
# Print the summary
# -H "Authorization: Bearer $API_KEY" \
echo "Summary:"
echo "$summary"
echo "message=$summary\n" >> $GITHUB_OUTPUT
echo "payload sent"
echo "$json_payload"
{
echo 'message<<EOF'
echo $summary
echo EOF
} >> "$GITHUB_OUTPUT"
docker logs --tail 10 local-ai
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/notify-releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ jobs:
- name: Start LocalAI
run: |
echo "Starting LocalAI..."
docker run -e -ti -d --name local-ai -p 8080:8080 localai/localai:latest-aio-cpu run --debug $MODEL_NAME
until [ "`docker inspect -f {{.State.Health.Status}} local-ai`"=="healthy" ]; do
echo "Waiting for container to be ready"
sleep 2;
done;
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
- name: Summarize
id: summarize
run: |
Expand All @@ -31,7 +28,7 @@ jobs:
# Create a JSON payload using jq to handle special characters
json_payload=$(jq -n --arg input "$input" '{
model: "$MODEL_NAME",
model: "'$MODEL_NAME'",
messages: [
{
role: "system",
Expand All @@ -54,9 +51,11 @@ jobs:
# Print the summary
# -H "Authorization: Bearer $API_KEY" \
echo "Summary:"
echo "$summary"
echo "message=$summary\n" >> $GITHUB_OUTPUT
{
echo 'message<<EOF'
echo $summary
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
Expand Down

0 comments on commit 5d0f738

Please sign in to comment.