Skip to main content

A local-first AI workspace for long-form fiction writing.

Project description

OmniFic Backend

Python FastAPI 后端,提供 REST/SSE API、Agent Runtime、Socket.IO 实时事件、后台任务、检索和数据库管理。

技术栈

  • Python 3.12+
  • FastAPI — Web 框架
  • SQLAlchemy / SQLModel — ORM + 数据库模型
  • SQLite — 本地数据库
  • LangChain / LangGraph — Agent 框架
  • ZeroMQ — 后台任务通信
  • httpx — HTTP 客户端
  • LanceDB / FastEmbed — RAG 检索与嵌入

项目结构

backend/app/
├── api/routers/      # REST API 路由
├── agent_runtime/    # Agent 运行时(图、工具、上下文)
├── storage/          # 数据模型、仓库、服务
├── models/           # LLM 客户端、提供商、目录
├── retrieval/        # 章节索引、语义检索与重排
├── background/       # 后台任务、ZeroMQ 传输与事件
├── memory/           # 章节摘要与提示词链运行
├── audit/            # LLM 与工具调用审计
├── macro/            # 提示词宏解析与编译
├── skills/           # Skill 加载
├── socket/           # Socket.IO 服务与事件处理
├── core/             # 工具函数(TXT 解析、文档解析、错误)
├── settings.py       # 应用配置
└── main.py           # 入口

快速开始

普通用户可以直接安装包含 Web 前端的 PyPI 包:

python -m pip install --upgrade omnific
omnific serve

源码开发:

cd backend
uv sync
uv run uvicorn app.main:app --host 127.0.0.1 --port 8001 --app-dir .

PyPI 包默认监听 http://127.0.0.1:8000,数据目录为 ~/.omnific。完整发行渠道说明见docs/installation.md

环境变量

变量 默认值 说明
OMNIFIC_SERVER_HOST 127.0.0.1 监听地址
OMNIFIC_SERVER_PORT 8000 监听端口
OMNIFIC_DATA_DIR backend/data 数据目录
OMNIFIC_FRONTEND_DIST frontend/dist 前端构建产物路径

数据库迁移

alembic -c alembic.ini upgrade head
alembic -c alembic.ini revision --autogenerate -m "description"
alembic -c alembic.ini downgrade -1

测试

pytest
pytest tests/api/test_tasks.py -v

API 路由

前缀 模块
/api/v1/projects 项目管理
/api/v1/projects/{project_id}/volumes 卷管理
/api/v1/projects/{project_id}/chapters, /api/v1/chapters/{chapter_id} 章节管理
/api/v1/projects/{project_id}/notes, /api/v1/notes/{note_id} 笔记管理
/api/v1/characters 角色管理
/api/v1/world-info, /api/v1/projects/{project_id}/world-info 世界书与条目
/api/v1/models, /api/v1/model-providers 模型与供应商
/api/v1/settings 用户设置
/api/v1/prompt-chains 提示词链与版本
/api/v1/skills, /api/v1/agent-rules Skill 与规则
/api/v1/agent-definitions, /api/v1/agent-memories Agent 配置与记忆
/api/v1/agent, /api/v1/tasks Agent 会话与任务
/api/v1/import TXT 导入(SSE 进度)
/api/v1/retrieval/index, /api/v1/projects/{project_id}/retrieval/index 章节检索索引
/api/v1/background, /api/v1/dashboard, /api/v1/audit-logs 后台任务、仪表盘与审计

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omnific-0.8.1.tar.gz (48.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omnific-0.8.1-py3-none-any.whl (48.5 MB view details)

Uploaded Python 3

File details

Details for the file omnific-0.8.1.tar.gz.

File metadata

  • Download URL: omnific-0.8.1.tar.gz
  • Upload date:
  • Size: 48.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for omnific-0.8.1.tar.gz
Algorithm Hash digest
SHA256 4bf07d90616002a1380a9248a4b99675f554d269acad61004e5c8fb1d1bb7f8f
MD5 733374c9320b4c35e31e28a14dc34f37
BLAKE2b-256 894eaefc611776c62c207dcedc39f2465dcf91772885e2ef1004104309cf3233

See more details on using hashes here.

Provenance

The following attestation bundles were made for omnific-0.8.1.tar.gz:

Publisher: package.yml on F0rJay/OmniFic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file omnific-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: omnific-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 48.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for omnific-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44af282ff5afb27d1cd0ded186a244fa647b475b4de65681be9b2eacfc798d3e
MD5 ab1f2be3c06189ae333163d7f64377b3
BLAKE2b-256 b30d407d28c18a267af77fde5fef656b550c8565da9ff465b5638ba6c55c7af9

See more details on using hashes here.

Provenance

The following attestation bundles were made for omnific-0.8.1-py3-none-any.whl:

Publisher: package.yml on F0rJay/OmniFic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page