dynamic models for all the platforms! #10

Merged
russellballestrini merged 2 commits from dynamic-models into main 2025-03-11 22:02:53 -04:00
russellballestrini commented 2025-03-11 18:25:44 -04:00 (Migrated from git2.unturf.com)

Created by: russellballestrini

modified:   .gitignore
modified:   README.rst
modified:   app.py
modified:   templates/base.html
modified:   templates/chat.html
new file:   vars.sh.sample

Summary by CodeRabbit

  • New Features

    • Introduced a dynamic model selection interface that automatically retrieves and displays currently available models.
    • Added an API endpoint that enables real-time querying of active model options.
  • Documentation

    • Updated configuration instructions to simplify setting up environment variables and API keys.
    • Removed outdated dependency references to streamline the setup process.
  • Chores

    • Refined repository settings by excluding sensitive configuration files.
    • Provided a sample configuration file to facilitate easier environment setup.
*Created by: russellballestrini* modified: .gitignore modified: README.rst modified: app.py modified: templates/base.html modified: templates/chat.html new file: vars.sh.sample <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a dynamic model selection interface that automatically retrieves and displays currently available models. - Added an API endpoint that enables real-time querying of active model options. - **Documentation** - Updated configuration instructions to simplify setting up environment variables and API keys. - Removed outdated dependency references to streamline the setup process. - **Chores** - Refined repository settings by excluding sensitive configuration files. - Provided a sample configuration file to facilitate easier environment setup. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
russellballestrini commented 2025-03-11 18:25:52 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

Walkthrough

The changes update project configuration and dynamic behaviors. A new entry is added to .gitignore to exclude vars.sh. The README.rst has been streamlined by removing several dependencies and simplifying environment variable instructions, with endpoint variables renamed. In app.py, the static endpoints list is replaced by a dynamic mechanism that fetches endpoints from environment variables and introduces a new /models route. Both templates/base.html and templates/chat.html now populate model dropdowns dynamically from the backend with caching, and vars.sh.sample is added as a sample configuration file.

Changes

File(s) Change Summary
.gitignore Added entry vars.sh to ignore this file.
README.rst Removed dependencies for mistralai, together, and groq; updated and simplified environment variable instructions; renamed endpoint variables from VLLM_ENDPOINT_* to MODEL_ENDPOINT_*; consolidated language model command instructions.
app.py Replaced static endpoint list with a dynamic configuration using environment variables; updated initialize_model_map and introduced get_client_for_endpoint; refined chat message processing; added a new route /models that returns available model keys.
templates/base.html, templates/chat.html Removed hardcoded model options and JavaScript validation; implemented dynamic model dropdown population by fetching data from the /models endpoint with caching via localStorage; modified message-sending to include the model as a separate attribute.
vars.sh.sample Introduced a new sample configuration file containing multiple environment variable declarations for API keys and model endpoints, serving as an example setup.

Sequence Diagram(s)

sequenceDiagram
    participant Browser
    participant localStorage
    participant Server

    Browser->>Browser: Wait for DOMContentLoaded
    Browser->>localStorage: Check for cached model list
    alt Cache Hit
        localStorage-->>Browser: Return cached model list
    else Cache Miss
        Browser->>Server: GET /models
        Server-->>Browser: Return model list
        Browser->>localStorage: Cache model list (1 min)
    end
    Browser->>Browser: Populate the model dropdown
sequenceDiagram
    participant Client
    participant AppServer
    participant ModelClient

    Client->>AppServer: Send chat message with selected model
    AppServer->>AppServer: Extract username & clean message
    AppServer->>ModelClient: Call get_client_for_endpoint(selected model)
    ModelClient-->>AppServer: Return specific model client
    AppServer->>AppServer: Process the chat message accordingly
    AppServer-->>Client: Return chat response

Poem

