Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request improves the reliability and structure of extracting YouTube links using Ollama by enforcing a strict JSON response format, updating the prompt instructions, and enhancing the parsing logic to handle structured responses. It also updates documentation to reflect these changes.
Prompt and API integration improvements:
OLLAMA_PROMPTin.env.examplenow instructs Ollama to return a JSON object with alinksarray, and not to include any extra text or formatting. It also clarifies the inclusion criteria for links and provides concrete response examples. [1] [2]extractLinksWithOllama(src/utils/youtube.ts) now explicitly requests a JSON schema with alinksarray, ensuring the model's output is structured and predictable.Parsing and error handling enhancements:
extractLinksWithOllamahas been updated to first attempt parsing the response as structured JSON, handle missing or emptylinksproperties, and fall back to legacy parsing if needed. This increases robustness and backward compatibility. [1] [2]Documentation updates:
README.mdhas been updated to indicate thatOLLAMA_URLandOLLAMA_MODELnow default toNoneif not set, reflecting the new configuration approach.