Skip to content

Commit

Permalink
feat: umi 89
Browse files Browse the repository at this point in the history
feat: umi 89
  • Loading branch information
xiaohuoni authored Dec 12, 2023
2 parents a08ca8e + 4d25920 commit 9bdb862
Show file tree
Hide file tree
Showing 13 changed files with 2,686 additions and 721 deletions.
11 changes: 11 additions & 0 deletions .changeset/chatty-phones-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@alita/plugin-lowcode': patch
'create-alita': patch
'@alita/plugin-azure': patch
'@alita/autoimport': patch
'@alita/plugins': patch
'@alita/native': patch
'alita': patch
---

feat: umi 89
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
"@types/react-dom": "^18.0.5",
"@types/resolve": "^1.20.2",
"@types/rimraf": "3.0.2",
"@umijs/plugin-docs": "4.0.81",
"@umijs/plugin-docs": "4.0.89",
"@playwright/test": "^1.30.0",
"@umijs/utils": "4.0.81",
"@umijs/utils": "4.0.89",
"@vercel/ncc": "0.33.3",
"start-server-and-test": "^1.15.3",
"all-contributors-cli": "^6.20.4",
Expand Down Expand Up @@ -83,7 +83,7 @@
"turbo": "^1.3.1",
"typescript": "^4.7.2",
"uglify-js": "^3.15.4",
"umi": "4.0.81",
"umi": "4.0.89",
"umi-scripts": "workspace:*",
"yorkie": "^2.0.0",
"zx": "^7.2.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/alita/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"@alita/native": "3.2.10",
"@alita/plugins": "3.3.7",
"@alita/plugin-azure": "3.0.5",
"@umijs/core": "4.0.81",
"@umijs/bundler-webpack": "4.0.81",
"@umijs/babel-preset-umi": "4.0.81",
"@umijs/preset-umi": "4.0.81",
"@umijs/utils": "4.0.81",
"umi": "4.0.81"
"@umijs/core": "4.0.89",
"@umijs/bundler-webpack": "4.0.89",
"@umijs/babel-preset-umi": "4.0.89",
"@umijs/preset-umi": "4.0.89",
"@umijs/utils": "4.0.89",
"umi": "4.0.89"
}
}
31 changes: 25 additions & 6 deletions packages/alita/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
import { logger, yParser } from '@umijs/utils';
import { dev } from 'umi/dist/cli/dev';
import { Service } from 'umi/dist/service/service';
import {
catchUnhandledRejection,
checkLocal,
checkVersion as checkNodeVersion,
} from 'umi/dist/cli/node';
import { DEV_COMMAND } from 'umi/dist/constants';
import { Service } from 'umi/dist/service/service';
logger,
printHelp,
setNoDeprecation,
setNodeTitle,
yParser,
} from '@umijs/utils';
import { DEV_COMMAND, FRAMEWORK_NAME, MIN_NODE_VERSION } from './constants';

interface IOpts {
presets?: string[];
defaultConfigFiles?: string[];
}
catchUnhandledRejection();

const ver = parseInt(process.version.slice(1));

export function checkNodeVersion(minVersion: number, message?: string) {
if (ver < minVersion) {
logger.error(
message ||
`Your node version ${ver} is not supported, please upgrade to ${minVersion} or above except 15 or 17.`,
);
process.exit(1);
}
}
export async function run(opts: IOpts = {}) {
checkNodeVersion();
checkNodeVersion(MIN_NODE_VERSION);
checkLocal();
setNodeTitle(FRAMEWORK_NAME);
setNoDeprecation();

const args = yParser(process.argv.slice(2), {
alias: {
Expand Down Expand Up @@ -51,6 +69,7 @@ export async function run(opts: IOpts = {}) {
});
} catch (e: any) {
logger.error(e);
printHelp.exit();
process.exit(1);
}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/alita/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const MIN_NODE_VERSION = 14;
export const DEV_COMMAND = 'dev';
export const FRAMEWORK_NAME = 'alita';
4 changes: 2 additions & 2 deletions packages/autoimport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"access": "public"
},
"dependencies": {
"@umijs/bundler-utils": "4.0.81",
"@umijs/utils": "4.0.81"
"@umijs/bundler-utils": "4.0.89",
"@umijs/utils": "4.0.89"
}
}
2 changes: 1 addition & 1 deletion packages/create-alita/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"create-alita": "bin/create-alita.js"
},
"dependencies": {
"@umijs/utils": "4.0.81"
"@umijs/utils": "4.0.89"
}
}
2 changes: 1 addition & 1 deletion packages/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@alita/types": "3.1.2",
"@umijs/utils": "4.0.81"
"@umijs/utils": "4.0.89"
},
"license": "MIT"
}
2 changes: 1 addition & 1 deletion packages/plugin-azure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"access": "public"
},
"dependencies": {
"@umijs/utils": "4.0.81",
"@umijs/utils": "4.0.89",
"openai": "^4.19.1"
}
}
14 changes: 10 additions & 4 deletions packages/plugin-azure/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ export default (api: IApi) => {
apiVersion: zod.string(),
model: zod.string(),
resource: zod.string(),
whyQuestion: zod.string(),
})
.partial();
},
default: {
apiVersion: '2023-07-01-preview',
model: 'alita4',
resource: 'alita',
},
},
});
api.registerMethod({ name: 'onIntlAzure' });
Expand Down Expand Up @@ -214,12 +220,12 @@ export default (api: IApi) => {
join(api.paths.absNodeModulesPath, '.cache', 'logger', 'umi.log'),
),
);
console.log(errorLog);
if (errorLog.length > 0) {
const {
whyQuestion = '我在使用 umi 系列框架的时候,遇到这个问题,服务挂了,请帮我分析一下可能的原因,并提供可能的修复方式,日志如下',
} = api.config.azure;
const result = await sendAi(
`我在使用 umi 系列框架的时候,遇到这个问题,服务挂了,请帮我分析一下可能的原因,并提供可能的修复方式,日志如下${JSON.stringify(
errorLog.pop(),
)}`,
`${whyQuestion}${JSON.stringify(errorLog.pop())}`,
);
const content = result.choices[0]!.message?.content || '{}';
if (content) {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-lowcode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
},
"dependencies": {
"@alita/types": "3.1.2",
"@umijs/utils": "4.0.81"
"@umijs/utils": "4.0.89"
}
}
6 changes: 3 additions & 3 deletions packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"@alita/inspx": "0.0.2",
"@alita/request": "3.1.2",
"@alita/types": "3.1.2",
"@umijs/bundler-utils": "4.0.81",
"@umijs/plugins": "4.0.81",
"@umijs/utils": "4.0.81",
"@umijs/bundler-utils": "4.0.89",
"@umijs/plugins": "4.0.89",
"@umijs/utils": "4.0.89",
"ahooks": "^3.0.8",
"antd-mobile-alita": "^2.3.4",
"antd-mobile-icons": "^0.2.2",
Expand Down
Loading

0 comments on commit 9bdb862

Please sign in to comment.