Skip to main content

本地大语言模型对话的持久记忆与回溯系统

Project description

JiXing

Local AI Model Assistant with Long-term Memory System.

A unified tool to run local AI models (Ollama, Moxing) with complete logging of all interactions for later retrieval.

Features

  • Multi-Provider Support: Run models from Ollama and Moxing with unified interface
  • Complete Logging: Records all prompts, responses, timestamps, system info, and performance metrics
  • Long-term Memory: SQLite-based storage for searching through all past interactions
  • Web Interface: Optional Flask-based web UI for browsing sessions and searching messages
  • CLI Interface: Full-featured command-line tool with subcommands
  • Python API: Programmatic access via ToolResult pattern
  • OpenAI Function Calling: Integrate with OpenAI agents via function tool definitions

Requirements

  • Python 3.10+
  • Ollama (optional, for Ollama model support)
  • Moxing (optional, for GGUF model support)
  • Flask (optional, for web interface)

Installation

pip install -e .

Quick Start

CLI Usage

Run an Ollama model:

jixing ollama run gemma3:1b "Hello, how are you?"

Run in interactive mode:

jixing ollama run gemma3:1b -i

Run a Moxing (GGUF) model:

jixing moxing serve gguf-model-name "Your prompt here"

List all sessions:

jixing sessions list

Search through message history:

jixing search "previous conversation about Python"

Show statistics:

jixing stats

Start web interface:

jixing web --port 5000

Python API

from jixing import run_ollama, query_sessions, ToolResult

result = run_ollama(model="gemma3:1b", prompt="Hello!")
print(result.success)    # True / False
print(result.data)       # Response data
print(result.metadata)   # Metadata including version

CLI Help

$ jixing --help
usage: jixing [-h] [-V] [-v] [-o OUTPUT] [--json] [-q] {ollama,moxing,sessions,search,stats,info,web} ...

positional arguments:
  {ollama,moxing,sessions,search,stats,info,web}
    ollama              Run Ollama model
    moxing              Run Moxing model
    sessions            Manage sessions
    search              Search message history
    stats               Show statistics
    info                Show system information
    web                 Start web interface

options:
  -V, --version         Show version
  -v, --verbose         Verbose output
  -o, --output OUTPUT   Output path
  --json                Output results as JSON
  -q, --quiet           Suppress non-essential output

Architecture

jixing/
├── jixing/
│   ├── __init__.py     # Package exports
│   ├── __version__.py  # Version info
│   ├── core.py         # Core logic, Session, ModelRunner
│   ├── api.py          # ToolResult API functions
│   ├── cli.py          # CLI interface
│   ├── db.py           # SQLite database
│   ├── models/         # Model adapters
│   ├── tools.py        # OpenAI function definitions
│   └── web.py          # Flask web interface
├── tests/
├── pyproject.toml
└── README.md

Agent Integration

Integrate JiXing with OpenAI function-calling agents:

from openai import OpenAI
from jixing.tools import TOOLS, dispatch

client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Run Ollama model gemma3:1b with prompt 'Hello'"}],
    tools=TOOLS,
)

for tool_call in response.choices[0].message.tool_calls:
    result = dispatch(tool_call.function.name, tool_call.function.arguments)
    # Feed result back to LLM...

License

GPL-3.0

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

jixing-1.0.4.tar.gz (74.7 kB view details)

Uploaded Source

Built Distribution

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

jixing-1.0.4-py3-none-any.whl (57.4 kB view details)

Uploaded Python 3

File details

Details for the file jixing-1.0.4.tar.gz.

File metadata

  • Download URL: jixing-1.0.4.tar.gz
  • Upload date:
  • Size: 74.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for jixing-1.0.4.tar.gz
Algorithm Hash digest
SHA256 3a4933c09239a14847f1c9c1f8583df1fe43d43728f9ee88f68e94426de8b208
MD5 2b72fade8e8e62df70564689bbd0b4f3
BLAKE2b-256 91f5fed35ff4c5d1cd7624e8298589f686af42ffac274fff372d1cd069bf0609

See more details on using hashes here.

File details

Details for the file jixing-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: jixing-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 57.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for jixing-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4c20c00f800908ebd6e9c1801b6b93d28a58c0b7c604729d2fe156be02362e16
MD5 4ceeb2eecbd1b70a74af4c578659452a
BLAKE2b-256 a33591ecf062b8522109f85d7e49d9e3a5bba872df922477e4e34c521cc646dc

See more details on using hashes here.

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