fix(gpt-runner-web): fetch github config network error
This commit is contained in:
26
package.json
26
package.json
@@ -25,19 +25,19 @@
|
||||
"test:ci": "pnpm build && pnpm typecheck && pnpm lint && pnpm test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^0.39.8",
|
||||
"@antfu/eslint-config": "^0.40.2",
|
||||
"@nicepkg/gpt-runner": "workspace:*",
|
||||
"@nicepkg/gpt-runner-cli": "workspace:*",
|
||||
"@nicepkg/gpt-runner-core": "workspace:*",
|
||||
"@nicepkg/gpt-runner-shared": "workspace:*",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
"@types/node": "^18.16.19",
|
||||
"@types/prettier": "^2.7.3",
|
||||
"@types/react": "^18.2.17",
|
||||
"@types/prettier": "^3.0.0",
|
||||
"@types/react": "^18.2.20",
|
||||
"@vitejs/plugin-legacy": "^4.1.1",
|
||||
"@vitest/ui": "^0.33.0",
|
||||
"@vitest/ui": "^0.34.1",
|
||||
"bumpp": "^9.1.1",
|
||||
"eslint": "8.45.0",
|
||||
"eslint": "8.47.0",
|
||||
"esno": "^0.17.0",
|
||||
"execa": "^7.2.0",
|
||||
"fast-glob": "^3.3.1",
|
||||
@@ -46,22 +46,22 @@
|
||||
"jsdom": "^22.1.0",
|
||||
"lint-staged": "^13.2.3",
|
||||
"msw": "1.2.3",
|
||||
"pnpm": "8.6.10",
|
||||
"prettier": "^3.0.0",
|
||||
"pnpm": "8.6.12",
|
||||
"prettier": "^3.0.1",
|
||||
"react": "^18.2.0",
|
||||
"rollup": "^3.26.3",
|
||||
"rollup": "^3.28.0",
|
||||
"semver": "^7.5.4",
|
||||
"simple-git-hooks": "^2.9.0",
|
||||
"taze": "^0.11.2",
|
||||
"terser": "^5.19.2",
|
||||
"tsup": "^7.1.0",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.1.6",
|
||||
"unbuild": "^0.8.11",
|
||||
"unplugin-auto-import": "^0.16.6",
|
||||
"vite": "^4.4.7",
|
||||
"vite-plugin-inspect": "^0.7.33",
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-inspect": "^0.7.38",
|
||||
"vite-plugin-pages": "^0.31.0",
|
||||
"vitest": "^0.33.0"
|
||||
"vitest": "^0.34.1"
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
@@ -77,4 +77,4 @@
|
||||
"eslint --cache --fix"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"require": "./dist/index.cjs",
|
||||
"import": "./dist/index.mjs"
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.cjs",
|
||||
@@ -48,13 +48,13 @@
|
||||
"dependencies": {
|
||||
"@nicepkg/gpt-runner-shared": "workspace:*",
|
||||
"ignore": "^5.2.4",
|
||||
"langchain": "^0.0.123",
|
||||
"langchain": "^0.0.127",
|
||||
"unconfig": "^0.3.10",
|
||||
"uuid": "^9.0.0",
|
||||
"zod": "^3.21.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anthropic-ai/sdk": "^0.5.10",
|
||||
"@anthropic-ai/sdk": "^0.6.0",
|
||||
"openai": "^3.3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ PromptTemplate.fromTemplate = function (template, { templateFormat = 'f-string',
|
||||
names.add(node.name)
|
||||
})
|
||||
return new PromptTemplate({
|
||||
inputVariables: [...names],
|
||||
inputVariables: [...names] as any[],
|
||||
templateFormat,
|
||||
template,
|
||||
...rest,
|
||||
|
||||
@@ -29,24 +29,24 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/common.d.ts",
|
||||
"require": "./dist/common.cjs",
|
||||
"import": "./dist/common.mjs"
|
||||
"import": "./dist/common.mjs",
|
||||
"require": "./dist/common.cjs"
|
||||
},
|
||||
"./*": "./*",
|
||||
"./browser": {
|
||||
"types": "./dist/browser.d.ts",
|
||||
"require": "./dist/browser.cjs",
|
||||
"import": "./dist/browser.mjs"
|
||||
"import": "./dist/browser.mjs",
|
||||
"require": "./dist/browser.cjs"
|
||||
},
|
||||
"./common": {
|
||||
"types": "./dist/common.d.ts",
|
||||
"require": "./dist/common.cjs",
|
||||
"import": "./dist/common.mjs"
|
||||
"import": "./dist/common.mjs",
|
||||
"require": "./dist/common.cjs"
|
||||
},
|
||||
"./node": {
|
||||
"types": "./dist/node.d.ts",
|
||||
"require": "./dist/node.cjs",
|
||||
"import": "./dist/node.mjs"
|
||||
"import": "./dist/node.mjs",
|
||||
"require": "./dist/node.cjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/common.cjs",
|
||||
@@ -120,4 +120,4 @@
|
||||
"@types/ip": "^1.1.0",
|
||||
"express": "^4.18.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export interface GetAppConfigReqParams {
|
||||
langId?: LocaleLang
|
||||
}
|
||||
|
||||
export type GetAppConfigResData = CurrentAppConfig
|
||||
export type GetAppConfigResData = CurrentAppConfig | null
|
||||
|
||||
export interface MarkAsVisitedAppConfigReqParams {
|
||||
types: MarkedAsVisitedType[]
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
"@nicepkg/gpt-runner-shared": "workspace:*",
|
||||
"@nicepkg/gpt-runner-web": "workspace:*",
|
||||
"@types/vscode": "^1.71.0",
|
||||
"@vscode/vsce": "^2.20.0",
|
||||
"@vscode/vsce": "^2.20.1",
|
||||
"esno": "^0.17.0",
|
||||
"eventemitter3": "^5.0.1",
|
||||
"execa": "^7.2.0",
|
||||
@@ -159,4 +159,4 @@
|
||||
"uuid": "^9.0.0",
|
||||
"wait-port": "^1.0.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@
|
||||
"@types/global-agent": "^2.1.1",
|
||||
"@types/keyboardjs": "^2.5.1",
|
||||
"@types/lodash-es": "^4.17.8",
|
||||
"@types/react": "^18.2.18",
|
||||
"@types/react": "^18.2.20",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@types/react-syntax-highlighter": "^15.5.7",
|
||||
"@types/uuid": "^9.0.2",
|
||||
@@ -101,10 +101,10 @@
|
||||
"cross-env": "^7.0.3",
|
||||
"eventemitter": "^0.3.3",
|
||||
"express": "^4.18.2",
|
||||
"framer-motion": "^10.15.0",
|
||||
"framer-motion": "^10.15.1",
|
||||
"fs-extra": "^11.1.1",
|
||||
"global-agent": "^3.0.0",
|
||||
"i18next": "^23.4.2",
|
||||
"i18next": "^23.4.4",
|
||||
"i18next-browser-languagedetector": "^7.1.0",
|
||||
"i18next-http-backend": "^2.2.1",
|
||||
"js-base64": "^3.7.5",
|
||||
@@ -113,12 +113,12 @@
|
||||
"monaco-editor": "^0.41.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-error-boundary": "^4.0.10",
|
||||
"react-error-boundary": "^4.0.11",
|
||||
"react-hook-form": "^7.45.4",
|
||||
"react-hot-toast": "^2.4.1",
|
||||
"react-i18next": "^13.0.3",
|
||||
"react-i18next": "^13.1.2",
|
||||
"react-markdown": "^8.0.7",
|
||||
"react-router-dom": "^6.14.2",
|
||||
"react-router-dom": "^6.15.0",
|
||||
"react-syntax-highlighter": "^15.5.0",
|
||||
"react-tiny-popover": "^7.2.4",
|
||||
"react-use": "^17.4.0",
|
||||
@@ -127,10 +127,10 @@
|
||||
"undici": "^5.23.0",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"uuid": "^9.0.0",
|
||||
"vite": "^4.4.8",
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-monaco-editor": "^1.1.0",
|
||||
"vite-plugin-svgr": "^3.2.0",
|
||||
"web-streams-polyfill": "^3.2.1",
|
||||
"zustand": "^4.4.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,9 +76,7 @@ export const configControllers: ControllerConfig = {
|
||||
const currentAppConfig = await AppConfigService.instance.getCurrentAppConfig(true)
|
||||
|
||||
sendSuccessResponse(res, {
|
||||
data: {
|
||||
...currentAppConfig,
|
||||
} satisfies GetAppConfigResData,
|
||||
data: currentAppConfig satisfies GetAppConfigResData,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -61,10 +61,13 @@ export class AppConfigService implements CurrentAppConfig {
|
||||
return storage
|
||||
}
|
||||
|
||||
async getCurrentAppConfig(safe = true): Promise<CurrentAppConfig> {
|
||||
async getCurrentAppConfig(safe = true): Promise<CurrentAppConfig | null> {
|
||||
if (!this.appConfig)
|
||||
await this.loadAppConfig()
|
||||
|
||||
if (!this.appConfig)
|
||||
return null
|
||||
|
||||
await this.updateShouldShowModal()
|
||||
|
||||
const result = {
|
||||
@@ -106,7 +109,7 @@ export class AppConfigService implements CurrentAppConfig {
|
||||
await this.loadAppConfig()
|
||||
|
||||
const { modelType, vendorName } = props
|
||||
const { currentConfig } = await this.getCurrentAppConfig(false)
|
||||
const { currentConfig } = await this.getCurrentAppConfig(false) || {}
|
||||
let result: GetModelConfigType<T, 'secrets'> | undefined
|
||||
|
||||
if (currentConfig) {
|
||||
@@ -128,6 +131,9 @@ export class AppConfigService implements CurrentAppConfig {
|
||||
const appConfig = await this.loadAppConfigPromise
|
||||
this.appConfig = appConfig || null
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
finally {
|
||||
this.loadAppConfigPromise = undefined
|
||||
}
|
||||
@@ -137,6 +143,12 @@ export class AppConfigService implements CurrentAppConfig {
|
||||
if (!this.appConfig)
|
||||
await this.loadAppConfig()
|
||||
|
||||
if (!this.appConfig) {
|
||||
this.showNotificationModal = false
|
||||
this.showReleaseModal = false
|
||||
return
|
||||
}
|
||||
|
||||
const currentConfig = this.currentConfig
|
||||
const storage = await this.getStorage()
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"require": "./dist/index.cjs",
|
||||
"import": "./dist/index.mjs"
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
@@ -53,4 +53,4 @@
|
||||
"dependencies": {
|
||||
"@nicepkg/gpt-runner-shared": "workspace:*"
|
||||
}
|
||||
}
|
||||
}
|
||||
1486
pnpm-lock.yaml
generated
1486
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user