Merge pull request #241 from presenton/fix/outlines-none-issue
fix/outlines none issue
This commit is contained in:
commit
ac6dcd82bb
4 changed files with 21 additions and 11 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)
|
||||
|
|
|
|||
|
|
@ -950,7 +950,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)
|
||||
|
|
@ -1199,7 +1203,7 @@ class LLMClient:
|
|||
continue
|
||||
|
||||
content_chunk = event.choices[0].delta.content
|
||||
if content_chunk:
|
||||
if content_chunk and not use_tool_calls_for_structured_output:
|
||||
yield content_chunk
|
||||
|
||||
tool_call_chunk = event.choices[0].delta.tool_calls
|
||||
|
|
@ -1328,13 +1332,17 @@ 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)
|
||||
|
||||
for each_part in event.candidates[0].content.parts:
|
||||
if each_part.text:
|
||||
if each_part.text and not google_tools:
|
||||
yield each_part.text
|
||||
|
||||
if each_part.function_call:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ from utils.llm_provider import get_model
|
|||
system_prompt = """
|
||||
You are an expert presentation creator. Generate structured presentations based on user requirements and format them according to the specified JSON schema with markdown content.
|
||||
|
||||
Try to use available tools for better results.
|
||||
|
||||
- Provide content for each slide in markdown format.
|
||||
- Make sure that flow of the presentation is logical and consistent.
|
||||
- Place greater emphasis on numerical data.
|
||||
|
|
|
|||
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