File size: 3,390 Bytes
0b52af4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
from typing import List, Dict, Optional
import uvicorn

# FastAPI server for internal API endpoints
app = FastAPI(title="YAH Tech Internal API", version="1.0.0")

# CORS middleware
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# Pydantic models
class ChatRequest(BaseModel):
    message: str
    user_id: Optional[str] = None

class ChatResponse(BaseModel):
    response: str
    confidence: float
    source: str

class CompanyInfoResponse(BaseModel):
    name: str
    type: str
    purpose: str
    philosophy: str

# Mock database
conversation_history = {}

@app.get("/")
async def root():
    return {"message": "YAH Tech Internal API", "status": "active"}

@app.get("/company/info")
async def get_company_info():
    """Get YAH Tech company information"""
    return CompanyInfoResponse(
        name="YAH Tech",
        type="Venture studio / app development company",
        purpose="Build and launch technology-driven ventures that generate profit and societal value",
        philosophy="Learn, understand, create, and evaluate"
    )

@app.post("/chat", response_model=ChatResponse)
async def chat_endpoint(request: ChatRequest):
    """Chat endpoint for YAH Bot"""
    user_message = request.message.lower()
    
    # Simple response logic - in production, this would use your AI model
    if "yah tech" in user_message:
        return ChatResponse(
            response="YAH Tech is a venture studio and app development company focused on building futuristic solutions that create both profit and societal value.",
            confidence=0.9,
            source="knowledge_base"
        )
    elif "adedoyin" in user_message:
        return ChatResponse(
            response="Adedoyin Ifeoluwa James is the Founder & CEO of YAH Tech, focused on building profitable systems that reshape the economic world.",
            confidence=0.95,
            source="knowledge_base"
        )
    elif "hello" in user_message or "hi" in user_message:
        return ChatResponse(
            response="Hello! I'm YAH Bot, how can I assist you with YAH Tech today?",
            confidence=0.8,
            source="greeting"
        )
    else:
        return ChatResponse(
            response="I understand you're interested in YAH Tech. We're a venture studio building scalable technology solutions. How can I help you specifically?",
            confidence=0.7,
            source="general"
        )

@app.get("/projects")
async def get_projects():
    """Get current YAH Tech projects"""
    return {
        "projects": [
            {
                "name": "AI Venture Builder",
                "status": "planning",
                "description": "Platform for rapidly building AI-powered startups"
            },
            {
                "name": "Economic Analytics Suite",
                "status": "development",
                "description": "Tools for analyzing and predicting economic trends"
            }
        ]
    }

@app.get("/health")
async def health_check():
    """Health check endpoint"""
    return {"status": "healthy", "service": "yah-tech-api"}

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8000)