diff options
| author | Martin Bielik <martin.bielik@instea.sk> | 2024-12-22 14:55:15 +0100 |
|---|---|---|
| committer | Martin Bielik <martin.bielik@instea.sk> | 2024-12-22 14:55:15 +0100 |
| commit | fbc2bfb445c71985e9fc399d3fac2def2fc6854e (patch) | |
| tree | e93db9bf177d8790c608e3871d9f55d259510855 /tests/context_test.py | |
| parent | 4f1c95386437c8fa6e189c136681950a91fb25c9 (diff) | |
| download | vim-ai-fbc2bfb445c71985e9fc399d3fac2def2fc6854e.tar.gz | |
added image generation
Diffstat (limited to '')
| -rw-r--r-- | tests/context_test.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/context_test.py b/tests/context_test.py index a1d9624..7cb4810 100644 --- a/tests/context_test.py +++ b/tests/context_test.py @@ -24,6 +24,23 @@ default_config = { }, } +default_image_config = { + "prompt": "", + "options": { + "model": "dall-e-3", + "endpoint_url": "https://api.openai.com/v1/images/generations", + "quality": "standard", + "size": "1024x1024", + "style": "vivid", + "request_timeout": "20", + "enable_auth": "1", + "token_file_path": "", + }, + "ui": { + "paste_mode": "1", + }, +} + def test_default_config(): actual_context = make_ai_context({ 'config_default': default_config, @@ -130,6 +147,25 @@ def test_chat_only_role(): actual_config = context['config'] assert 'preset_tab' == actual_config['options']['open_chat_command'] +def test_image_role(): + actual_context = make_ai_context({ + 'config_default': default_image_config, + 'config_extension': {}, + 'user_instruction': '/hd-image picture of the moon', + 'user_selection': '', + 'command_type': 'image', + }) + expected_options = { + **default_image_config['options'], + 'token_file_path': '/custom/path/ai.token', + 'quality': 'hd', + } + expected_context = { + 'config': { **default_image_config, 'options': expected_options }, + 'prompt': 'picture of the moon', + } + assert expected_context == actual_context + def test_default_roles(): base = { 'config_default': default_config, |