()
| 2 | import { getConfig, setGlobalConfig } from "./config_storage.js"; |
| 3 | |
| 4 | async function promptToken() { |
| 5 | try { |
| 6 | const answer = await enquirer.prompt<{ apikey: string }>({ |
| 7 | type: "password", |
| 8 | name: "apikey", |
| 9 | message: "Paste your OpenAI apikey here:", |
| 10 | }); |
| 11 | |
| 12 | return answer.apikey; |
| 13 | } catch (e) { |
| 14 | console.log("Aborted."); |
| 15 | process.exit(1); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | export async function getApiKey(clean?: boolean): Promise<string> { |
| 20 | let apiKey = getConfig<string | undefined>("apiKey"); |