-
Notifications
You must be signed in to change notification settings - Fork 969
feat:support cnb repo #303
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
jaguarliuu
wants to merge
4
commits into
AsyncFuncAI:main
Choose a base branch
from
jaguarliuu: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.
+1,681,977
−393
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
The diff you're trying to view is too large. We only load the first 3000 changed files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"i18n-ally.localesPaths": [ | ||
"src/messages" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import os | ||
from typing import Tuple | ||
|
||
|
||
def get_adalflow_default_root_path() -> str: | ||
""" | ||
Get the default root path for adalflow data storage. | ||
|
||
Returns: | ||
str: The default root path | ||
""" | ||
return os.path.expanduser("~/.adalflow") | ||
|
||
|
||
def extract_repo_name_from_url(repo_url: str, repo_type: str) -> str: | ||
""" | ||
Extract repository name from URL to create a unique identifier. | ||
This function provides consistent repo name generation across the application. | ||
|
||
Args: | ||
repo_url (str): The repository URL | ||
repo_type (str): The type of repository (github, gitlab, bitbucket, cnb, web, local) | ||
|
||
Returns: | ||
str: The repository name identifier | ||
|
||
Examples: | ||
For GitHub: https://github.com/owner/repo -> "owner_repo" | ||
For CNB: https://cnb.cool/opencamp/learning-docker/project-1-jupyter -> "project-1-jupyter" | ||
For GitLab: https://gitlab.com/group/subgroup/repo -> "subgroup_repo" | ||
""" | ||
# Extract parts from URL | ||
url_parts = repo_url.rstrip('/').split('/') | ||
|
||
if repo_type in ["github", "gitlab", "bitbucket"] and len(url_parts) >= 5: | ||
# Traditional git hosting services: use owner_repo format | ||
# GitHub URL format: https://github.com/owner/repo | ||
# GitLab URL format: https://gitlab.com/owner/repo or https://gitlab.com/group/subgroup/repo | ||
# Bitbucket URL format: https://bitbucket.org/owner/repo | ||
owner = url_parts[-2] | ||
repo = url_parts[-1].replace(".git", "") | ||
repo_name = f"{owner}_{repo}" | ||
else: | ||
# For CNB and other web-based repositories: use only the repo name | ||
# This handles cases like https://cnb.cool/opencamp/learning-docker/project-1-jupyter | ||
# where the directory structure is complex but we only want the final repo name | ||
repo_name = url_parts[-1].replace(".git", "") | ||
|
||
return repo_name | ||
|
||
|
||
def get_repo_local_path(repo_url: str, repo_type: str) -> str: | ||
""" | ||
Get the local path for a repository based on its URL and type. | ||
|
||
Args: | ||
repo_url (str): The repository URL | ||
repo_type (str): The type of repository (github, gitlab, bitbucket, cnb, web, local) | ||
|
||
Returns: | ||
str: The local path where the repository should be stored | ||
""" | ||
root_path = get_adalflow_default_root_path() | ||
repo_name = extract_repo_name_from_url(repo_url, repo_type) | ||
return os.path.join(root_path, "repos", repo_name) |
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
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
batch_size
has been drastically reduced from 500 to 10. This change may significantly degrade the performance of the document embedding process by increasing the number of API calls required. If this reduction is necessary for stability or model constraints, it would be beneficial to add a comment explaining the reason.