Brettapps commited on
Commit
df752f3
·
verified ·
1 Parent(s): 4c0a33e

Upload folder using huggingface_hub

Browse files
app.py CHANGED
@@ -188,12 +188,15 @@ def llm_worker(prompt, system_prompt="You are a specialized business assistant."
188
 
189
  try:
190
  # GPT-4o Upgrade
191
- response = client.chat.completions.create(
192
- model="gpt-4o",
193
- messages=messages,
194
- tools=tools,
195
- tool_choice="auto"
196
- )
 
 
 
197
 
198
  response_message = response.choices[0].message
199
  tool_calls = response_message.tool_calls
@@ -282,8 +285,20 @@ def create_stripe_product_with_price_internal(name: str, description: str, unit_
282
  except Exception as e:
283
  return f"Stripe Error: {str(e)}"
284
 
 
 
 
 
 
 
 
285
  # --- EXPOSED MCP TOOLS ---
286
 
 
 
 
 
 
287
  @mcp.tool()
288
  def search_market_trends(topic: str) -> str:
289
  """Deeply analyze market trends, competition, and pricing."""
@@ -364,7 +379,7 @@ def get_all_projects():
364
  all_projects = get_all_projects()
365
 
366
  with gr.Blocks(title="Aussie Agent Hub") as demo:
367
- gr.Markdown("# 🐨 Aussie MCP Server Agent Hub")
368
 
369
  with gr.Row():
370
  with gr.Column(scale=1):
@@ -374,7 +389,7 @@ with gr.Blocks(title="Aussie Agent Hub") as demo:
374
  value="Main Hub",
375
  label="Active Venture"
376
  )
377
- project_info = gr.Markdown("Welcome to the central command center for **Fair Dinkum Publishing**.")
378
  epub_dl = gr.File(label="Download EPUB", visible=False)
379
  pdf_dl = gr.File(label="Download PDF", visible=False)
380
  buy_link = gr.Markdown(visible=False)
@@ -393,13 +408,16 @@ with gr.Blocks(title="Aussie Agent Hub") as demo:
393
  info = f"Viewing interactive hub for **{proj['title']}**."
394
  epub_visible = "epub" in proj.get("files", {}) and os.path.exists(proj["files"]["epub"])
395
  pdf_visible = "pdf" in proj.get("files", {}) and os.path.exists(proj["files"]["pdf"])
396
- buy_visible = "price_id" in proj
 
 
 
397
 
398
  return [
399
  info,
400
  gr.update(value=proj["files"].get("epub") if epub_visible else None, visible=epub_visible),
401
  gr.update(value=proj["files"].get("pdf") if pdf_visible else None, visible=pdf_visible),
402
- gr.update(value=f"**Special Offer:** [Buy Now](https://buy.stripe.com/{proj['price_id']})" if buy_visible else "", visible=buy_visible)
403
  ]
404
 
405
  project_selector.change(update_project_ui, project_selector, [project_info, epub_dl, pdf_dl, buy_link])
 
188
 
189
  try:
190
  # GPT-4o Upgrade
191
+ completion_args = {
192
+ "model": "gpt-4o",
193
+ "messages": messages
194
+ }
195
+ if tools:
196
+ completion_args["tools"] = tools
197
+ completion_args["tool_choice"] = "auto"
198
+
199
+ response = client.chat.completions.create(**completion_args)
200
 
201
  response_message = response.choices[0].message
202
  tool_calls = response_message.tool_calls
 
285
  except Exception as e:
286
  return f"Stripe Error: {str(e)}"
287
 
288
+ def create_stripe_payment_link_internal(price_id: str) -> str:
289
+ try:
290
+ payment_link = stripe.PaymentLink.create(line_items=[{"price": price_id, "quantity": 1}])
291
+ return f"Payment Link Created: {payment_link.url}"
292
+ except Exception as e:
293
+ return f"Stripe Error: {str(e)}"
294
+
295
  # --- EXPOSED MCP TOOLS ---
296
 
297
+ @mcp.tool()
298
+ def create_stripe_payment_link(price_id: str) -> str:
299
+ """Create a durable, permanent Stripe Payment Link for a given Price ID."""
300
+ return create_stripe_payment_link_internal(price_id)
301
+
302
  @mcp.tool()
303
  def search_market_trends(topic: str) -> str:
304
  """Deeply analyze market trends, competition, and pricing."""
 
379
  all_projects = get_all_projects()
380
 
381
  with gr.Blocks(title="Aussie Agent Hub") as demo:
382
+ gr.Markdown("# 🐨 Aussie MCP Server Agent Hub (37-Agent Workforce)")
383
 
384
  with gr.Row():
385
  with gr.Column(scale=1):
 
389
  value="Main Hub",
390
  label="Active Venture"
391
  )
392
+ project_info = gr.Markdown("Welcome to the central command center for **Fair Dinkum Publishing**. Orchestrate your 37-agent AI workforce below.")
393
  epub_dl = gr.File(label="Download EPUB", visible=False)
394
  pdf_dl = gr.File(label="Download PDF", visible=False)
395
  buy_link = gr.Markdown(visible=False)
 
408
  info = f"Viewing interactive hub for **{proj['title']}**."
409
  epub_visible = "epub" in proj.get("files", {}) and os.path.exists(proj["files"]["epub"])
410
  pdf_visible = "pdf" in proj.get("files", {}) and os.path.exists(proj["files"]["pdf"])
411
+
412
+ # Use permanent Payment Link if available, otherwise fallback to Price ID session
413
+ buy_url = proj.get("payment_link") or (f"https://buy.stripe.com/{proj['price_id']}" if "price_id" in proj else None)
414
+ buy_visible = buy_url is not None
415
 
416
  return [
417
  info,
418
  gr.update(value=proj["files"].get("epub") if epub_visible else None, visible=epub_visible),
419
  gr.update(value=proj["files"].get("pdf") if pdf_visible else None, visible=pdf_visible),
420
+ gr.update(value=f"**Special Offer:** [Buy Now]({buy_url})" if buy_visible else "", visible=buy_visible)
421
  ]
422
 
423
  project_selector.change(update_project_ui, project_selector, [project_info, epub_dl, pdf_dl, buy_link])
projects/launch_master_ai_creator_bundle.json CHANGED
@@ -1,6 +1,7 @@
1
  {
2
  "title": "Fair Dinkum Master AI Creator Bundle",
3
- "price_id": "price_1TVOP14EwTdTrrCLsvtEU5Li",
 
4
  "description": "The ultimate collection: All 7 flagship ebooks including AI for Tradies, MCP Blueprint, Independent Creator Empire, and more.",
5
  "is_bundle": true,
6
  "included_books": [
 
1
  {
2
  "title": "Fair Dinkum Master AI Creator Bundle",
3
+ "price_id": "price_1TVOQn4EwTdTrrCLojzoZpIt",
4
+ "payment_link": "https://buy.stripe.com/test_14AaEQ1CxblS8u9cCa8Zq0a",
5
  "description": "The ultimate collection: All 7 flagship ebooks including AI for Tradies, MCP Blueprint, Independent Creator Empire, and more.",
6
  "is_bundle": true,
7
  "included_books": [