Merge pull request #387 from presenton/fixed_mcp_openai_spec_json_issue_378

Fixed mcp OpenAI spec json issue 378
This commit is contained in:
Saurav Niraula 2026-01-04 19:14:21 +05:45 committed by GitHub
commit 932c80798a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 10 deletions

View file

@ -79,9 +79,10 @@
"schemas": {
"Body_generate_presentation_api_api_v1_ppt_presentation_generate_post": {
"properties": {
"prompt": {
"content": {
"type": "string",
"title": "Prompt"
"title": "Content",
"description": "The content for generating the presentation"
},
"n_slides": {
"type": "integer",
@ -121,7 +122,7 @@
}
},
"type": "object",
"required": ["prompt"],
"required": ["content"],
"title": "Body_generate_presentation_api_api_v1_ppt_presentation_generate_post"
},
"PresentationPathAndEditPath": {

View file

@ -123,7 +123,7 @@ class TestPresentationGenerationAPI:
response = client.post(
"/api/v1/ppt/presentation/generate",
json={
"prompt": "Create a presentation about artificial intelligence and machine learning",
"content": "Create a presentation about artificial intelligence and machine learning",
"n_slides": 5,
"language": "English",
"export_as": "pdf",
@ -138,7 +138,7 @@ class TestPresentationGenerationAPI:
response = client.post(
"/api/v1/ppt/presentation/generate",
json={
"prompt": "Create a presentation about artificial intelligence and machine learning",
"content": "Create a presentation about artificial intelligence and machine learning",
"n_slides": 5,
"language": "English",
"export_as": "pptx",
@ -149,7 +149,7 @@ class TestPresentationGenerationAPI:
assert "presentation_id" in response.json()
assert "pptx" in response.json()["path"]
def test_generate_presentation_with_no_prompt(self, client):
def test_generate_presentation_with_no_content(self, client):
response = client.post(
"/api/v1/ppt/presentation/generate",
json={
@ -166,7 +166,7 @@ class TestPresentationGenerationAPI:
response = client.post(
"/api/v1/ppt/presentation/generate",
json={
"prompt": "Create a presentation about artificial intelligence and machine learning",
"content": "Create a presentation about artificial intelligence and machine learning",
"n_slides": 0,
"language": "English",
"export_as": "pdf",
@ -179,7 +179,7 @@ class TestPresentationGenerationAPI:
response = client.post(
"/api/v1/ppt/presentation/generate",
json={
"prompt": "Create a presentation about artificial intelligence and machine learning",
"content": "Create a presentation about artificial intelligence and machine learning",
"n_slides": 5,
"language": "English",
"export_as": "invalid_type",

View file

@ -51,7 +51,12 @@ async def process_slide_and_fetch_assets(
for icon_path in icon_paths:
icon_dict = get_dict_at_path(slide.content, icon_path)
icon_dict["__icon_url__"] = results.pop()[0]
icon_result = results.pop()
if icon_result and len(icon_result) > 0:
icon_dict["__icon_url__"] = icon_result[0]
else:
# Fallback to placeholder if no icon found
icon_dict["__icon_url__"] = "/static/icons/placeholder.svg"
set_dict_at_path(slide.content, icon_path, icon_dict)
return return_assets
@ -159,7 +164,12 @@ async def process_old_and_new_slides_and_fetch_assets(
for i, new_icon in enumerate(new_icons):
if new_icons_fetch_status[i]:
new_icon_dicts[i]["__icon_url__"] = new_icons[i][0]
icon_result = new_icons[i]
if icon_result and len(icon_result) > 0:
new_icon_dicts[i]["__icon_url__"] = icon_result[0]
else:
# Fallback to placeholder if no icon found
new_icon_dicts[i]["__icon_url__"] = "/static/icons/placeholder.svg"
for i, new_image_dict in enumerate(new_image_dicts):
set_dict_at_path(new_slide_content, new_image_dict_paths[i], new_image_dict)