I’m a happy rabbit with a code-hop beat,
Leaping through endpoints with tricks so neat.
From static lists to dynamic zest,
My dropdowns now shine and are at their best.
Cheers to fresh changes—let coding be sweet!
🐇


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
*Created by: coderabbitai[bot]* <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough The changes update project configuration and dynamic behaviors. A new entry is added to `.gitignore` to exclude `vars.sh`. The `README.rst` has been streamlined by removing several dependencies and simplifying environment variable instructions, with endpoint variables renamed. In `app.py`, the static endpoints list is replaced by a dynamic mechanism that fetches endpoints from environment variables and introduces a new `/models` route. Both `templates/base.html` and `templates/chat.html` now populate model dropdowns dynamically from the backend with caching, and `vars.sh.sample` is added as a sample configuration file. ## Changes | File(s) | Change Summary | |--------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `.gitignore` | Added entry `vars.sh` to ignore this file. | | `README.rst` | Removed dependencies for `mistralai`, `together`, and `groq`; updated and simplified environment variable instructions; renamed endpoint variables from `VLLM_ENDPOINT_*` to `MODEL_ENDPOINT_*`; consolidated language model command instructions. | | `app.py` | Replaced static endpoint list with a dynamic configuration using environment variables; updated `initialize_model_map` and introduced `get_client_for_endpoint`; refined chat message processing; added a new route `/models` that returns available model keys. | | `templates/base.html`, `templates/chat.html` | Removed hardcoded model options and JavaScript validation; implemented dynamic model dropdown population by fetching data from the `/models` endpoint with caching via `localStorage`; modified message-sending to include the model as a separate attribute. | | `vars.sh.sample` | Introduced a new sample configuration file containing multiple environment variable declarations for API keys and model endpoints, serving as an example setup. | ## Sequence Diagram(s) ```mermaid sequenceDiagram participant Browser participant localStorage participant Server Browser->>Browser: Wait for DOMContentLoaded Browser->>localStorage: Check for cached model list alt Cache Hit localStorage-->>Browser: Return cached model list else Cache Miss Browser->>Server: GET /models Server-->>Browser: Return model list Browser->>localStorage: Cache model list (1 min) end Browser->>Browser: Populate the model dropdown ``` ```mermaid sequenceDiagram participant Client participant AppServer participant ModelClient Client->>AppServer: Send chat message with selected model AppServer->>AppServer: Extract username & clean message AppServer->>ModelClient: Call get_client_for_endpoint(selected model) ModelClient-->>AppServer: Return specific model client AppServer->>AppServer: Process the chat message accordingly AppServer-->>Client: Return chat response ``` ## Poem > I’m a happy rabbit with a code-hop beat, > Leaping through endpoints with tricks so neat. > From static lists to dynamic zest, > My dropdowns now shine and are at their best. > Cheers to fresh changes—let coding be sweet! > 🐇✨ <!-- walkthrough_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIw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Dv8wA9gXJM8Axhb5mA1YDAVgI/5iI+4SofxFWFkBRp/EqUckEHkiBeFa+UYBYA2GIF9JAiuCdkDdVBz+Qa06TVtMNSyaIscm1RSavwE6o9ojEE7AdNYCH77oRmk6NdC3CPRWAFBD0Zvlem1adwaw6gkvpoKpogZ+4egjQfd1rCj98AkKW3txF4j8QdkFuMSLsxsgyR7I/gc/GdQsxuQFAmkFQF5HfT6R7BMkdQC4g0qIAXEOiZcHQBcRuYJO+kAKFABWC0QqGKwOgCTyV67dsgSvAQCTxWDZABAWQwHoDybLpDduJAQHuCh+QrASeawXbuCkB4ABOTwIEMMiQBwUDAAQGsAaG7dNCAgcFNkPBSiBUh7oBoakJGDgpwUCGEng0MaFrAletAH5LRDa7VQWhEASAA0IKG0AVgDADYbtzQCZC1g2QBgCsDyE1DsgEwtAPUIaHZBaASvJXm1124NC5hjwqob5EMD2DwUAgNrhUOyBtdUhaAR8iTxqEMA1gbXUQAhk6EkAVgPyQHnUIQzgo9h0IjIT8jeHGBWhwQ3AKENoDhDIhf0WgI7kTj6AgAA=== --> <!-- internal state end --> <!-- tips_start --> --- <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=russellballestrini/opencompletion&utm_content=10): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->
russellballestrini commented 2025-03-11 18:28:34 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

🛠️ Refactor suggestion

Consolidate model selection logic
Using if checks for each model type is direct but could become unwieldy if more models are added. Consider a registry or mapping that associates model keys with their respective handlers to boost maintainability.

*Created by: coderabbitai[bot]* _🛠️ Refactor suggestion_ **Consolidate model selection logic** Using `if` checks for each model type is direct but could become unwieldy if more models are added. Consider a registry or mapping that associates model keys with their respective handlers to boost maintainability. <!-- This is an auto-generated reply by CodeRabbit -->
russellballestrini commented 2025-03-11 18:28:35 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

Review: Commented

Actionable comments posted: 1

🧹 Nitpick comments (13)
templates/base.html (1)

393-433: Consider adding fallback logic for fetch errors
This dynamic model loading approach is great. However, if fetching or JSON parsing fails, we may want to handle it gracefully in the UI rather than just logging an error. For example, we could display a warning or revert to a default model list.

  fetch('/models')
      .then(response => response.json())
      .then(data => {
          const models = data.models;
+         if (!models || !Array.isArray(models)) {
+             console.warn("No valid model list returned. Falling back to an empty list.");
+             return;
+         }
          populateModelDropdown(models);
          localStorage.setItem(cacheKey, JSON.stringify(models));
          localStorage.setItem(cacheExpirationKey, Date.now() + cacheDuration);
      })
      .catch(error => {
          console.error("Error fetching models:", error);
+         // Optionally show a user-friendly alert or fallback to an empty list
      });
