Spaces:
Running
Running
File size: 2,109 Bytes
69937e1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# models.py
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Union
@dataclass
class Asset:
type: str
uri: str
name: str = ""
ext: str = "unknown"
@dataclass
class Decorator:
name: str
value: Optional[str] = None
fallback: Optional['Decorator'] = None
@dataclass
class LorebookEntry:
keys: List[str]
content: str
enabled: bool
insertion_order: int
use_regex: bool = False
constant: Optional[bool] = None
selective: Optional[bool] = None
secondary_keys: Optional[List[str]] = None
position: Optional[str] = None
decorators: List[Decorator] = field(default_factory=list)
# Optional Fields
name: Optional[str] = None
priority: Optional[int] = None
id: Optional[Union[int, str]] = None
comment: Optional[str] = None
@dataclass
class Lorebook:
name: Optional[str] = None
description: Optional[str] = None
scan_depth: Optional[int] = None
token_budget: Optional[int] = None
recursive_scanning: Optional[bool] = None
extensions: Dict[str, Any] = field(default_factory=dict)
entries: List[LorebookEntry] = field(default_factory=list)
@dataclass
class CharacterCardV3Data:
name: str
description: str
tags: List[str]
creator: str
character_version: str
mes_example: str
extensions: Dict[str, Any]
system_prompt: str
post_history_instructions: str
first_mes: str
alternate_greetings: List[str]
personality: str
scenario: str
creator_notes: str
character_book: Optional[Lorebook] = None
assets: List[Asset] = field(default_factory=list)
nickname: Optional[str] = None
creator_notes_multilingual: Optional[Dict[str, str]] = None
source: Optional[List[str]] = None
group_only_greetings: List[str] = field(default_factory=list)
creation_date: Optional[int] = None
modification_date: Optional[int] = None
@dataclass
class CharacterCardV3:
spec: str
spec_version: str
data: CharacterCardV3Data |