mirror of
https://github.com/open-webui/oikb.git
synced 2026-07-09 16:00:53 +00:00
chore: bump v0.2.2 — named entries, /sync/{identifier} endpoint
This commit is contained in:
parent
f588d8a63f
commit
e450c6ede4
4 changed files with 21 additions and 11 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
## [0.2.2] - 2025-05-21
|
||||
|
||||
### Added
|
||||
|
||||
- `name` key for `.oikb.yaml` entries — use friendly names to target syncs via CLI (`--name wiki`) or API (`POST /sync/wiki`).
|
||||
|
||||
### Changed
|
||||
|
||||
- Daemon sync endpoint changed from `/sync/{source}` to `/sync/{identifier}` — accepts `name` or `kb-id` (UUIDs).
|
||||
|
||||
## [0.2.1] - 2025-05-20
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "oikb"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
description = "Sync anything to Open WebUI Knowledge Bases"
|
||||
readme = "README.md"
|
||||
authors = [
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ def sync(
|
|||
|
||||
# Filter by --name if specified.
|
||||
if name:
|
||||
entries = [e for e in entries if e.get("kb-id") == name or e.get("source") == name]
|
||||
entries = [e for e in entries if e.get("name") == name or e.get("kb-id") == name]
|
||||
if not entries:
|
||||
click.echo(click.style(f"No entry matching '{name}' in .oikb.yaml", fg="red"), err=True)
|
||||
sys.exit(1)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ async def verify_api_key(
|
|||
app = FastAPI(
|
||||
title="oikb",
|
||||
description="Sync engine for Open WebUI Knowledge Bases. Trigger syncs, check status, and query history.",
|
||||
version="0.2.1",
|
||||
version="0.2.2",
|
||||
)
|
||||
|
||||
# Runtime state populated by start_daemon().
|
||||
|
|
@ -103,18 +103,18 @@ async def history_endpoint(
|
|||
|
||||
|
||||
@app.post(
|
||||
"/sync/{source}",
|
||||
"/sync/{identifier}",
|
||||
operation_id="trigger_sync",
|
||||
summary="Trigger an immediate sync for a source",
|
||||
summary="Trigger an immediate sync by alias or KB ID",
|
||||
dependencies=[Depends(verify_api_key)],
|
||||
)
|
||||
async def trigger_sync(source: str):
|
||||
"""Triggers an immediate sync for the given source or Knowledge Base ID. The sync runs asynchronously in the background. Use get_sync_status to check progress."""
|
||||
async def trigger_sync(identifier: str):
|
||||
"""Triggers an immediate sync matching the given alias or Knowledge Base ID. The sync runs asynchronously in the background. Use get_sync_status to check progress."""
|
||||
for entry in _entries:
|
||||
if entry.get("source") == source or entry.get("kb-id") == source:
|
||||
if entry.get("name") == identifier or entry.get("kb-id") == identifier:
|
||||
asyncio.create_task(_run_entry(entry))
|
||||
return {"triggered": True, "source": entry.get("source")}
|
||||
return {"triggered": False, "error": f"No entry matching '{source}'"}
|
||||
return {"triggered": True, "name": entry.get("name"), "kb_id": entry.get("kb-id")}
|
||||
return {"triggered": False, "error": f"No entry matching '{identifier}'"}
|
||||
|
||||
|
||||
# ── Scheduler ────────────────────────────────────────────────────
|
||||
|
|
@ -276,7 +276,7 @@ def start_daemon(
|
|||
click.echo(f" {len(webhook_entries)} webhook-enabled source(s)")
|
||||
click.echo(f" GET http://localhost:{port}/health")
|
||||
click.echo(f" GET http://localhost:{port}/history")
|
||||
click.echo(f" POST http://localhost:{port}/sync/{{source}}")
|
||||
click.echo(f" POST http://localhost:{port}/sync/{{kb_id}}")
|
||||
if webhook_entries:
|
||||
click.echo(f" POST http://localhost:{port}/webhooks/github|gitlab|slack|confluence")
|
||||
click.echo(f"\n OpenAPI spec: http://localhost:{port}/openapi.json")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue