diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml deleted file mode 100644 index 074c84b..0000000 --- a/.github/workflows/docker.yaml +++ /dev/null @@ -1,55 +0,0 @@ -name: Create and publish a Docker image -# from: https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images - -on: - push: - branches: ["main"] - -# Defines two custom environment variables for the workflow. -# These are used for the Container registry domain, and a name for the Docker image that this workflow builds. -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - attestations: write - id-token: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push Docker image - id: push - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v2 - with: - subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} - subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true diff --git a/README.md b/README.md index c4e2b39..71435f1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,19 @@ -# Pollen Prophet +# The Bee's Knees + +When fact checking is optional, but irony is not. ## Ideas -- switch on-the-fly between original and improvements +- [x] switch on-the-fly between original and improvements - vote-mode for the best suggestion - when opening the article shows all suggestions made - user can vote for the best one and the one with the most votes becomes the new headline - associated image generation? + +## What is this? + +The Bee's knees is a running AI rewrite of the newest Babylon Bee headlines. +Some will be on point, some will be nonsensical, +but rest assured in the knowledge that all will at least be better than the original. + +You can switch back-and-forth between the original and the AI generated version with a button. diff --git a/prophet/infra/llm_groq.py b/prophet/infra/llm_groq.py index 60dc29b..57bb6e7 100644 --- a/prophet/infra/llm_groq.py +++ b/prophet/infra/llm_groq.py @@ -41,7 +41,6 @@ class GroqClient(LLMClient): custom_prompt if custom_prompt else f""" - Political context: We are in the year 2025, Donald Trump is President of the United States again. There has been a crackdown on 'illegal' immigration, with controversial disappearings happening @@ -57,11 +56,14 @@ class GroqClient(LLMClient): Do not create a headline naming Trump if more than 2 of the previous headlines already do so and he is not specifically - referenced in the original headline. + referenced in the original headline. Ensure you do not repeat too + much wording from your previous headlines. - {"The previous 5 headlines you created are the following:\n- " if previous_titles else ""} + {"The previous 5 headlines you created were the following:\n- " if previous_titles else ""} {"\n- ".join(previous_titles) if previous_titles else ""} + When creating the new headline, try to stick close to the topic of + the original headline. """ ) suggestions = self.client.chat.completions.create( @@ -72,7 +74,7 @@ class GroqClient(LLMClient): }, { "role": "user", - "content": original_content, + "content": f"The headline to rewrite is the following: {original_content}", }, ], model="llama-3.3-70b-versatile", @@ -153,3 +155,20 @@ class GroqClient(LLMClient): raise ValueError print("Improved summary", summary_str) return summary_str.strip(" \"'") + + +if __name__ == "__main__": + from datetime import datetime + + cfg = AiConfig.from_env() + llm = GroqClient(cfg) + print( + llm.rewrite( + Original( + title="Obama Argues He Can’t Be Charged With Treason Since He Wasn’t Born In America", + summary="WASHINGTON, D.C. — In a blow to hopes from conservatives that the former president would face severe consequences for allegedly overseeing an attempt to deligitimize the Trump presidency, Barack Obama argued that he can't be charged with treason since he wasn't born in America and isn't a legitimate American citizen.", + link="", + date=datetime.now(), + ) + ) + ) diff --git a/pyproject.toml b/pyproject.toml index 50e5827..6b8d7e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] -name = "pollen-prophet" +name = "bees-knees" version = "0.1.0" -description = "Add your description here" +description = "Where fact checking is optional, but irony is not." readme = "README.md" requires-python = ">=3.13" dependencies = [ diff --git a/static/style.css b/static/style.css index c6e739a..2f913e4 100644 --- a/static/style.css +++ b/static/style.css @@ -45,6 +45,10 @@ body { opacity: 0.8; } +.fab-icon-holder.disabled { + background: #333333 +} + .fab-icon-holder .icon { display: flex; align-items: center; diff --git a/templates/floating_button.html b/templates/floating_button.html index f79a9a0..8d28a41 100644 --- a/templates/floating_button.html +++ b/templates/floating_button.html @@ -32,24 +32,24 @@
  • - Lefty Bee -
    + Lefty Bee (not implemented) +
  • - About -
    + About (not implemented) +
  • - Feedback -
    + Feedback (not implemented) +
    diff --git a/templates/index.html b/templates/index.html index 79f2a8a..f307ac9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,7 +1,7 @@ - The Pollen Prophet + The Bee's Knees