Brettapps commited on
Commit
d97938c
·
verified ·
1 Parent(s): 34d68d6

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +60 -0
app.py CHANGED
@@ -48,6 +48,39 @@ def llm_worker(prompt, system_prompt="You are a specialized business assistant."
48
  }
49
  }
50
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  {
52
  "type": "function",
53
  "function": {
@@ -178,6 +211,23 @@ def generate_image_internal(prompt: str) -> str:
178
  shutil.copy(temp_path, final_path)
179
  return f"Branded Image Generated using {model_used}: {final_path}. (Context: {brand_context})"
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  def create_stripe_checkout_session_internal(price_id: str, success_url: str, cancel_url: str) -> str:
182
  try:
183
  session = stripe.checkout.Session.create(
@@ -198,6 +248,16 @@ def search_market_trends(topic: str) -> str:
198
  """Deeply analyze market trends, competition, and pricing."""
199
  return search_market_trends_internal(topic)
200
 
 
 
 
 
 
 
 
 
 
 
201
  @mcp.tool()
202
  def generate_image(prompt: str) -> str:
203
  """Generate a branded cover or marketing asset."""
 
48
  }
49
  }
50
  },
51
+ {
52
+ "type": "function",
53
+ "function": {
54
+ "name": "create_stripe_product_with_price",
55
+ "description": "Create a real Product and Price in Stripe.",
56
+ "parameters": {
57
+ "type": "object",
58
+ "properties": {
59
+ "name": {"type": "string"},
60
+ "description": {"type": "string"},
61
+ "unit_amount_cents": {"type": "integer"},
62
+ "currency": {"type": "string"}
63
+ },
64
+ "required": ["name", "description", "unit_amount_cents"]
65
+ }
66
+ }
67
+ },
68
+ {
69
+ "type": "function",
70
+ "function": {
71
+ "name": "launch_client_business",
72
+ "description": "Orchestrate a full ebook business build for a paying client.",
73
+ "parameters": {
74
+ "type": "object",
75
+ "properties": {
76
+ "client_name": {"type": "string"},
77
+ "niche": {"type": "string"},
78
+ "email": {"type": "string"}
79
+ },
80
+ "required": ["client_name", "niche", "email"]
81
+ }
82
+ }
83
+ },
84
  {
85
  "type": "function",
86
  "function": {
 
211
  shutil.copy(temp_path, final_path)
212
  return f"Branded Image Generated using {model_used}: {final_path}. (Context: {brand_context})"
213
 
214
+ def create_stripe_product_with_price_internal(name: str, description: str, unit_amount_cents: int, currency: str = "aud") -> str:
215
+ try:
216
+ product = stripe.Product.create(name=name, description=description)
217
+ price = stripe.Price.create(product=product.id, unit_amount=unit_amount_cents, currency=currency)
218
+ return f"Product Created: {name} (ID: {product.id}). Price Created (ID: {price.id}) for {unit_amount_cents/100:.2f} {currency.upper()}."
219
+ except Exception as e:
220
+ return f"Stripe Product Error: {str(e)}"
221
+
222
+ def launch_client_business_internal(client_name: str, niche: str, email: str) -> str:
223
+ """Orchestrate a high-ticket business build for a client."""
224
+ # 1. Market Research
225
+ research = search_market_trends_internal(f"{niche} business for {client_name}")
226
+ # 2. Project config
227
+ safe_name = f"{client_name.lower().replace(' ', '_')}_{niche.lower().replace(' ', '_')}"
228
+ # In a real scenario, this would trigger a background task to build ebooks, covers, and spaces.
229
+ return f"🚀 Agency Mission Initiated: Building turn-key '{niche}' business for {client_name}. Client Email: {email}. Research logged."
230
+
231
  def create_stripe_checkout_session_internal(price_id: str, success_url: str, cancel_url: str) -> str:
232
  try:
233
  session = stripe.checkout.Session.create(
 
248
  """Deeply analyze market trends, competition, and pricing."""
249
  return search_market_trends_internal(topic)
250
 
251
+ @mcp.tool()
252
+ def create_stripe_product_with_price(name: str, description: str, unit_amount_cents: int, currency: str = "aud") -> str:
253
+ """Create a real Product and Price in Stripe."""
254
+ return create_stripe_product_with_price_internal(name, description, unit_amount_cents, currency)
255
+
256
+ @mcp.tool()
257
+ def launch_client_business(client_name: str, niche: str, email: str) -> str:
258
+ """Orchestrate a high-ticket business build for a client."""
259
+ return launch_client_business_internal(client_name, niche, email)
260
+
261
  @mcp.tool()
262
  def generate_image(prompt: str) -> str:
263
  """Generate a branded cover or marketing asset."""