|
|
|
@ -4,6 +4,7 @@ import { |
|
|
|
|
ResponseData, |
|
|
|
|
showMessageWithTimeout, |
|
|
|
|
showPendingStatusBar, |
|
|
|
|
updateStatusBarMessage, |
|
|
|
|
} from './common'; |
|
|
|
|
import { config } from 'process'; |
|
|
|
|
|
|
|
|
@ -193,6 +194,7 @@ export async function openAIMakeRequest( |
|
|
|
|
// FIXME: why the choices may be multiple?
|
|
|
|
|
// TODO: display the multiple choices
|
|
|
|
|
//console.log(data.choices[0].text);
|
|
|
|
|
updateStatusBarMessage(data.choices[0].text); |
|
|
|
|
ret.content += data.choices[0].text; |
|
|
|
|
ret.tokens += data.usage?.completion_tokens || 0; |
|
|
|
|
} |
|
|
|
@ -200,6 +202,8 @@ export async function openAIMakeRequest( |
|
|
|
|
// stop the timer
|
|
|
|
|
const timer_end = performance.now(); |
|
|
|
|
ret.time = (timer_end - timer_start) / 1000.0; |
|
|
|
|
// clear the status bar item
|
|
|
|
|
updateStatusBarMessage(''); |
|
|
|
|
} catch (e: any) { |
|
|
|
|
console.error(e); |
|
|
|
|
const err = e as TypeError; |
|
|
|
|