Skip to content

Commit

Permalink
feat(webserver): include whole file content for code reference (#3247)
Browse files Browse the repository at this point in the history
* feat(webserver): add repository service to Webserver

The code changes add the repository service to the Webserver implementation. This allows the Webserver to interact with the repository for various operations.

Note: The commit message format follows the convention used in the recent repository commits.

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* feat: add resolve_repository_by_source_id method to RepositoryService

This commit adds the resolve_repository_by_source_id method to the RepositoryService trait in the tabby-schema crate. This method allows resolving a repository by its source ID, providing access to the repository for various operations.

Note: The commit message format follows the convention used in the recent repository commits.

* [autofix.ci] apply automated fixes

* refactor: merge code snippets in AnswerService

This commit refactors the `merge_code_snippets` method in the `AnswerService` to improve code readability and maintainability. The method now takes a list of `CodeSearchHit` objects and merges them based on the file path. It also handles cases where there are multiple hits for the same file, extracting relevant lines of code and calculating average scores. This change enhances the efficiency and accuracy of code snippet merging in the AnswerService.

Note: The commit message format follows the convention used in the recent repository commits.

* docs: adding comments into merge_code_snippets

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* refactor: move merge_snippet as single function

* Update ee/tabby-webserver/src/service/answer.rs

* Update ee/tabby-webserver/src/service/answer.rs

* refactor: extract read_file_content, avoid repeat call repo, group by sourceid+filepath

* fix: fixing test bug after merge main branch

* [autofix.ci] apply automated fixes

* to: adding global repos cache and adding clone methods for repository and GitReference

* [autofix.ci] apply automated fixes

* chore: adding derive clone remove unused methods

* refactor(answer): remove global repos caches, find it before merge_snippets

* [autofix.ci] apply automated fixes

* refactor: extract read_file_content, avoid repeat call repo, group by sourceid+filepath

to: adding back error log

* [autofix.ci] apply automated fixes

* refactor: improve file reading performance and error handling in read_file_content, return raw string content

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* simplify implementation

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Meng Zhang <[email protected]>
  • Loading branch information
3 people authored Oct 21, 2024
1 parent ff3410d commit 4f5bf3a
Show file tree
Hide file tree
Showing 4 changed files with 245 additions and 16 deletions.
Loading

0 comments on commit 4f5bf3a

Please sign in to comment.