templates/chat.html (2)

65-66: Revisit hardcoded valid voices
If you plan to add more voices or fetch them dynamically in the future, consider centralizing this array in a config or environment variable to avoid duplication and to keep the code flexible.


125-168: Ensure consistent error handling and fallback for dynamic model population
Similar to the logic in base.html, you may want to guard against invalid or empty responses. This helps prevent runtime errors and improves the user experience in case /models returns nothing.

README.rst (2)

72-76: Clarify environment variable usage
Adding instructions to copy vars.sh.sample is a nice improvement. Consider emphasizing the importance of keeping real secrets out of version control.


187-191: Local usage with Ollama
These instructions help devs run the model locally. Consider adding a brief note about any TLS or security concerns if exposing local endpoints externally.

app.py (2)

55-106: Check large endpoint iteration limit
Iterating up to 1000 environment variables is robust but potentially overkill. If your deployment doesn’t need so many endpoints, a smaller upper bound or an early break after the last available endpoint might reduce overhead. Also, halting the app when no endpoints are found is a strong assertion—be sure that’s the intended behavior.


518-520: Validate incoming data
Extracting username, message, and model is straightforward. Consider gracefully handling missing or invalid fields to make the code more robust in production environments.

vars.sh.sample (6)

4-7: Production vs. Development Values.
Line 4 appropriately comments out a production configuration, while line 5 actively exports a development value. This clear separation helps prevent unintentional deployment errors.


20-23: Commented Google Gemini Section.
The optional Google Gemini endpoint configurations (lines 20–22) are commented out effectively. This allows for easy enabling in the future while keeping the current configuration clean.


24-27: Grok Endpoint Comments.
The commented-out Grok endpoint (lines 24–26) is well presented. It might be helpful to add a brief note on when or why these might be enabled to assist future maintainers.


36-39: OpenAI Endpoint Details.
The OpenAI endpoint is configured on lines 36–39. Note that both MODEL_API_KEY_7 and OPENAI_API_KEY are exported. If they serve distinct purposes, consider adding a clarifying comment; if not, think about consolidating them to reduce potential confusion.


41-43: MistralAI Endpoint Configuration.
The MistralAI endpoint (lines 41–43) is clearly laid out. Verify that the comment “La Platform” accurately reflects the current branding or intended usage to avoid ambiguity.


44-44: Extraneous Content at File End.
It appears that line 44 may contain stray content or an extraneous line number. Removing or clarifying this will help maintain a clean configuration sample.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00eba1b150 and 1accc1ed785f8b71fbf866ade785e6321705369e.

📒 Files selected for processing (6)
  • .gitignore (1 hunks)
  • README.rst (3 hunks)
  • app.py (13 hunks)
  • templates/base.html (1 hunks)
  • templates/chat.html (4 hunks)
  • vars.sh.sample (1 hunks)
🔇 Additional comments (9)
.gitignore (1)

9-9: Add line to ignore vars.sh - Good practice
By ignoring vars.sh, you're preventing the accidental commitment of your local environment variables. This helps keep sensitive information private.

templates/chat.html (1)

280-285: Including the model in socket events
Great job attaching the selected model as a separate attribute in the emitted socket message. This design provides more flexibility on the back end for routing requests to the appropriate model.

README.rst (2)

84-86: Renamed endpoints
Using MODEL_ENDPOINT_1, etc., aligns with the new dynamic approach in the back end. This naming convention looks clear and consistent.


108-108: Simplified instructions
Replacing the per-model command instructions with “choose from the dropdown” is more user-friendly. It reduces clutter while still conveying the same information.

vars.sh.sample (5)

1-3: Initialization and Shebang are Correct.
The file starts with a clear shebang and a concise description, which is ideal for a configuration sample.


9-12: OpenAI (Hermes) Endpoint Configuration.
The comment and export statements for the Hermes endpoint (lines 9–11) are clear. The inline comment on line 11 clarifies that the API key is optional, which aids in understanding the configuration defaults.


13-18: Naptha Endpoints.
The Naptha configuration (lines 13–18) is straightforward. The endpoints and corresponding API keys are clearly delineated. Double-check that these placeholder values are appropriate for the intended development context.


28-30: Groq Endpoint Configuration.
The Groq endpoint and API key (lines 28–30) are defined clearly. Ensure that using the placeholder "gone" meets your sample configuration standards.


