-
Notifications
You must be signed in to change notification settings - Fork 1.8k
re-init #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Sir1002
wants to merge
1
commit into
AsyncFuncAI:main
Choose a base branch
from
Sir1002:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+27,168
−7,541
Open
re-init #503
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "DeepWiki: Install API", | ||
| "type": "shell", | ||
| "command": "poetry", | ||
| "args": [ | ||
| "-C", | ||
| "${workspaceFolder}/api", | ||
| "install" | ||
| ], | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| }, | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "dedicated" | ||
| }, | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "DeepWiki: API", | ||
| "type": "shell", | ||
| "command": "${workspaceFolder}/api/.venv/bin/python", | ||
| "args": [ | ||
| "-m", | ||
| "api.main" | ||
| ], | ||
| "options": { | ||
| "cwd": "${workspaceFolder}", | ||
| "env": { | ||
| "PYTHONPATH": "${workspaceFolder}" | ||
| } | ||
| }, | ||
| "isBackground": true, | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "dedicated" | ||
| }, | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "DeepWiki: Web", | ||
| "type": "shell", | ||
| "command": "env", | ||
| "args": [ | ||
| "-u", | ||
| "ELECTRON_RUN_AS_NODE", | ||
| "npm", | ||
| "run", | ||
| "dev" | ||
| ], | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| }, | ||
| "isBackground": true, | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "dedicated" | ||
| }, | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "DeepWiki: Start All", | ||
| "dependsOn": [ | ||
| "DeepWiki: API", | ||
| "DeepWiki: Web" | ||
| ], | ||
| "dependsOrder": "parallel" | ||
| }, | ||
| { | ||
| "label": "DeepWiki: Promptfoo Smoke", | ||
| "type": "shell", | ||
| "command": "npm", | ||
| "args": [ | ||
| "run", | ||
| "promptfoo:smoke" | ||
| ], | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| }, | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "dedicated" | ||
| }, | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "DeepWiki: Promptfoo Eval", | ||
| "type": "shell", | ||
| "command": "npm", | ||
| "args": [ | ||
| "run", | ||
| "promptfoo:eval" | ||
| ], | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| }, | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "dedicated" | ||
| }, | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "DeepWiki: Promptfoo View", | ||
| "type": "shell", | ||
| "command": "npm", | ||
| "args": [ | ||
| "run", | ||
| "promptfoo:view" | ||
| ], | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| }, | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "dedicated" | ||
| }, | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "DeepWiki: Promptfoo CI", | ||
| "type": "shell", | ||
| "command": "npm", | ||
| "args": [ | ||
| "run", | ||
| "promptfoo:ci" | ||
| ], | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| }, | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "dedicated" | ||
| }, | ||
| "problemMatcher": [] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -700,14 +700,35 @@ def get_file_content(repo_url: str, file_path: str, repo_type: str = None, acces | |||||||||||||||||||||
| Raises: | ||||||||||||||||||||||
| ValueError: If the file cannot be fetched or if the URL is not valid | ||||||||||||||||||||||
| """ | ||||||||||||||||||||||
| if repo_type == "local" or ( | ||||||||||||||||||||||
| repo_url | ||||||||||||||||||||||
| and not repo_url.startswith("http://") | ||||||||||||||||||||||
| and not repo_url.startswith("https://") | ||||||||||||||||||||||
| ): | ||||||||||||||||||||||
|
Comment on lines
+703
to
+707
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If
Suggested change
|
||||||||||||||||||||||
| repo_root = os.path.abspath(repo_url) | ||||||||||||||||||||||
| candidate_path = os.path.abspath(os.path.join(repo_root, file_path)) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Prevent path traversal outside the repository root. | ||||||||||||||||||||||
| if os.path.commonpath([repo_root, candidate_path]) != repo_root: | ||||||||||||||||||||||
| raise ValueError("Requested file path escapes the local repository root.") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if not os.path.isfile(candidate_path): | ||||||||||||||||||||||
| raise ValueError(f"Local file not found: {file_path}") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| try: | ||||||||||||||||||||||
| with open(candidate_path, "r", encoding="utf-8") as f: | ||||||||||||||||||||||
| return f.read() | ||||||||||||||||||||||
| except Exception as e: | ||||||||||||||||||||||
| raise ValueError(f"Failed to read local file content: {str(e)}") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if repo_type == "github": | ||||||||||||||||||||||
| return get_github_file_content(repo_url, file_path, access_token) | ||||||||||||||||||||||
| elif repo_type == "gitlab": | ||||||||||||||||||||||
| return get_gitlab_file_content(repo_url, file_path, access_token) | ||||||||||||||||||||||
| elif repo_type == "bitbucket": | ||||||||||||||||||||||
| return get_bitbucket_file_content(repo_url, file_path, access_token) | ||||||||||||||||||||||
| else: | ||||||||||||||||||||||
| raise ValueError("Unsupported repository type. Only GitHub, GitLab, and Bitbucket are supported.") | ||||||||||||||||||||||
| raise ValueError("Unsupported repository type. Only local, GitHub, GitLab, and Bitbucket are supported.") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| class DatabaseManager: | ||||||||||||||||||||||
| """ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path
/Users/samroku/dev/deepwiki-openis hardcoded. This makes the documentation and the default configuration specific to your local machine. Please use a placeholder or a relative path to ensure it works for other contributors.