Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
fix: update all tests to use new create_prompt function signature
Abi Rajabff1a1024430
diff --git a/backend/pytest.ini b/backend/pytest.iniindex 9855d94e..5ef4a867 100644--- a/backend/pytest.ini+++ b/backend/pytest.ini@@ -4,3 +4,4 @@ python_files = test_*.pypython_classes = Test*python_functions = test_*addopts = -v --tb=short+asyncio_mode = autodiff --git a/backend/tests/test_prompts.py b/backend/tests/test_prompts.pyindex 2dc2115a..3af0b9f5 100644--- a/backend/tests/test_prompts.py+++ b/backend/tests/test_prompts.py@@ -98,7 +98,13 @@ class TestCreatePrompt:with patch("prompts.SYSTEM_PROMPTS", mock_system_prompts):# Call the functionmessages, image_cache = await create_prompt(- params, self.TEST_STACK, "image"+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),)# Define expected structure@@ -145,7 +151,13 @@ class TestCreatePrompt:with patch("prompts.SYSTEM_PROMPTS", mock_system_prompts):# Call the functionmessages, image_cache = await create_prompt(- params, self.TEST_STACK, "image"+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),)# Define expected structure@@ -206,7 +218,13 @@ class TestCreatePrompt:):# Call the functionmessages, image_cache = await create_prompt(- params, self.TEST_STACK, "image"+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),)# Define expected structure@@ -261,7 +279,15 @@ class TestCreatePrompt:with patch('prompts.TEXT_SYSTEM_PROMPTS', mock_text_system_prompts):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "text")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="text",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structureexpected: ExpectedResult = {@@ -309,7 +335,15 @@ class TestCreatePrompt:with patch('prompts.TEXT_SYSTEM_PROMPTS', mock_text_system_prompts), \patch('prompts.create_alt_url_mapping', return_value={"text": "cache"}):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "text")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="text",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structureexpected: ExpectedResult = {@@ -392,7 +426,15 @@ class TestCreatePrompt:with patch('prompts.assemble_claude_prompt_video', return_value=mock_video_messages):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "video")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="video",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structureexpected: ExpectedResult = {@@ -454,7 +496,15 @@ class TestCreatePrompt:with patch("prompts.SYSTEM_PROMPTS", mock_system_prompts), \patch("prompts.create_alt_url_mapping", return_value={"mock": "cache"}):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "image")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structureexpected: ExpectedResult = {@@ -524,7 +574,15 @@ class TestCreatePrompt:with patch("prompts.SYSTEM_PROMPTS", mock_system_prompts), \patch("prompts.create_alt_url_mapping", return_value={"mock": "cache"}):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "image")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structureexpected: ExpectedResult = {@@ -599,7 +657,15 @@ class TestCreatePrompt:with patch("prompts.SYSTEM_PROMPTS", mock_system_prompts), \patch("prompts.create_alt_url_mapping", return_value={}):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "image")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structure - should be text-only messagesexpected: ExpectedResult = {@@ -654,7 +720,15 @@ class TestCreatePrompt:with patch("prompts.IMPORTED_CODE_SYSTEM_PROMPTS", mock_imported_prompts):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "image")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params.get("prompt", {"text": "", "images": []}),+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structureexpected: ExpectedResult = {diff --git a/backend/tests/test_prompts_additional.py b/backend/tests/test_prompts_additional.pyindex 8d60ecbe..98225616 100644--- a/backend/tests/test_prompts_additional.py+++ b/backend/tests/test_prompts_additional.py@@ -104,7 +104,15 @@ class TestCreatePromptImageSupport:with patch("prompts.SYSTEM_PROMPTS", mock_system_prompts), \patch("prompts.create_alt_url_mapping", return_value={"mock": "cache"}):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "image")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structureexpected: ExpectedResult = {@@ -179,7 +187,15 @@ class TestCreatePromptImageSupport:with patch("prompts.SYSTEM_PROMPTS", mock_system_prompts), \patch("prompts.create_alt_url_mapping", return_value={}):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "image")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params["prompt"],+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structure - should be text-only messagesexpected: ExpectedResult = {@@ -234,7 +250,15 @@ class TestCreatePromptImageSupport:with patch("prompts.IMPORTED_CODE_SYSTEM_PROMPTS", mock_imported_prompts):# Call the function- messages, image_cache = await create_prompt(params, self.TEST_STACK, "image")+ messages, image_cache = await create_prompt(+ stack=self.TEST_STACK,+ input_mode="image",+ generation_type=params["generationType"],+ prompt=params.get("prompt", {"text": "", "images": []}),+ history=params.get("history", []),+ is_imported_from_code=params.get("isImportedFromCode", False),+ result_image=params.get("resultImage"),+ )# Define expected structureexpected: ExpectedResult = {