(options?: UseChatOptions)
| 23 | * ``` |
| 24 | */ |
| 25 | export function renderUseChat(options?: UseChatOptions) { |
| 26 | const rendered = renderHook(() => useChat(options)) |
| 27 | |
| 28 | // Adapt SolidJS hook result to React-like API for test compatibility |
| 29 | return { |
| 30 | result: { |
| 31 | get current() { |
| 32 | const hook = rendered.result |
| 33 | return { |
| 34 | messages: hook.messages(), |
| 35 | isLoading: hook.isLoading(), |
| 36 | error: hook.error(), |
| 37 | status: hook.status(), |
| 38 | isSubscribed: hook.isSubscribed(), |
| 39 | connectionStatus: hook.connectionStatus(), |
| 40 | sessionGenerating: hook.sessionGenerating(), |
| 41 | sendMessage: hook.sendMessage, |
| 42 | append: hook.append, |
| 43 | reload: hook.reload, |
| 44 | stop: hook.stop, |
| 45 | clear: hook.clear, |
| 46 | setMessages: hook.setMessages, |
| 47 | addToolResult: hook.addToolResult, |
| 48 | addToolApprovalResponse: hook.addToolApprovalResponse, |
| 49 | } |
| 50 | }, |
| 51 | }, |
| 52 | rerender: (_newOptions?: UseChatOptions) => { |
| 53 | // SolidJS doesn't have a rerender concept in the same way React does |
| 54 | // The signals are already reactive, so we just return the same result |
| 55 | return rendered |
| 56 | }, |
| 57 | unmount: rendered.cleanup, |
| 58 | } |
| 59 | } |
no test coverage detected