q-koa 13.1.2 → 13.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -604,7 +604,7 @@ exports.gpt = async (ctx) => {
604
604
  const appConfig = getConfig(app)
605
605
  const { ai_key } = await appConfig.getObject('base')
606
606
  const { content, session_id, is_chunk = true } = ctx.request.body
607
-
607
+ if (!ai_key) throw new ServiceError('没有配置ai_key')
608
608
  if (!content) throw new ServiceError('没有内容content')
609
609
  let statusCode = 200
610
610
  const url =
@@ -72,32 +72,38 @@ exports.initModel = async (ctx) => {
72
72
  return ctx.ERROR('请检查,model为空')
73
73
  }
74
74
  if (app.appConfig.productionHost) {
75
- const { code, data: productionModel } = await axios
76
- .post(
77
- `${app.appConfig.productionHost}/${appName}/system/getTable`,
78
- {
79
- model,
80
- },
81
- {
82
- headers: {
83
- 'client-type': 0,
75
+ const productionHost = Array.isArray(app.appConfig.productionHost)
76
+ ? app.appConfig.productionHost
77
+ : [app.appConfig.productionHost]
78
+
79
+ for (const host of productionHost) {
80
+ const { code, data: productionModel } = await axios
81
+ .post(
82
+ `${host}/${appName}/system/getTable`,
83
+ {
84
+ model,
84
85
  },
85
- }
86
- )
87
- .then((res) => res.data)
88
- if (code === 200) {
89
- const findList = Object.keys(productionModel).filter((key) => {
90
- return (
91
- !['id', 'created_at', 'createdid', 'updated_at'].includes(key) &&
92
- !Object.keys(app.attributes[model]).includes(key)
93
- )
94
- })
95
- if (findList.length > 0) {
96
- return ctx.ERROR(
97
- `${model} 线上字段 ${findList.join(
98
- '/'
99
- )} 不能被删除,请先修改线上model.js`
86
+ {
87
+ headers: {
88
+ 'client-type': 0,
89
+ },
90
+ }
100
91
  )
92
+ .then((res) => res.data)
93
+ if (code === 200) {
94
+ const findList = Object.keys(productionModel).filter((key) => {
95
+ return (
96
+ !['id', 'created_at', 'createdid', 'updated_at'].includes(key) &&
97
+ !Object.keys(app.attributes[model]).includes(key)
98
+ )
99
+ })
100
+ if (findList.length > 0) {
101
+ return ctx.ERROR(
102
+ `${model} 线上字段 ${findList.join(
103
+ '/'
104
+ )} 不能被删除,请先修改线上model.js`
105
+ )
106
+ }
101
107
  }
102
108
  }
103
109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "13.1.2",
3
+ "version": "13.1.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {