Slide deck generation fails with TypeError when the model omits "content"; slides always in English
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 92/100
Research direction
Start in lib/Service/SlideDeckService.php, reading PROMPT and parseModelJSON() around line 142. Check the handling of missing title, subtitle, and content fields, then verify that malformed model output no longer causes a TypeError and that the prompt requests the presentation’s language for all slide text.
Written by the indexing model from the issue text.
Description
Version: richdocuments 12.0.0 · Nextcloud 35
Actual (log):
TitleContentSlide::__construct(): Argument #3 ($content) must be of type array|string, null given, called in lib/Service/SlideDeckService.php on line 142
Cause
parseModelJSON()passes$slideJSON['content']without checking it exists. Small local models sometimes return alayout: 1slide with
subtitleinstead ofcontent(observed with a ~4B model; a larger model returned valid JSON for the same prompt) → the whole task fails.SlideDeckService::PROMPThas no instruction about output language (the text/spreadsheet prompts do: "in the same language as the description"),
so slides come out in English for non-English requests (observed for Thai with both a small and a large model).
Fix (tested): null-coalesce title/subtitle/content (fall back to subtitle for content), and add
"Write all slide texts in the same language as the presentation text." to the prompt. Patch below.
Patch (tested on a test instance):
--- a/lib/Service/SlideDeckService.php
+++ b/lib/Service/SlideDeckService.php
@@ -64,6 +64,8 @@
Only output the JSON array. Do not wrap it with spaces, new lines or backticks (`).
+Write all slide texts in the same language as the presentation text.
+
Here is the presentation text:
EOF;
@@ -137,9 +139,9 @@
$slideLayout = LayoutType::from($layoutTypes[$slideJSON['layout']]);
$slide = match ($slideLayout) {
- LayoutType::Title => new TitleSlide($index, $slideJSON['title'], $slideJSON['subtitle']),
+ LayoutType::Title => new TitleSlide($index, $slideJSON['title'] ?? '', $slideJSON['subtitle'] ?? ''),
- LayoutType::TitleContent => new TitleContentSlide($index, $slideJSON['title'], $slideJSON['content']),
+ LayoutType::TitleContent => new TitleContentSlide($index, $slideJSON['title'] ?? '', $slideJSON['content'] ?? $slideJSON['subtitle'] ?? ''),
default => null,
};
- Dominant language
- JavaScript
- Stars
- 453
- Forks
- 147
- Avg merge
- 18h 31m
- Merged PRs (30d)
- 86
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud/richdocuments
-
bug design papercut
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
nextcloud/richdocuments#6124 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
nextcloud/richdocuments#6119 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
nextcloud/richdocuments#6094 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
nextcloud/richdocuments#5663 ·
Maintainers usually reply within 1 day
-
feature: fonts info needed
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
nextcloud/richdocuments#5336 · 3 comments ·
Maintainers usually reply within 1 day
All issues in nextcloud/richdocuments
Similar issues
-
feature task
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RealDevSquad/website-www#1178 ·
-
add latest sol modelOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
netlify-labs/nax#56 · 2 comments · 1 reaction ·
-
accessibility bug revealjs
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
quarto-dev/quarto-cli#14961 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
PnX-SI/GeoNature#4435 · 2 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
openlayers/openlayers#17648 ·
Maintainers usually reply within 1 day