Skip to content

Conversation

@nmaguiar
Copy link
Collaborator

@nmaguiar nmaguiar commented Jan 8, 2026

This pull request introduces several improvements and bug fixes to the AI integration logic in js/owrap.ai.js, as well as a minor fix in js/openaf.js. The changes mainly enhance the handling of model metadata, token usage statistics, prompt formatting, and function call responses, while also improving error handling and resource cleanup.

AI integration improvements:

  • Enhanced metadata extraction for Gemini responses, including support for modelVersion, responseId, and additional token usage fields such as cachedContentTokenCount and thoughtsTokenCount in the stats object.
  • Improved filtering and formatting of prompts and conversation history, ensuring only defined entries are processed and system instructions are correctly constructed from both parts and content fields. [1] [2] [3]
  • Refined handling of function call responses: now parses JSON results when possible, wraps results in consistent structures (result, items), and ensures the response content is always an object.
  • Fixed a bug where tool functions were incorrectly passed to recursive prompt calls, now passing an empty array as intended.

Resource management and error handling:

  • In js/openaf.js, added a check to ensure ojob is defined before attempting to delete its daemon property, and improved temporary file cleanup by always removing the temp file after loading jobs, even if an error occurs.

nmaguiar and others added 3 commits January 7, 2026 04:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nmaguiar nmaguiar self-assigned this Jan 8, 2026
@nmaguiar nmaguiar merged commit 34d6f96 into t9 Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants