fix:1.修复角色关系出现负值导致的问日

This commit is contained in:
xiamuceer
2025-11-13 11:58:05 +08:00
parent 4516a2bcf7
commit 4431855a14
4 changed files with 14 additions and 7 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ class CharacterRelationship(Base):
relationship_name = Column(String(100), comment="自定义关系名称")
# 关系属性
intimacy_level = Column(Integer, default=50, comment="亲密度:0-100")
intimacy_level = Column(Integer, default=50, comment="亲密度:-100到100")
status = Column(String(20), default="active", comment="状态:active/broken/past/complicated")
description = Column(Text, comment="关系详细描述")
+2 -2
View File
@@ -27,7 +27,7 @@ class CharacterRelationshipBase(BaseModel):
"""角色关系基础模型"""
relationship_type_id: Optional[int] = Field(None, description="关系类型ID")
relationship_name: Optional[str] = Field(None, description="自定义关系名称")
intimacy_level: int = Field(50, ge=0, le=100, description="亲密度:0-100")
intimacy_level: int = Field(50, ge=-100, le=100, description="亲密度:-100到100")
status: str = Field("active", description="状态:active/broken/past/complicated")
description: Optional[str] = Field(None, description="关系描述")
started_at: Optional[str] = Field(None, description="关系开始时间(故事时间)")
@@ -45,7 +45,7 @@ class CharacterRelationshipUpdate(BaseModel):
"""更新角色关系的请求模型"""
relationship_type_id: Optional[int] = None
relationship_name: Optional[str] = None
intimacy_level: Optional[int] = Field(None, ge=0, le=100)
intimacy_level: Optional[int] = Field(None, ge=-100, le=100)
status: Optional[str] = None
description: Optional[str] = None
started_at: Optional[str] = None
+2 -2
View File
@@ -248,7 +248,7 @@ class PromptService:
2. **关系约束**relationships_array只能引用本批次中已经出现的角色名称
3. **组织约束**organization_memberships只能引用本批次中is_organization=true的实体名称
4. **禁止幻觉**:不要引用任何不存在的角色或组织,如果没有可引用的就留空数组[]
5. intimacy_levelloyalty是0-100的整数
5. intimacy_level是-100到100的整数(负值表示敌对仇恨关系),loyalty是0-100的整数
6. 角色之间要形成合理的关系网络
**示例说明**
@@ -682,7 +682,7 @@ class PromptService:
**重要说明:**
1. relationships数组:只包含与上面列出的已存在角色的关系,通过target_character_name匹配
2. organization_memberships数组:只包含与上面列出的已存在组织的关系
3. intimacy_levelloyalty是0-100的整数
3. intimacy_level是-100到100的整数(负值表示敌对、仇恨等关系),loyalty是0-100的整数
4. 如果没有关系或组织,对应数组为空[]
5. relationships_text是自然语言描述,用于展示给用户看
+9 -2
View File
@@ -133,6 +133,7 @@ export default function Relationships() {
if (level >= 75) return 'green';
if (level >= 50) return 'blue';
if (level >= 25) return 'orange';
if (level >= 0) return 'volcano';
return 'red';
};
@@ -417,9 +418,15 @@ export default function Relationships() {
initialValue={50}
>
<Slider
min={0}
min={-100}
max={100}
marks={{ 0: '0', 25: '25', 50: '50', 75: '75', 100: '100' }}
marks={{
'-100': '-100',
'-50': '-50',
0: '0',
50: '50',
100: '100'
}}
/>
</Form.Item>