Skip to content

Commit a8e6dd4

Browse files
committed
Refactor trust_score instantiation to improve clarity and update factors to components list
1 parent 2dcbb6a commit a8e6dd4

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

services/api-python/app/services/analysis.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,14 @@ async def quick_analysis(self, content: str) -> Dict:
104104
"trust_score": TrustScore(
105105
overall_score=max(0.0, min(1.0, trust_score)),
106106
confidence=confidence_score,
107-
factors={
107+
components={
108108
"emotional_language": -0.2 if has_emotional_language else 0,
109109
"source_presence": -0.1 if content.count("http") == 0 else 0.1
110-
}
110+
},
111+
factors=[
112+
"emotional_language" if has_emotional_language else "neutral_language",
113+
"source_verification"
114+
]
111115
),
112116
"confidence_score": confidence_score,
113117
"red_flags": red_flags
@@ -118,7 +122,7 @@ async def quick_analysis(self, content: str) -> Dict:
118122
return {
119123
"findings": {},
120124
"manipulation_techniques": [],
121-
"trust_score": TrustScore(score=0.5, confidence=0.1, factors={}),
125+
"trust_score": TrustScore(overall_score=0.5, confidence=0.1, factors=["incomplete_analysis"]),
122126
"confidence_score": 0.1,
123127
"red_flags": ["Analysis error occurred"]
124128
}

0 commit comments

Comments
 (0)