Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webserver): include whole file content for code reference (#3247)
* 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