This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async sendMessageStream( | |
| request: SimpleChatRequest, | |
| onChunk: (chunk: string, metadata?: any) => void, | |
| onComplete: (response: SimpleChatResponse) => void, | |
| onError: (error: Error) => void | |
| ): Promise<void> { | |
| const controller = new AbortController() | |
| const timeoutId = setTimeout(() => controller.abort(), this.requestTimeout) | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState, useEffect } from 'react' | |
| import PropTypes from 'prop-types' | |
| const loadedScripts = [] | |
| function useScript(src) { | |
| const [state, setState] = useState({ | |
| loaded: false, | |
| error: false, | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Test if lines equal | |
| * @param s1 - first segment [{x, y}, {x,y}] | |
| * @param s2 - second segment [{x, y}, {x,y}] | |
| */ | |
| linesEqual(s1, s2) { | |
| let s1Eq = [(s1[0].y - s1[1].y), (s1[1].x - s1[0].x), ((s1[0].x * s1[1].y) - (s1[1].x * s1[0].y))]; | |
| let s2Eq = [(s2[0].y - s2[1].y), (s2[1].x - s2[0].x), ((s2[0].x * s2[1].y) - (s2[1].x * s2[0].y))]; | |
| let returnVal = 'joint'; |