This file contains hidden or 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
| def clean_and_parse_json_with_ai(json_string: str, openai_key: str): | |
| clean_json_fn = { | |
| "name": "clean_json", | |
| "description": "Cleans JSON.", | |
| "parameters": { | |
| "type": "object", | |
| "properties": { | |
| "clean_json": { | |
| "type": "string", | |
| "description": "The cleaned JSON.", |
This file contains hidden or 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 is the core translation code from https://www.youtube.com/watch?v=2ItlnKhe37U | |
| # It uses the OpenAI API to translate messages from one language to another. | |
| import dataclasses | |
| from typing import List | |
| from django.conf import settings | |
| from openai import OpenAI | |
| from apps.translations.models import InputText, Language |
This file contains hidden or 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
| diff --git a/apps/chat/consumers.py b/apps/chat/consumers.py | |
| index cf792d9e..a4963491 100644 | |
| --- a/apps/chat/consumers.py | |
| +++ b/apps/chat/consumers.py | |
| @@ -1,4 +1,5 @@ | |
| import json | |
| +import uuid | |
| from channels.generic.websocket import WebsocketConsumer | |
| from django.conf import settings |
This file contains hidden or 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
| diff --git a/assets/javascript/site.js b/assets/javascript/site.js | |
| index a34accb4..32ded7dc 100644 | |
| --- a/assets/javascript/site.js | |
| +++ b/assets/javascript/site.js | |
| @@ -3,3 +3,5 @@ | |
| import 'htmx.org'; | |
| import './htmx'; | |
| import './alpine'; | |
| +import 'flowbite'; | |
| +import 'flowbite/dist/datepicker'; |
This file contains hidden or 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
| from django.test import TransactionTestCase | |
| from .services import my_function_that_hits_the_db | |
| class MyTest(TransactionTestCase): | |
| def test_db_performance(self): | |
| # called directly | |
| self.assertNumQueries(7, my_function_that_hits_the_db) | |
| # used as a context manager |
This file contains hidden or 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
| version = 1 | |
| requires-python = ">=3.12" | |
| [[package]] | |
| name = "asgiref" | |
| version = "3.8.1" | |
| source = { registry = "https://pypi.org/simple" } | |
| sdist = { url = "https://files.pythonhosted.org/packages/29/38/b3395cc9ad1b56d2ddac9970bc8f4141312dbaec28bc7c218b0dfafd0f42/asgiref-3.8.1.tar.gz", hash = "sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590", size = 35186 } | |
| wheels = [ | |
| { url = "https://files.pythonhosted.org/packages/39/e3/893e8757be2612e6c266d9bb58ad2e3651524b5b40cf56761e985a28b13e/asgiref-3.8.1-py3-none-any.whl", hash = "sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47", size = 23828 }, |
OlderNewer