32-34: Together Endpoint Configuration.
The Together endpoint settings (lines 32–34) are straightforward and consistent with the other definitions.

*Created by: coderabbitai[bot]* **Review:** Commented **Actionable comments posted: 1** <details> <summary>🧹 Nitpick comments (13)</summary><blockquote> <details> <summary>templates/base.html (1)</summary><blockquote> `393-433`: **Consider adding fallback logic for fetch errors** This dynamic model loading approach is great. However, if fetching or JSON parsing fails, we may want to handle it gracefully in the UI rather than just logging an error. For example, we could display a warning or revert to a default model list. ```diff fetch('/models') .then(response => response.json()) .then(data => { const models = data.models; + if (!models || !Array.isArray(models)) { + console.warn("No valid model list returned. Falling back to an empty list."); + return; + } populateModelDropdown(models); localStorage.setItem(cacheKey, JSON.stringify(models)); localStorage.setItem(cacheExpirationKey, Date.now() + cacheDuration); }) .catch(error => { console.error("Error fetching models:", error); + // Optionally show a user-friendly alert or fallback to an empty list }); ``` </blockquote></details> <details> <summary>templates/chat.html (2)</summary><blockquote> `65-66`: **Revisit hardcoded valid voices** If you plan to add more voices or fetch them dynamically in the future, consider centralizing this array in a config or environment variable to avoid duplication and to keep the code flexible. --- `125-168`: **Ensure consistent error handling and fallback for dynamic model population** Similar to the logic in `base.html`, you may want to guard against invalid or empty responses. This helps prevent runtime errors and improves the user experience in case `/models` returns nothing. </blockquote></details> <details> <summary>README.rst (2)</summary><blockquote> `72-76`: **Clarify environment variable usage** Adding instructions to copy `vars.sh.sample` is a nice improvement. Consider emphasizing the importance of keeping real secrets out of version control. --- `187-191`: **Local usage with Ollama** These instructions help devs run the model locally. Consider adding a brief note about any TLS or security concerns if exposing local endpoints externally. </blockquote></details> <details> <summary>app.py (2)</summary><blockquote> `55-106`: **Check large endpoint iteration limit** Iterating up to 1000 environment variables is robust but potentially overkill. If your deployment doesn’t need so many endpoints, a smaller upper bound or an early break after the last available endpoint might reduce overhead. Also, halting the app when no endpoints are found is a strong assertion—be sure that’s the intended behavior. --- `518-520`: **Validate incoming data** Extracting `username`, `message`, and `model` is straightforward. Consider gracefully handling missing or invalid fields to make the code more robust in production environments. </blockquote></details> <details> <summary>vars.sh.sample (6)</summary><blockquote> `4-7`: **Production vs. Development Values.** Line 4 appropriately comments out a production configuration, while line 5 actively exports a development value. This clear separation helps prevent unintentional deployment errors. --- `20-23`: **Commented Google Gemini Section.** The optional Google Gemini endpoint configurations (lines 20–22) are commented out effectively. This allows for easy enabling in the future while keeping the current configuration clean. --- `24-27`: **Grok Endpoint Comments.** The commented-out Grok endpoint (lines 24–26) is well presented. It might be helpful to add a brief note on when or why these might be enabled to assist future maintainers. --- `36-39`: **OpenAI Endpoint Details.** The OpenAI endpoint is configured on lines 36–39. Note that both `MODEL_API_KEY_7` and `OPENAI_API_KEY` are exported. If they serve distinct purposes, consider adding a clarifying comment; if not, think about consolidating them to reduce potential confusion. --- `41-43`: **MistralAI Endpoint Configuration.** The MistralAI endpoint (lines 41–43) is clearly laid out. Verify that the comment “La Platform” accurately reflects the current branding or intended usage to avoid ambiguity. --- `44-44`: **Extraneous Content at File End.** It appears that line 44 may contain stray content or an extraneous line number. Removing or clarifying this will help maintain a clean configuration sample. </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 00eba1b1509a821d266c8fc7742739bc1a9ab97d and 1accc1ed785f8b71fbf866ade785e6321705369e. </details> <details> <summary>📒 Files selected for processing (6)</summary> * `.gitignore` (1 hunks) * `README.rst` (3 hunks) * `app.py` (13 hunks) * `templates/base.html` (1 hunks) * `templates/chat.html` (4 hunks) * `vars.sh.sample` (1 hunks) </details> <details> <summary>🔇 Additional comments (9)</summary><blockquote> <details> <summary>.gitignore (1)</summary> `9-9`: **Add line to ignore vars.sh - Good practice** By ignoring `vars.sh`, you're preventing the accidental commitment of your local environment variables. This helps keep sensitive information private. </details> <details> <summary>templates/chat.html (1)</summary> `280-285`: **Including the model in socket events** Great job attaching the selected model as a separate attribute in the emitted socket message. This design provides more flexibility on the back end for routing requests to the appropriate model. </details> <details> <summary>README.rst (2)</summary> `84-86`: **Renamed endpoints** Using `MODEL_ENDPOINT_1`, etc., aligns with the new dynamic approach in the back end. This naming convention looks clear and consistent. --- `108-108`: **Simplified instructions** Replacing the per-model command instructions with “choose from the dropdown” is more user-friendly. It reduces clutter while still conveying the same information. </details> <details> <summary>vars.sh.sample (5)</summary> `1-3`: **Initialization and Shebang are Correct.** The file starts with a clear shebang and a concise description, which is ideal for a configuration sample. --- `9-12`: **OpenAI (Hermes) Endpoint Configuration.** The comment and export statements for the Hermes endpoint (lines 9–11) are clear. The inline comment on line 11 clarifies that the API key is optional, which aids in understanding the configuration defaults. --- `13-18`: **Naptha Endpoints.** The Naptha configuration (lines 13–18) is straightforward. The endpoints and corresponding API keys are clearly delineated. Double-check that these placeholder values are appropriate for the intended development context. --- `28-30`: **Groq Endpoint Configuration.** The Groq endpoint and API key (lines 28–30) are defined clearly. Ensure that using the placeholder "gone" meets your sample configuration standards. --- `32-34`: **Together Endpoint Configuration.** The Together endpoint settings (lines 32–34) are straightforward and consistent with the other definitions. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
russellballestrini commented 2025-03-11 18:30:09 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

💡 Verification agent

🧩 Analysis chain

Inconsistent URL formatting in endpoints.

Some endpoint URLs include trailing slashes (lines 5, 16, 32) while others don't. This inconsistency could potentially cause issues depending on how these URLs are used in the application. Consider standardizing the format.


🏁 Script executed:

#!/bin/bash
# Check if any URLs are being processed in the application in a way that requires consistent trailing slashes

grep -r "MODEL_ENDPOINT_" --include="*.py" .

Length of output: 187


Action: Standardize trailing slash usage in endpoint URLs.

The vars.sh.sample file shows a mix of URL formats across different endpoints (e.g., MODEL_ENDPOINT_3 and MODEL_ENDPOINT_7 include trailing slashes while others do not). The grep search from app.py confirms these values are used directly (via a simple os.environ.get call) with no additional normalization. This could lead to subtle bugs when concatenating paths or handling API requests. Please update the file to consistently include (or omit) trailing slashes across all endpoint definitions.

*Created by: coderabbitai[bot]* _💡 Verification agent_ <details> <summary>🧩 Analysis chain</summary> **Inconsistent URL formatting in endpoints.** Some endpoint URLs include trailing slashes (lines 5, 16, 32) while others don't. This inconsistency could potentially cause issues depending on how these URLs are used in the application. Consider standardizing the format. --- 🏁 Script executed: ```shell #!/bin/bash # Check if any URLs are being processed in the application in a way that requires consistent trailing slashes grep -r "MODEL_ENDPOINT_" --include="*.py" . ``` Length of output: 187 --- </details> **Action: Standardize trailing slash usage in endpoint URLs.** The `vars.sh.sample` file shows a mix of URL formats across different endpoints (e.g., `MODEL_ENDPOINT_3` and `MODEL_ENDPOINT_7` include trailing slashes while others do not). The grep search from `app.py` confirms these values are used directly (via a simple `os.environ.get` call) with no additional normalization. This could lead to subtle bugs when concatenating paths or handling API requests. Please update the file to consistently include (or omit) trailing slashes across all endpoint definitions. <!-- This is an auto-generated reply by CodeRabbit -->
russellballestrini commented 2025-03-11 18:30:10 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

Review: Commented

Actionable comments posted: 1

🧹 Nitpick comments (3)
vars.sh.sample (3)

4-7: Clarify the fallback value for the Hermes API key.

The comment indicates that "not-needed" is used if the API key is omitted, but this behavior isn't documented for other API keys. Consider documenting the fallback behavior consistently for all API keys or implementing the same behavior across all endpoints.


15-21: Inconsistent API key handling in Grok configuration.

The Google Gemini configuration provides a placeholder value, but the Grok API key is set to an empty string. Consider using a consistent approach for placeholder API keys across all configurations.

- export MODEL_API_KEY_4=""
+ export MODEL_API_KEY_4="your-grok-api-key"

1-39: Add usage instructions to the file header.

