diff --git a/backend/app/api/v1/endpoints/agent_tasks.py b/backend/app/api/v1/endpoints/agent_tasks.py index f278513..126b67d 100644 --- a/backend/app/api/v1/endpoints/agent_tasks.py +++ b/backend/app/api/v1/endpoints/agent_tasks.py @@ -292,6 +292,7 @@ async def _execute_agent_task(task_id: str): other_config = (user_config or {}).get('otherConfig', {}) github_token = other_config.get('githubToken') or settings.GITHUB_TOKEN gitlab_token = other_config.get('gitlabToken') or settings.GITLAB_TOKEN + gitea_token = other_config.get('giteaToken') or settings.GITEA_TOKEN # 获取项目根目录(传递任务指定的分支和认证 token) # 🔥 传递 event_emitter 以发送克隆进度 @@ -301,6 +302,7 @@ async def _execute_agent_task(task_id: str): task.branch_name, github_token=github_token, gitlab_token=gitlab_token, + gitea_token=gitea_token, # 🔥 新增 event_emitter=event_emitter, # 🔥 新增 ) @@ -2213,6 +2215,7 @@ async def _get_project_root( branch_name: Optional[str] = None, github_token: Optional[str] = None, gitlab_token: Optional[str] = None, + gitea_token: Optional[str] = None, # 🔥 新增 event_emitter: Optional[Any] = None, # 🔥 新增:用于发送实时日志 ) -> str: """ @@ -2228,6 +2231,7 @@ async def _get_project_root( branch_name: 分支名称(仓库项目使用,优先于 project.default_branch) github_token: GitHub 访问令牌(用于私有仓库) gitlab_token: GitLab 访问令牌(用于私有仓库) + gitea_token: Gitea 访问令牌(用于私有仓库) event_emitter: 事件发送器(用于发送实时日志) Returns: @@ -2476,6 +2480,16 @@ async def _get_project_root( parsed.fragment )) await emit(f"🔐 使用 GitLab Token 认证") + elif repo_type == "gitea" and gitea_token: + auth_url = urlunparse(( + parsed.scheme, + f"{gitea_token}@{parsed.netloc}", + parsed.path, + parsed.params, + parsed.query, + parsed.fragment + )) + await emit(f"🔐 使用 Gitea Token 认证") for branch in branches_to_try: check_cancelled() diff --git a/backend/app/services/rag/splitter.py b/backend/app/services/rag/splitter.py index 184db35..65d4f16 100644 --- a/backend/app/services/rag/splitter.py +++ b/backend/app/services/rag/splitter.py @@ -154,7 +154,7 @@ class TreeSitterParser: ".c": "c", ".h": "c", ".hpp": "cpp", - ".cs": "c_sharp", + ".cs": "csharp", ".php": "php", ".rb": "ruby", ".kt": "kotlin", @@ -197,7 +197,7 @@ class TreeSitterParser: # tree-sitter-languages 支持的语言列表 SUPPORTED_LANGUAGES = { "python", "javascript", "typescript", "tsx", "java", "go", "rust", - "c", "cpp", "c_sharp", "php", "ruby", "kotlin", "swift", "bash", + "c", "cpp", "csharp", "php", "ruby", "kotlin", "swift", "bash", "json", "yaml", "html", "css", "sql", "markdown", }