Skip to content

fix paths for api/v1#117

Merged
wangxingjun778 merged 1 commit intomainfrom
feat/sse
Mar 20, 2026
Merged

fix paths for api/v1#117
wangxingjun778 merged 1 commit intomainfrom
feat/sse

Conversation

@wangxingjun778
Copy link
Copy Markdown
Member

@wangxingjun778 wangxingjun778 commented Mar 20, 2026

  • Flexible paths parameter: The /api/v1/search and /api/v1/search/stream endpoints now accept the paths parameter as either a single string or an array of strings. This provides more flexibility for specifying search directories or files.
  • Optional paths parameter with fallback logic: The paths parameter is now optional. If omitted, null, an empty string, an empty list, or a list containing only blank strings, the server will fall back to using the SIRCHMUNK_SEARCH_PATHS environment variable. If that is also unset, it defaults to the server process's current working directory. Explicit non-empty paths in the request take precedence.
  • API Documentation Updates: The README.md and README_zh.md files have been extensively updated to reflect the new paths parameter behavior, including detailed rules, new cURL examples, and modifications to Python and JavaScript client examples to correctly handle API responses.
  • Parameter Renaming: The keyword_levels parameter has been replaced with max_loops in the API documentation, indicating a change in the underlying search mechanism for DEEP mode.
  • Internal Path Normalization: A new internal utility function, _normalize_api_paths, was introduced to consistently process and resolve the paths parameter received from API requests, ensuring proper fallback logic.

@wangxingjun778 wangxingjun778 merged commit 46a001b into main Mar 20, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the usability and flexibility of the API's search functionality by making the paths parameter more adaptable. It allows users to specify search locations more intuitively, with robust fallback mechanisms, and ensures that all documentation and client examples are up-to-date with these changes. The update also refines search parameters for DEEP mode, improving clarity and control over the search process.

Highlights

  • Flexible paths parameter: The /api/v1/search and /api/v1/search/stream endpoints now accept the paths parameter as either a single string or an array of strings. This provides more flexibility for specifying search directories or files.
  • Optional paths parameter with fallback logic: The paths parameter is now optional. If omitted, null, an empty string, an empty list, or a list containing only blank strings, the server will fall back to using the SIRCHMUNK_SEARCH_PATHS environment variable. If that is also unset, it defaults to the server process's current working directory. Explicit non-empty paths in the request take precedence.
  • API Documentation Updates: The README.md and README_zh.md files have been extensively updated to reflect the new paths parameter behavior, including detailed rules, new cURL examples, and modifications to Python and JavaScript client examples to correctly handle API responses.
  • Parameter Renaming: The keyword_levels parameter has been replaced with max_loops in the API documentation, indicating a change in the underlying search mechanism for DEEP mode.
  • Internal Path Normalization: A new internal utility function, _normalize_api_paths, was introduced to consistently process and resolve the paths parameter received from API requests, ensuring proper fallback logic.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the search API by allowing the paths parameter to be either a single string or a list of strings, increasing its flexibility. The implementation includes updating the request model, adding a path normalization function, and improving logging. The documentation in README.md and README_zh.md has been updated accordingly to reflect these API changes. The changes are well-executed. I have one suggestion to improve the conciseness of the path normalization logic.

Comment on lines +222 to +228
cleaned: List[str] = []
for p in paths:
if not isinstance(p, str):
continue
s = p.strip()
if s:
cleaned.append(s)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For improved readability and conciseness, you can use a list comprehension to filter and clean the paths. This is a more Pythonic way to achieve the same result.

Suggested change
cleaned: List[str] = []
for p in paths:
if not isinstance(p, str):
continue
s = p.strip()
if s:
cleaned.append(s)
cleaned = [s for p in paths if isinstance(p, str) and (s := p.strip())]

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.

1 participant