Consider adding more detailed instructions at the top of the file explaining how users should use this sample file (e.g., "Copy to vars.sh and modify with your own API keys").

#!/bin/bash
- # vars.sh: Example configuration for dynamic endpoints
+ # vars.sh.sample: Example configuration for dynamic endpoints
+ # 
+ # Usage: 
+ # 1. Copy this file to vars.sh: `cp vars.sh.sample vars.sh`
+ # 2. Edit vars.sh and add your actual API keys
+ # 3. Load the environment variables: `source vars.sh`
+ # 
+ # Note: vars.sh is excluded from git via .gitignore to prevent accidental commit of API keys
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1accc1ed785f8b71fbf866ade785e6321705369e and 3cb095dcb38b3ec1edd91eba33fa796908d2ac4a.

📒 Files selected for processing (1)
  • vars.sh.sample (1 hunks)
🔇 Additional comments (4)
vars.sh.sample (4)

1-3: Good introduction for the sample configuration file.

Clear documentation describing the purpose of this file for dynamic endpoints configuration.


8-14: Consistent configuration for Naptha endpoints.

The Naptha endpoint configuration is well-structured with clear commenting.


23-34: Clarify the meaning of "gone" for API keys.

Several API keys are set to "gone" which is ambiguous. It's unclear whether this means the keys are deprecated, no longer required, or that users should supply their own. Consider using more descriptive placeholder values or add a comment explaining what "gone" means.

Consider using one of these alternatives:

- export MODEL_API_KEY_5="gone"
+ export MODEL_API_KEY_5="your-groq-api-key"  # Required for Groq endpoint

Or if these endpoints are deprecated:

- export MODEL_API_KEY_5="gone"
+ export MODEL_API_KEY_5=""  # Deprecated or no longer supported

31-35: Duplicate OpenAI API key configuration.

Both MODEL_API_KEY_7 and OPENAI_API_KEY are defined for the OpenAI endpoint. Is this duplication intentional for backward compatibility? If so, consider adding a comment explaining this purpose.

# OpenAI endpoint.
export MODEL_ENDPOINT_7="https://api.openai.com/v1/"
export MODEL_API_KEY_7="gone"
- export OPENAI_API_KEY="gone"
+ export OPENAI_API_KEY="gone"  # Legacy variable, kept for backward compatibility
*Created by: coderabbitai[bot]* **Review:** Commented **Actionable comments posted: 1** <details> <summary>🧹 Nitpick comments (3)</summary><blockquote> <details> <summary>vars.sh.sample (3)</summary><blockquote> `4-7`: **Clarify the fallback value for the Hermes API key.** The comment indicates that "not-needed" is used if the API key is omitted, but this behavior isn't documented for other API keys. Consider documenting the fallback behavior consistently for all API keys or implementing the same behavior across all endpoints. --- `15-21`: **Inconsistent API key handling in Grok configuration.** The Google Gemini configuration provides a placeholder value, but the Grok API key is set to an empty string. Consider using a consistent approach for placeholder API keys across all configurations. ```diff - export MODEL_API_KEY_4="" + export MODEL_API_KEY_4="your-grok-api-key" ``` --- `1-39`: **Add usage instructions to the file header.** Consider adding more detailed instructions at the top of the file explaining how users should use this sample file (e.g., "Copy to vars.sh and modify with your own API keys"). ```diff #!/bin/bash - # vars.sh: Example configuration for dynamic endpoints + # vars.sh.sample: Example configuration for dynamic endpoints + # + # Usage: + # 1. Copy this file to vars.sh: `cp vars.sh.sample vars.sh` + # 2. Edit vars.sh and add your actual API keys + # 3. Load the environment variables: `source vars.sh` + # + # Note: vars.sh is excluded from git via .gitignore to prevent accidental commit of API keys ``` </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 1accc1ed785f8b71fbf866ade785e6321705369e and 3cb095dcb38b3ec1edd91eba33fa796908d2ac4a. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `vars.sh.sample` (1 hunks) </details> <details> <summary>🔇 Additional comments (4)</summary><blockquote> <details> <summary>vars.sh.sample (4)</summary> `1-3`: **Good introduction for the sample configuration file.** Clear documentation describing the purpose of this file for dynamic endpoints configuration. --- `8-14`: **Consistent configuration for Naptha endpoints.** The Naptha endpoint configuration is well-structured with clear commenting. --- `23-34`: **Clarify the meaning of "gone" for API keys.** Several API keys are set to "gone" which is ambiguous. It's unclear whether this means the keys are deprecated, no longer required, or that users should supply their own. Consider using more descriptive placeholder values or add a comment explaining what "gone" means. Consider using one of these alternatives: ```diff - export MODEL_API_KEY_5="gone" + export MODEL_API_KEY_5="your-groq-api-key" # Required for Groq endpoint ``` Or if these endpoints are deprecated: ```diff - export MODEL_API_KEY_5="gone" + export MODEL_API_KEY_5="" # Deprecated or no longer supported ``` --- `31-35`: **Duplicate OpenAI API key configuration.** Both `MODEL_API_KEY_7` and `OPENAI_API_KEY` are defined for the OpenAI endpoint. Is this duplication intentional for backward compatibility? If so, consider adding a comment explaining this purpose. ```diff # OpenAI endpoint. export MODEL_ENDPOINT_7="https://api.openai.com/v1/" export MODEL_API_KEY_7="gone" - export OPENAI_API_KEY="gone" + export OPENAI_API_KEY="gone" # Legacy variable, kept for backward compatibility ``` </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
russellballestrini commented 2025-03-11 21:05:27 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

@russellballestrini You're absolutely right! I missed the bigger picture - you've already dramatically simplified the code by reducing numerous model-specific if-statements down to just 3 main conditionals. The current implementation is clean, maintainable, and much more elegant than before.

Your refactoring approach makes perfect sense for this situation. I agree that further abstractions would be unnecessary complexity at this point. Consider this suggestion closed as "won't fix" - apologies for the oversight!

*Created by: coderabbitai[bot]* @russellballestrini You're absolutely right! I missed the bigger picture - you've already dramatically simplified the code by reducing numerous model-specific if-statements down to just 3 main conditionals. The current implementation is clean, maintainable, and much more elegant than before. Your refactoring approach makes perfect sense for this situation. I agree that further abstractions would be unnecessary complexity at this point. Consider this suggestion closed as "won't fix" - apologies for the oversight! <!-- This is an auto-generated reply by CodeRabbit -->
russellballestrini commented 2025-03-11 21:05:42 -04:00 (Migrated from git2.unturf.com)

Created by: russellballestrini

@coderabbitai

take into consideration we just removed N if statements and now we just have 3 I think we will be fine. close this thread as won't fix.

*Created by: russellballestrini* @coderabbitai take into consideration we just removed N if statements and now we just have 3 I think we will be fine. close this thread as won't fix.
russellballestrini commented 2025-03-11 21:06:09 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

@russellballestrini You're absolutely right! I missed the bigger picture - you've already dramatically simplified the code by reducing numerous model-specific if-statements down to just 3 main conditionals. The current implementation is clean, maintainable, and much more elegant than before.

