mirror of
https://github.com/open-webui/oikb.git
synced 2026-10-19 07:13:34 +00:00
0.3.3: oikb init interactive wizard
Generates .oikb.yaml by prompting for source, KB ID, name, and interval. Outputs next-step commands (validate, sync, daemon). Updated README Quick Start to lead with init.
This commit is contained in:
parent
878e797b5f
commit
9d0a6ae0c0
6 changed files with 74 additions and 7 deletions
|
|
@ -4,6 +4,12 @@ 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.3.3] - 2025-05-21
|
||||
|
||||
### Added
|
||||
|
||||
- `oikb init` — interactive wizard that generates `.oikb.yaml`. Prompts for source, KB ID, name, and interval. Outputs next-step commands. Reduces onboarding from "read docs and write YAML" to "answer 4 questions."
|
||||
|
||||
## [0.3.2] - 2025-05-21
|
||||
|
||||
### Added
|
||||
|
|
|
|||
15
README.md
15
README.md
|
|
@ -13,17 +13,24 @@ pip install oikb
|
|||
export OPEN_WEBUI_URL=http://localhost:3000
|
||||
export OPEN_WEBUI_API_KEY=sk-your-api-key
|
||||
|
||||
# Sync a directory to a Knowledge Base
|
||||
oikb sync ./docs --kb-id your-kb-id
|
||||
# Generate a config file
|
||||
oikb init
|
||||
|
||||
# Or watch for changes and auto-sync continuously
|
||||
oikb watch ./docs --kb-id your-kb-id
|
||||
# Preview what would sync
|
||||
oikb sync --dry-run
|
||||
|
||||
# Run the sync
|
||||
oikb sync
|
||||
|
||||
# Or start the daemon for scheduled sync
|
||||
oikb daemon
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
|---|---|
|
||||
| `oikb init` | Generate `.oikb.yaml` interactively |
|
||||
| `oikb sync <source>` | Incremental sync to a Knowledge Base |
|
||||
| `oikb watch <dir>` | Watch for changes and auto-sync |
|
||||
| `oikb daemon` | Long-lived scheduler with HTTP API |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "oikb"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
description = "Sync anything to Open WebUI Knowledge Bases"
|
||||
readme = "README.md"
|
||||
authors = [
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
"""oikb — Open WebUI Knowledge Base CLI."""
|
||||
|
||||
__version__ = "0.3.2"
|
||||
__version__ = "0.3.3"
|
||||
|
|
|
|||
|
|
@ -772,6 +772,60 @@ def config_get(key: str | None):
|
|||
click.echo("(not set)")
|
||||
|
||||
|
||||
# ── init ────────────────────────────────────────────────────────
|
||||
|
||||
@cli.command()
|
||||
@click.option("--force", is_flag=True, help="Overwrite existing .oikb.yaml.")
|
||||
def init(force: bool):
|
||||
"""Generate a .oikb.yaml config file interactively.
|
||||
|
||||
\b
|
||||
Asks for source, Knowledge Base ID, name, and interval,
|
||||
then writes a ready-to-use config file.
|
||||
"""
|
||||
yaml_path = Path(".oikb.yaml")
|
||||
if yaml_path.exists() and not force:
|
||||
click.echo(click.style(f"{yaml_path} already exists. Use --force to overwrite.", fg="red"), err=True)
|
||||
sys.exit(1)
|
||||
|
||||
click.echo(click.style("oikb init — generate .oikb.yaml\n", bold=True))
|
||||
|
||||
entries: list[dict] = []
|
||||
while True:
|
||||
click.echo(click.style(f"─ Source #{len(entries) + 1}", fg="cyan"))
|
||||
|
||||
source = click.prompt(
|
||||
" Source (e.g. ./docs, github:owner/repo, confluence:SPACE)",
|
||||
type=str,
|
||||
)
|
||||
kb_id = click.prompt(" Knowledge Base ID", type=str)
|
||||
name = click.prompt(" Name (short alias)", default=source.split(":")[-1].split("/")[-1], type=str)
|
||||
interval = click.prompt(" Sync interval (daemon mode)", default="1h", type=str)
|
||||
|
||||
entries.append({
|
||||
"name": name,
|
||||
"source": source,
|
||||
"kb-id": kb_id,
|
||||
"interval": interval,
|
||||
})
|
||||
|
||||
if not click.confirm("\n Add another source?", default=False):
|
||||
break
|
||||
click.echo()
|
||||
|
||||
import yaml
|
||||
|
||||
data: dict = {"sources": entries}
|
||||
yaml_path.write_text(yaml.dump(data, default_flow_style=False, sort_keys=False))
|
||||
|
||||
click.echo(f"\n{click.style('✓', fg='green')} Wrote {yaml_path}")
|
||||
click.echo(f"\n {click.style('Next steps:', bold=True)}")
|
||||
click.echo(f" oikb validate # check your config")
|
||||
click.echo(f" oikb sync # run a one-time sync")
|
||||
click.echo(f" oikb sync --dry-run # preview without uploading")
|
||||
click.echo(f" oikb daemon # start scheduled sync")
|
||||
|
||||
|
||||
# ── validate ────────────────────────────────────────────────────
|
||||
|
||||
@cli.command()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,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.3.2",
|
||||
version="0.3.3",
|
||||
)
|
||||
|
||||
# Runtime state populated by start_daemon().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue