* feat: support multimodal tool results and improve tool message handling - Added a temporary `ToolResult` type that mirrors the structure returned by tools (text, image data, URLs, errors). - Implemented `convertToolPartToApiContentPart` to translate each tool output part into the format expected by the OpenAI chat completion API. - Updated `CompletionMessagesBuilder.addToolMessage` to accept a full `ToolResult` instead of a plain string and to: - Detect multimodal content (base64 images, image URLs) and build a structured `content` array. - Properly handle plain‑text results, tool execution errors, and unexpected formats with sensible fallbacks. - Cast the final content to `any` for the `tool` role as required by the API. - Modified `postMessageProcessing` to pass the raw tool result (`result as any`) to `addToolMessage`, avoiding premature extraction of only the first text part. - Refactored several formatting and type‑annotation sections: - Added multiline guard for empty user messages to insert a placeholder. - Split the image URL construction into a clearer multiline object. - Adjusted method signatures and added minor line‑breaks for readability. - Included extensive comments explaining the new logic and edge‑case handling. These changes enable the chat system to handle richer tool outputs (e.g., images, mixed content) and provide more robust error handling. * Satisfy ts linter * Make ts linter happy x2 * chore: update test message creation --------- Co-authored-by: Faisal Amir <urmauur@gmail.com>
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default tseslint.config({
extends: [
// Remove ...tseslint.configs.recommended and replace with this
...tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
...tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
...tseslint.configs.stylisticTypeChecked,
],
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default tseslint.config({
plugins: {
// Add the react-x and react-dom plugins
'react-x': reactX,
'react-dom': reactDom,
},
rules: {
// other rules...
// Enable its recommended typescript rules
...reactX.configs['recommended-typescript'].rules,
...reactDom.configs.recommended.rules,
},
})