assistant icon indicating copy to clipboard operation
assistant copied to clipboard

feat: Add optional model configuration

Open JairoGuo opened this issue 2 months ago • 1 comments

What does this PR do?

Add a large model compatible with OpenAI protocol to the assistant

Test Plan

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

OK

Summary by CodeRabbit

  • Chores
    • Added environment variable support for API base URL, model name, and embedding model configuration across deployment and runtime settings.

JairoGuo avatar Oct 22 '25 07:10 JairoGuo

Walkthrough

This pull request introduces configuration for an OpenAI-based AI assistant feature. Three new environment variables (_APP_ASSISTANT_BASE_URL, _APP_ASSISTANT_MODEL_NAME, and _APP_ASSISTANT_EMBEDDING_MODEL) are added to configuration files (.env.example, Dockerfile, docker-compose.yml) and type declarations (env.d.ts). The src/embeddings.js file is updated to consume these environment variables, configuring OpenAI embeddings with batch size, space settings, document validation, and model selection from environment defaults.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes follow a consistent, largely homogeneous pattern of adding the same three environment variables across configuration and type files, which reduces review complexity. However, the implementation changes in src/embeddings.js introduce multiple logic additions (baseURL configuration, model name selection, batch size, document validation, vector store space setting) that require verification for correctness and compatibility with the OpenAI client library, contributing moderate complexity overall.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat: Add optional model configuration" directly and accurately reflects the main changes in the pull request. The changeset adds three new optional environment variables across multiple configuration files (.env.example, Dockerfile, docker-compose.yml, env.d.ts) that configure OpenAI model settings, including base URL, model name, and embedding model. The title is concise, clear, and specific enough that a teammate scanning the history would understand this PR introduces optional model configuration without being overly verbose or generic.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Oct 22 '25 07:10 coderabbitai[bot]