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.1.tar.gz (50.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.1-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jixing-1.0.1.tar.gz
  • Upload date:
  • Size: 50.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.1.tar.gz
Algorithm Hash digest
SHA256 93c53b649bded2101ba600b62e2d974e743287bef261ad307f972f4de0e748f3
MD5 fd56af6dede04a213a9412c9f7f2339f
BLAKE2b-256 7723b5c7a2da93ff52cdbc287687441ed0631781c9332cd13da39eefb8e02f12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jixing-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 39.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4dadbb3e2cf9244d0349135a712464f703594dc4f20f274bd31a780ef0eb207
MD5 237025724da9239d9a70d0177a17b69a
BLAKE2b-256 3c005c64a35358c11e1513b2aee7bd3f3170c5bae8fc7f9c9e40a7bdd315c828

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