Skip to content

Commit

Permalink
feat: compatibility for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
diciaup committed Dec 13, 2022
1 parent 88c1744 commit 16a4305
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 30 deletions.
4 changes: 2 additions & 2 deletions bin/cli.js → bin/cli
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
':' //; exec "$(command -v nodejs || command -v node)" "$0" "$@"
#!/usr/bin/env node


const { spawnSync } = require("child_process");
const { resolve } = require("path");
Expand Down
3 changes: 3 additions & 0 deletions bin/cli.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\cli" %*
Empty file removed electron.log
Empty file.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "assistant-cli",
"version": "1.2.1",
"version": "1.2.2",
"description": "A command line tool to easily integrate OpenAI Chat GPT service",
"main": "dist/bin/cli.js",
"main": "./bin/cli",
"engines": {
"node": ">=16"
},
"bin": {
"assistant": "./bin/cli.js"
"assistant": "./bin/cli"
},
"scripts": {
"publish": "tsc && npm publish",
Expand Down
20 changes: 0 additions & 20 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,6 @@ const loadingSpinner = new Spinner('processing... %s');
loadingSpinner.setSpinnerString('|/-\\');
const localStorageLocation = `${__dirname}/../localStorage`;

function execElectron(path, options, callback, clearCache = false) {

if (!path) {
return callback(new Error("The path argument is mandatory."));
}

if (typeof options === "function") {
callback = options;
options = null;
}

options = options || {};
options._ = [path];

var cwd = options.cwd || process && process.cwd() || __dirname;
delete options.cwd;
console.log(electronPath);
return ;
}

let authTry = 0;
const getToken = (clearCache) => {
const path = `${__dirname}/fetch-token.js`;
Expand Down
2 changes: 0 additions & 2 deletions src/chatgpt-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export class ChatGPTAPI {
protected _user: types.User | null = null
protected apiClient: Axios;
protected backendClient: Axios;

// Stores access tokens for `accessTokenTTL` milliseconds before needing to refresh
protected _accessTokenCache: ExpiryMap<string, string>

constructor(opts: {
Expand Down

0 comments on commit 16a4305

Please sign in to comment.