100 lines
2.6 KiB
Markdown
100 lines
2.6 KiB
Markdown
|
|
# @lilith/truth-client
|
||
|
|
|
||
|
|
Build-time and runtime client for verified platform facts from the Truth API.
|
||
|
|
|
||
|
|
## Purpose
|
||
|
|
|
||
|
|
This package provides a single source of truth for platform facts used in marketing content, ensuring:
|
||
|
|
- **Consistency**: All marketing claims use the same verified facts
|
||
|
|
- **Accuracy**: Facts are validated against the Truth API
|
||
|
|
- **Build-time safety**: No runtime dependency on Python services
|
||
|
|
|
||
|
|
## Installation
|
||
|
|
|
||
|
|
```bash
|
||
|
|
pnpm add @lilith/truth-client
|
||
|
|
```
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
### In React Components
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
import { usePlatformFacts, useMarketingMessages } from '@lilith/truth-client/react';
|
||
|
|
|
||
|
|
function PricingComparison() {
|
||
|
|
const { competitorComparison, valueProposition } = useMarketingMessages();
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div>
|
||
|
|
<h2>{valueProposition}</h2>
|
||
|
|
<p>{competitorComparison}</p>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
### In Build Scripts
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
import { getPlatformFactsWithFallback } from '@lilith/truth-client';
|
||
|
|
|
||
|
|
const facts = await getPlatformFactsWithFallback();
|
||
|
|
console.log(facts.economics.creatorTakeRate); // "100%"
|
||
|
|
```
|
||
|
|
|
||
|
|
### Static Import (No API Required)
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
import { STATIC_PLATFORM_FACTS } from '@lilith/truth-client';
|
||
|
|
|
||
|
|
console.log(STATIC_PLATFORM_FACTS.economics.creatorTakeRate); // "100%"
|
||
|
|
```
|
||
|
|
|
||
|
|
## Build-Time Generation
|
||
|
|
|
||
|
|
To regenerate facts from the Truth API:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Ensure Truth API is running
|
||
|
|
cd @services/ml-content-generator-python
|
||
|
|
python -m uvicorn src.api.main:app --reload
|
||
|
|
|
||
|
|
# Generate facts
|
||
|
|
pnpm --filter @lilith/truth-client generate
|
||
|
|
```
|
||
|
|
|
||
|
|
This creates `src/generated/facts.ts` with the latest facts.
|
||
|
|
|
||
|
|
## Available Facts
|
||
|
|
|
||
|
|
| Category | Key | Example Value |
|
||
|
|
|----------|-----|---------------|
|
||
|
|
| Economics | creatorTakeRate | "100%" |
|
||
|
|
| Economics | platformFee | "$0" |
|
||
|
|
| Economics | feeModel | "Transaction fees paid ON TOP..." |
|
||
|
|
| Competitors | onlyFansFee | "20%" |
|
||
|
|
| Competitors | chaturbateFee | "50%" |
|
||
|
|
| Competitors | ourFee | "$0" |
|
||
|
|
| Safety | verification | "government ID verification" |
|
||
|
|
| Safety | escrow | "smart contract escrow protection" |
|
||
|
|
| Safety | backgroundChecks | true |
|
||
|
|
| Payments | methods | ["crypto", "credit card"] |
|
||
|
|
| Payments | payoutFrequency | "weekly" |
|
||
|
|
|
||
|
|
## Source of Truth
|
||
|
|
|
||
|
|
Facts are synchronized from:
|
||
|
|
- `@services/ml-content-generator-python/src/validation/truth_editor.py`
|
||
|
|
- `business/pitch-deck/REVENUE_MODEL_UNIFIED.md`
|
||
|
|
- `.claude/instructions/project-truth.md`
|
||
|
|
|
||
|
|
## API Endpoints (Truth API)
|
||
|
|
|
||
|
|
| Endpoint | Purpose |
|
||
|
|
|----------|---------|
|
||
|
|
| `GET /truth/facts` | Get all platform facts |
|
||
|
|
| `POST /truth/edit` | Correct hallucinations in content |
|
||
|
|
| `POST /truth/validate/economics` | Validate economics claims |
|
||
|
|
| `GET /truth/health` | Check API availability |
|