chore: project foundation
Contracts (the shared language): - percept / state / context / utterance / render / audio / capabilities - Capability model instead of vendor schemas (see below) Providers (capability-based abstraction): - LLM + Embedding: OpenAI-compatible shape IS the standard, adopted directly - ASR: internal contract is an event stream (partial -> final), because /v1/audio/transcriptions has no partial and dialogue needs it for endpointing. OpenAI adapter degrades to supports_partial=False. - TTS: internal contract carries tags/emotion/style, because /v1/audio/speech has no paralinguistics and [laughter]/[breath] are the core of feeling alive. Unsupported providers are stripped AND reported via Degradation -- silent degradation is forbidden. - Avatar: no de-facto standard, custom RenderCmd protocol driven by State. Core: - mood: dynamical system, slow variables, negativity bias (grudge), numbing after prolonged negativity - bazi: four pillars -> numeric vector; 'ming' is data, not prose - projection: phi, system event -> in-world statement; uncovered events are counted as projection gaps Storage: - SQLite schema, three memory layers, dyad ledger - accessibility floor 0.03 (not 0): forgettable but still there Config split: - models.yaml is the ONLY place model versions live - character.yaml holds world rules / emotion params, no version numbers 58 tests pass; ruff clean.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
"""形象 providers。"""
|
||||
|
||||
from .base import AvatarProvider
|
||||
|
||||
__all__ = ["AvatarProvider"]
|
||||
@@ -0,0 +1,35 @@
|
||||
"""形象(avatar)provider 抽象。
|
||||
|
||||
形象没有任何事实标准(不像 LLM 有 OpenAI chat completions),
|
||||
所以这里必须自定义协议。
|
||||
|
||||
但有一条不可违反的约束:
|
||||
|
||||
驱动源必须是 **State**,不是 LLM 文本。
|
||||
|
||||
否则模型一句"我很难过"就会让它哭,而状态机的 v 可能还是 +0.2。
|
||||
多模态不一致比任何单通道质量差都更毁沉浸。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
from ...contracts import RenderCmd
|
||||
from ..base import Provider
|
||||
|
||||
|
||||
class AvatarProvider(Provider):
|
||||
"""形象后端。
|
||||
|
||||
第一版预期实现:VRM + three.js(浏览器渲染),
|
||||
通过 WebSocket 把 RenderCmd 发给前端。
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def apply(self, cmd: RenderCmd) -> None:
|
||||
"""应用一条渲染指令。必须幂等。"""
|
||||
|
||||
@abstractmethod
|
||||
async def aclose(self) -> None: # type: ignore[override]
|
||||
"""断开与渲染端的连接。"""
|
||||
Reference in New Issue
Block a user