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