Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Import + Translate recipe images with OpenAI #3974

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dd89ed7
added image-related settings
michael-genson Aug 1, 2024
0cc78b2
added image support to openai service
michael-genson Aug 1, 2024
1a5019b
added route for sending image(s) to OpenAI
michael-genson Aug 1, 2024
e47a034
fix cook/perform time
michael-genson Aug 1, 2024
6d6d769
added image config to app info
michael-genson Aug 1, 2024
de01ac7
added create from image page
michael-genson Aug 1, 2024
b23af66
better ux
michael-genson Aug 1, 2024
ff4c12f
add to side links
michael-genson Aug 1, 2024
61412e2
improve cropper layout
michael-genson Aug 1, 2024
590fa02
update docs
michael-genson Aug 1, 2024
e3f5393
flip cropper controls to the other side
michael-genson Aug 2, 2024
d9d50c4
added API option to translate recipe
michael-genson Aug 2, 2024
394fbc9
added translate option to frontend
michael-genson Aug 2, 2024
d36db65
generate routes
michael-genson Aug 2, 2024
b6db8e8
added 400 error if image services are not enabled
michael-genson Aug 2, 2024
bffe77c
added test
michael-genson Aug 2, 2024
09cc689
missing key
michael-genson Aug 2, 2024
0a9b86c
steal fix from households PR
michael-genson Aug 2, 2024
9f611c0
minor text change
michael-genson Aug 2, 2024
42d12fd
Update mealie/services/openai/prompts/recipes/parse-recipe-image.txt
michael-genson Aug 9, 2024
fa2a0c6
Merge branch 'mealie-next' into feat/openai-image-import
boc-the-git Aug 17, 2024
b718e14
Update mealie/services/openai/prompts/recipes/parse-recipe-image.txt
michael-genson Aug 17, 2024
74d8d95
Update frontend/lang/messages/en-US.json
michael-genson Aug 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion dev/code-generation/gen_py_pytest_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ class PathObject(BaseModel):
http_verbs: list[HTTPRequest]


def force_include_in_schema(app: FastAPI):
# clear schema cache
app.openapi_schema = None
for route in app.routes:
route.include_in_schema = True


def get_path_objects(app: FastAPI):
force_include_in_schema(app)
paths = []

for key, value in app.openapi().items():
if key == "paths":
for key, value2 in value.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ For usage, see [Usage - OpenID Connect](../authentication/oidc.md)

Mealie supports various integrations using OpenAI. To enable OpenAI, [you must provide your OpenAI API key](https://platform.openai.com/api-keys). You can tweak how OpenAI is used using these backend settings. Please note that while OpenAI usage is optimized to reduce API costs, you're unlikely to be able to use OpenAI features with the free tier limits.

| Variables | Default | Description |
| ------------------------- | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| OPENAI_BASE_URL | None | The base URL for the OpenAI API. If you're not sure, leave this empty to use the standard OpenAI platform |
| OPENAI_API_KEY | None | Your OpenAI API Key. Enables OpenAI-related features |
| OPENAI_MODEL | gpt-4o | Which OpenAI model to use. If you're not sure, leave this empty |
| OPENAI_WORKERS | 2 | Number of OpenAI workers per request. Higher values may increase processing speed, but will incur additional API costs |
| OPENAI_SEND_DATABASE_DATA | True | Whether to send Mealie data to OpenAI to improve request accuracy. This will incur additional API costs |
| OPENAI_REQUEST_TIMEOUT | 10 | The number of seconds to wait for an OpenAI request to complete before cancelling the request. Leave this empty unless you're running into timeout issues on slower hardware |
| Variables | Default | Description |
| ---------------------------- | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| OPENAI_BASE_URL | None | The base URL for the OpenAI API. If you're not sure, leave this empty to use the standard OpenAI platform |
| OPENAI_API_KEY | None | Your OpenAI API Key. Enables OpenAI-related features |
| OPENAI_MODEL | gpt-4o | Which OpenAI model to use. If you're not sure, leave this empty |
| OPENAI_ENABLE_IMAGE_SERVICES | True | Whether to enable OpenAI image services, such as creating recipes via image. Leave this enabled unless your custom model doesn't support it, or you want to reduce costs |
| OPENAI_WORKERS | 2 | Number of OpenAI workers per request. Higher values may increase processing speed, but will incur additional API costs |
| OPENAI_SEND_DATABASE_DATA | True | Whether to send Mealie data to OpenAI to improve request accuracy. This will incur additional API costs |
| OPENAI_REQUEST_TIMEOUT | 60 | The number of seconds to wait for an OpenAI request to complete before cancelling the request. Leave this empty unless you're running into timeout issues on slower hardware |

### Themeing

Expand Down
Loading
Loading