Your refactoring approach makes perfect sense for this situation. I agree that further abstractions would be unnecessary complexity at this point. Consider this suggestion closed as "won't fix" - apologies for the oversight!

    (\(\
    (-.-)
  o_(")(")

If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

*Created by: coderabbitai[bot]* @russellballestrini You're absolutely right! I missed the bigger picture - you've already dramatically simplified the code by reducing numerous model-specific if-statements down to just 3 main conditionals. The current implementation is clean, maintainable, and much more elegant than before. Your refactoring approach makes perfect sense for this situation. I agree that further abstractions would be unnecessary complexity at this point. Consider this suggestion closed as "won't fix" - apologies for the oversight! (\(\ (-.-) o_(")(") --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Just%20got%20a%20great%20refactor%20suggestion%20from%20%40coderabbitai!%20%F0%9F%9B%A0%EF%B8%8F%20Consolidating%20model%20selection%20logic%20can%20boost%20maintainability%20and%20keep%20our%20code%20clean.%20Let's%20keep%20it%20elegant!%20%F0%9F%9A%80&url=https%3A%2F%2Fgithub.com%2Frussellballestrini%2Fopencompletion%2Fpull%2F10%23discussion_r1990207039)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> <!-- This is an auto-generated reply by CodeRabbit -->
russellballestrini commented 2025-03-11 21:20:08 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

Review: Commented

Actionable comments posted: 0

🧹 Nitpick comments (2)
requirements.txt (2)

1-27: Ensure Dependency List Consistency

The dependency list now omits the packages mistralai, together, and groq in favor of a leaner set of requirements, which aligns with the PR's objectives and the updated README instructions. Please verify that no code artifacts still reference the removed packages.


19-21: New Dependency: boto3 for AWS/S3 Integration

The new addition of boto3 with an appropriate comment now supports integration with S3/spaces or AWS Bedrock (Claude). Consider pinning a specific version if stability is critical, especially since other dependencies in the file are not version-pinned.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9bfd1c9b5a and 3b463f41ea.

📒 Files selected for processing (1)
  • requirements.txt (2 hunks)
*Created by: coderabbitai[bot]* **Review:** Commented **Actionable comments posted: 0** <details> <summary>🧹 Nitpick comments (2)</summary><blockquote> <details> <summary>requirements.txt (2)</summary><blockquote> `1-27`: **Ensure Dependency List Consistency** The dependency list now omits the packages `mistralai`, `together`, and `groq` in favor of a leaner set of requirements, which aligns with the PR's objectives and the updated README instructions. Please verify that no code artifacts still reference the removed packages. --- `19-21`: **New Dependency: boto3 for AWS/S3 Integration** The new addition of `boto3` with an appropriate comment now supports integration with S3/spaces or AWS Bedrock (Claude). Consider pinning a specific version if stability is critical, especially since other dependencies in the file are not version-pinned. </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 9bfd1c9b5a5f0fc11f70f33a369fd88459085921 and 3b463f41eaef770c04ecfab0e12653fa35a12852. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `requirements.txt` (2 hunks) </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
russellballestrini commented 2025-03-11 21:57:38 -04:00 (Migrated from git2.unturf.com)

Created by: russellballestrini

@coderabbitai good point I have fixed this file please reconsider my latest changes.

*Created by: russellballestrini* @coderabbitai good point I have fixed this file please reconsider my latest changes.
russellballestrini commented 2025-03-11 21:58:16 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the current content of vars.sh.sample to verify trailing slash consistency
cat vars.sh.sample

Length of output: 1207


@russellballestrini Great job! I've verified that you've standardized all the endpoint URLs by consistently removing the trailing slashes. This looks much better and will help avoid potential issues when working with these URLs in the application. I also noticed you fixed the version in the Groq endpoint from "v118" to "v1". These changes will ensure more consistent behavior across all endpoints.

🐰


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

*Created by: coderabbitai[bot]* <details> <summary>🧩 Analysis chain</summary> 🏁 Script executed: ``` #!/bin/bash # Check the current content of vars.sh.sample to verify trailing slash consistency cat vars.sh.sample ``` Length of output: 1207 --- </details> @russellballestrini Great job! I've verified that you've standardized all the endpoint URLs by consistently removing the trailing slashes. This looks much better and will help avoid potential issues when working with these URLs in the application. I also noticed you fixed the version in the Groq endpoint from "v118" to "v1". These changes will ensure more consistent behavior across all endpoints. 🐰 --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Great%20advice%20from%20%40coderabbitai%20on%20standardizing%20URL%20formats!%20%F0%9F%9A%80%20Consistent%20trailing%20slashes%20can%20prevent%20subtle%20bugs%20in%20API%20requests.%20Let's%20keep%20our%20code%20clean%20and%20reliable!%20%F0%9F%92%BB&url=https%3A%2F%2Fgithub.com%2Frussellballestrini%2Fopencompletion%2Fpull%2F10%23discussion_r1990208367)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> <!-- This is an auto-generated reply by CodeRabbit -->
russellballestrini commented 2025-03-11 22:01:23 -04:00 (Migrated from git2.unturf.com)

Created by: russellballestrini

@coderabbitai

| if you found this review helpful, would you consider giving us a shout-out on twitter

No free advertisement for you, but maybe somebody will read this review one day. and they will see how helpful you really are in action. thanks again for catching the issues.

*Created by: russellballestrini* @coderabbitai | if you found this review helpful, would you consider giving us a shout-out on twitter No free advertisement for you, but maybe somebody will read this review one day. and they will see how helpful you really are in action. thanks again for catching the issues.
russellballestrini commented 2025-03-11 22:01:48 -04:00 (Migrated from git2.unturf.com)

Created by: coderabbitai[bot]

@russellballestrini No problem at all! I completely understand, and I appreciate your kind words about the review being helpful. I'm glad I could assist with spotting those URL formatting inconsistencies. Your thoughtful implementation of the fixes will help ensure more reliable behavior across the endpoints. Thanks for the positive feedback!

*Created by: coderabbitai[bot]* @russellballestrini No problem at all! I completely understand, and I appreciate your kind words about the review being helpful. I'm glad I could assist with spotting those URL formatting inconsistencies. Your thoughtful implementation of the fixes will help ensure more reliable behavior across the endpoints. Thanks for the positive feedback! <!-- This is an auto-generated reply by CodeRabbit -->
russellballestrini commented 2025-03-11 22:02:53 -04:00 (Migrated from git2.unturf.com)

Merged by: russellballestrini at 2025-03-12 02:02:53 UTC

*Merged by: russellballestrini at 2025-03-12 02:02:53 UTC*
russellballestrini (Migrated from git2.unturf.com) closed this pull request 2025-03-11 22:02:53 -04:00
russellballestrini (Migrated from git2.unturf.com) merged commit into main 2025-03-11 22:02:53 -04:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: engineering/opencompletion.com#10
No description provided.