Skip to content

Feat/gitea connector#12

Open
loryanstrant wants to merge 3 commits into
open-webui:mainfrom
loryanstrant:feat/gitea-connector
Open

Feat/gitea connector#12
loryanstrant wants to merge 3 commits into
open-webui:mainfrom
loryanstrant:feat/gitea-connector

Conversation

@loryanstrant

Copy link
Copy Markdown

This pull request introduces a new Gitea source connector to sync repositories from self-hosted Gitea instances into Open WebUI Knowledge Bases. The Gitea connector supports both single-repo and wildcard (all repos for an owner/org) syncing, with branch and subdirectory scoping, and uses Gitea's API for efficient incremental syncs. The documentation, CLI, and test suite have been updated accordingly. Additionally, minor robustness improvements were made to handle empty file lists in API responses.

Gitea Connector Integration:

  • Added a new GiteaConnector in src/oikb/connectors/gitea.py to support syncing from Gitea repositories, including wildcard owner/org sources (gitea:owner/*) that sync all repositories under an owner, with files prefixed by repository name to avoid path collisions. Supports branch and subdirectory scoping, and uses the Gitea API for incremental sync checksums and file downloads.
  • Updated the CLI (src/oikb/cli.py) to dispatch gitea: sources to the new connector, and clarified branch option help text to refer to "Git repository sources" instead of just GitHub. [1] [2] [3]

Documentation Updates:

  • Updated README.md and docs/guide.md to document the new Gitea connector, example usage, and increased the connector count to 45. Gitea is now listed in all relevant tables and usage examples, including support for wildcard syncing and required environment variables. [1] [2] [3] [4] [5] [6]

Robustness and Bugfixes:

  • Improved handling of files fields that may be None in API responses, ensuring that file lists default to empty lists to prevent errors in status reporting and file listing. [1] [2]

Testing:

  • Added comprehensive tests for the Gitea connector, including parsing, manifest building, wildcard repo handling, and file reading, as well as CLI integration tests.
  • Added a test to ensure the CLI status command handles null files fields gracefully.

Changelog and Versioning:

  • Updated CHANGELOG.md for versions 0.3.7 and 0.3.8 to document the addition of the Gitea connector and wildcard syncing.
  • Bumped version numbers in pyproject.toml and src/oikb/__init__.py to 0.3.8. [1] [2]

Copilot AI review requested due to automatic review settings June 2, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds first-class Gitea support and improves CLI/client robustness when a KB returns files: null, along with corresponding docs/version updates.

Changes:

  • Introduce a new GiteaConnector (including wildcard gitea:owner/*) and CLI source resolution support.
  • Fix files handling in CLI status and client to treat null as an empty list.
  • Add/adjust tests and documentation; bump version to 0.3.8.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/oikb/connectors/gitea.py Adds Gitea connector implementation (tree manifest + raw downloads + wildcard repo listing).
src/oikb/cli.py Routes gitea: sources to the new connector; improves --branch help text; handles files: null in status.
src/oikb/client.py Treats files: null as [] when listing KB files.
tests/test_gitea_connector.py Adds unit tests covering parsing, manifest building (path + pagination), wildcard behavior, and raw reads.
tests/test_cli_status.py Adds regression test for status when files is null.
docs/guide.md Documents Gitea usage and updates connector count/list.
README.md Updates connector count/list and adds Gitea examples.
CHANGELOG.md Documents new Gitea features for 0.3.7/0.3.8.
src/oikb/__init__.py Bumps library version to 0.3.8.
pyproject.toml Bumps project version to 0.3.8.
.gitignore Ignores .env.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +81 to +84
resp = self._http.get(
f"/repos/{self.owner}/{repo}/git/trees/{ref}",
params={"recursive": "true", "per_page": 100, "page": page},
)
Comment on lines +79 to +85
connector = GiteaConnector(
owner="owner",
repo="repo",
branch="main",
path="docs",
base_url="https://gitea.example.com",
)
while True:
resp = self._http.get(
f"/repos/{self.owner}/{repo}/git/trees/{ref}",
params={"recursive": "true", "per_page": 100, "page": page},
page = 1

while True:
resp = self._http.get(f"/orgs/{self.owner}/repos", params={"page": page, "limit": 50})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants