fix(fastapi): adds checks for none parts for google structured, chore: removes fastmcp logs
This commit is contained in:
parent
f243a1b831
commit
9ba0346935
3 changed files with 12 additions and 8 deletions
|
|
@ -141,6 +141,8 @@ async def prepare_presentation(
|
|||
if not presentation:
|
||||
raise HTTPException(status_code=404, detail="Presentation not found")
|
||||
|
||||
presentation_outline_model = PresentationOutlineModel(slides=outlines)
|
||||
|
||||
total_slide_layouts = len(layout.slides)
|
||||
total_outlines = len(outlines)
|
||||
|
||||
|
|
@ -149,7 +151,7 @@ async def prepare_presentation(
|
|||
else:
|
||||
presentation_structure: PresentationStructureModel = (
|
||||
await generate_presentation_structure(
|
||||
presentation_outline=presentation.get_presentation_outline(),
|
||||
presentation_outline=presentation_outline_model,
|
||||
presentation_layout=layout,
|
||||
)
|
||||
)
|
||||
|
|
@ -164,9 +166,7 @@ async def prepare_presentation(
|
|||
presentation_structure.slides[index] = random_slide_index
|
||||
|
||||
sql_session.add(presentation)
|
||||
presentation.outlines = PresentationOutlineModel(slides=outlines).model_dump(
|
||||
mode="json"
|
||||
)
|
||||
presentation.outlines = presentation_outline_model.model_dump(mode="json")
|
||||
presentation.title = title or presentation.title
|
||||
presentation.set_layout(layout)
|
||||
presentation.set_structure(presentation_structure)
|
||||
|
|
@ -338,7 +338,7 @@ async def generate_presentation_api(
|
|||
detail="Failed to generate presentation outlines. Please try again.",
|
||||
)
|
||||
presentation_outlines = PresentationOutlineModel(**presentation_outlines_json)
|
||||
outlines = presentation_outlines.slides[:request.n_slides]
|
||||
outlines = presentation_outlines.slides[: request.n_slides]
|
||||
total_outlines = len(outlines)
|
||||
|
||||
print("-" * 40)
|
||||
|
|
|
|||
|
|
@ -1328,7 +1328,11 @@ class LLMClient:
|
|||
max_output_tokens=max_tokens,
|
||||
),
|
||||
):
|
||||
if not (event.candidates and event.candidates[0].content):
|
||||
if not (
|
||||
event.candidates
|
||||
and event.candidates[0].content
|
||||
and event.candidates[0].content.parts
|
||||
):
|
||||
continue
|
||||
|
||||
generated_contents.append(event.candidates[0].content)
|
||||
|
|
|
|||
4
start.js
4
start.js
|
|
@ -113,7 +113,7 @@ const startServers = async () => {
|
|||
],
|
||||
{
|
||||
cwd: fastapiDir,
|
||||
stdio: "inherit",
|
||||
stdio: "ignore",
|
||||
env: process.env,
|
||||
},
|
||||
);
|
||||
|
|
@ -151,7 +151,7 @@ const startServers = async () => {
|
|||
console.error("Ollama process failed to start:", err);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// Keep the Node process alive until both servers exit
|
||||
const exitCode = await Promise.race([
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue