Comparing version 0.2.9 to 0.2.10
@@ -9,2 +9,4 @@ "use strict"; | ||
const window_store_1 = __importDefault(require("../model/window-store")); | ||
const alert_1 = __importDefault(require("../util/alert")); | ||
const api_manager_1 = __importDefault(require("../controller/api-manager")); | ||
const assistant_manager_1 = __importDefault(require("./assistant-manager")); | ||
@@ -66,2 +68,9 @@ const gc_center_1 = require("./gc-center"); | ||
} | ||
showNewAssistantWindowOrError() { | ||
const hasCredential = api_manager_1.default.getCredentials().length > 0; | ||
if (hasCredential) | ||
this.showNamedWindow('newAssistant'); | ||
else | ||
(0, alert_1.default)('Can not create new assistant before adding API credentials.'); | ||
} | ||
getCurrentWindow() { | ||
@@ -68,0 +77,0 @@ return this.windows.find(w => w.window.isActive()); |
@@ -38,6 +38,8 @@ "use strict"; | ||
// Error happened. | ||
if (response.status == 401) | ||
throw new chie_1.APIError('Authentication token expired.', 'relogin'); | ||
if (response.status == 403) | ||
throw new chie_1.APIError('Access token expired.', 'refresh'); | ||
if (response.status == 401) | ||
throw new chie_1.APIError('Authentication token expired.', 'relogin'); | ||
if (response.status == 418) | ||
throw new chie_1.APIError('Require human validation.', 'refresh'); | ||
if (response.status != 200) { | ||
@@ -44,0 +46,0 @@ const detail = (await response.json()).detail; |
@@ -30,2 +30,4 @@ "use strict"; | ||
throw new chie_1.APIError(`Unexpected open from ChatGPT API: ${body}`); | ||
if (body.error.message.includes('You exceeded your current quota')) | ||
throw new chie_1.APIError(body.error.message + ' (This error can usually be solved by linking a valid credit card to your OpenAI account.)'); | ||
throw new chie_1.APIError(body.error.message); | ||
@@ -32,0 +34,0 @@ } |
@@ -128,3 +128,3 @@ "use strict"; | ||
label: 'New Assistant...', | ||
onClick: () => window_manager_1.default.showNamedWindow('newAssistant'), | ||
onClick: () => window_manager_1.default.showNewAssistantWindowOrError(), | ||
}, | ||
@@ -131,0 +131,0 @@ { type: 'separator' }, |
@@ -52,3 +52,3 @@ "use strict"; | ||
this.#addButton.view.setTooltip('Add new assistant'); | ||
this.#addButton.onClick = () => window_manager_1.default.showNamedWindow('newAssistant'); | ||
this.#addButton.onClick = () => window_manager_1.default.showNewAssistantWindowOrError(); | ||
this.#sidebar.view.addChildView(this.#addButton.view); | ||
@@ -55,0 +55,0 @@ // Create views for assistants. |
@@ -141,2 +141,3 @@ "use strict"; | ||
this.pushJavaScript(`window.appendError(${JSON.stringify(error)})`); | ||
this.setReplyActions(['resend']); | ||
} | ||
@@ -143,0 +144,0 @@ // Add (aborted) label to the pending message. |
{ | ||
"name": "chieapp", | ||
"version": "0.2.9", | ||
"version": "0.2.10", | ||
"main": "dist/gui-main.js", | ||
@@ -5,0 +5,0 @@ "description": "An extensible desktop app for large language models like ChatGPT and New Bing", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3665115
9027