Skip to content

Refactor multiple flows to enhance performance, boost scalability, and ensure stability.#131

Draft
luuquangvu wants to merge 255 commits intoNativu5:mainfrom
luuquangvu:main
Draft

Refactor multiple flows to enhance performance, boost scalability, and ensure stability.#131
luuquangvu wants to merge 255 commits intoNativu5:mainfrom
luuquangvu:main

Conversation

@luuquangvu
Copy link
Copy Markdown
Collaborator

This PR is still a work in progress and uses features that aren't yet officially available in the Gemini-API library, so we'll need to wait for the library's official update before merging. Feel free to try it out and share any feedback or report any issues you encounter. Thanks!

Here are some highlights of the changes:

  • The entire logic for storing conversation history has been rewritten, aiming for compatibility with various endpoints and easy scalability in the future.
  • The logic of the endpoints has been rewritten, and now all endpoints work correctly with both streaming and non-streaming flows.
  • Compatible with the latest library updates, including the ability to download full-size images and enable video or music generation.
  • All cookie-related errors will be fully resolved, and users will get a clear notification if the server invalidates cookies, making it simple to know when to manually refresh a new one.

…probabilities, and token details; adjust response handling accordingly.
…tput_text` validator, rename `created` to `created_at`, and update response handling accordingly.
…roved streaming of response items. Refactor image generation handling for consistency and add compatibility with output content.
…t` and ensure consistent initialization in image output handling.
…anagement

Add dedicated router for /images endpoint and refactor image handling logic for better modularity. Enhance temporary image management with secure naming, token verification, and cleanup functionality.
…y` for tools, tool_choice, and streaming settings
…nd update response handling for consistency
…andling, and improved extension determination
- Introduced `model_strategy` configuration for "append" (default + custom models) or "overwrite" (custom models only).
- Enhanced `/v1/models` endpoint to return models based on the configured strategy.
- Improved model loading with environment variable overrides and validation.
- Refactored model handling logic for improved modularity and error handling.
…eld support

- Enhanced `extract_gemini_models_env` to handle nested fields within environment variables.
- Updated type hints for more flexibility in model overrides.
- Improved `_merge_models_with_env` to better support field-level updates and appending new models.
@Vigno04
Copy link
Copy Markdown
Contributor

Vigno04 commented Mar 25, 2026

Using latest image it seems to not support multi turn conversation am I right? Every message I send it forget the older one

@Vigno04
Copy link
Copy Markdown
Contributor

Vigno04 commented Mar 25, 2026

Also the new Gemini-api support having the model pulled from Gemini and not hard coded, it could be a good enhancement

@luuquangvu
Copy link
Copy Markdown
Collaborator Author

Using latest image it seems to not support multi turn conversation am I right? Every message I send it forget the older one

I don't know how you tested it, but it works fine for me. Note that to keep conversations running continuously through restarts, you need to enable Gemini Activities.

@Vigno04
Copy link
Copy Markdown
Contributor

Vigno04 commented Mar 26, 2026

Gemini activity is enabled, but I think it is using temporary chat (the best option to not saturate my chat history with all the users request) I think it should work regardless the original code worked

@luuquangvu
Copy link
Copy Markdown
Collaborator Author

The library's author is preparing to release a major 2.0 update. Therefore, this PR will also have to wait for it, as some features are being developed based on the latest code from the library.

@luuquangvu
Copy link
Copy Markdown
Collaborator Author

@Nativu5 The library is now at version 2.0. There's currently PR #134 waiting for you to merge it. Would you like to merge it before this PR? This PR has undergone many changes, so I need a stable main branch to effectively manage and resolve all merge conflicts. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants