Skip to content

Commit

Permalink
Support dall-e-3 and Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
hibobmaster committed Apr 24, 2024
1 parent 69ce5b4 commit 9288f9a
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 9 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/docker-debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Publish Docker image

on:
push:
branches:
- 'main'
paths:
- '**.py'

jobs:
push_to_registry:
name: Push Docker image to registry
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: hibobmaster/matrixchatgptbot
tags: |
type=sha,format=long
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image(dockerhub)
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Docker metadata(ghcr)
id: meta2
uses: docker/metadata-action@v5
with:
images: ghcr.io/hibobmaster/matrixchatgptbot
tags: |
type=sha,format=long
- name: Build and push Docker image(ghcr)
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta2.outputs.tags }}
labels: ${{ steps.meta2.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
16 changes: 8 additions & 8 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,35 @@ jobs:
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: hibobmaster/matrixchatgptbot
tags: |
type=raw,value=latest
type=ref,event=tag
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image(dockerhub)
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand All @@ -54,7 +54,7 @@ jobs:

- name: Docker metadata(ghcr)
id: meta2
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ghcr.io/hibobmaster/matrixchatgptbot
tags: |
Expand All @@ -63,7 +63,7 @@ jobs:
type=sha,format=long
- name: Build and push Docker image(ghcr)
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
3 changes: 2 additions & 1 deletion src/imagegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ async def get_images(
},
json={
"prompt": prompt,
"model": "dall-e-3",
"n": kwargs.get("n", 1),
"size": kwargs.get("size", "512x512"),
"size": kwargs.get("size", "1024x1024"),
"response_format": "b64_json",
},
timeout=timeout,
Expand Down

0 comments on commit 9288f9a

Please sign in to comment.