MaiXinRong 1 месяц назад
Родитель
Сommit
e92498ea54

+ 2 - 2
app/controller/ledger_controller.js

@@ -1192,7 +1192,7 @@ module.exports = app => {
 
             const validColSet = data.template.col_set.filter(x => { return !x.expr; });
             const AIInspect = require('../lib/ai_inspect');
-            const aiInspect = new AIInspect({ apiKey: 'app-BIOhBbFlNSakoRGKU91e2ksJ', baseUrl: 'http://39.108.81.93:8080/v1' });
+            const aiInspect = new AIInspect({ apiKey: ctx.difyInfo.apiKey.image2PosCalcDetail, baseUrl: ctx.difyInfo.baseUrl });
             const transResult = await aiInspect.posCalcDetailRead(validColSet, data.billsName, data.keyword, data.files);
             const rows = transResult.res.split('\n').filter(x => { return !!x; });
             rows.shift();
@@ -1217,7 +1217,7 @@ module.exports = app => {
 
             const validColSet = data.template.col_set.filter(x => { return !x.expr; });
             const AIInspect = require('../lib/ai_inspect');
-            const aiInspect = new AIInspect({ apiKey: 'app-FtAs299O9xFzTOVB4TlaZ73O', baseUrl: 'http://39.108.81.93:8080/v1' });
+            const aiInspect = new AIInspect({ apiKey: ctx.difyInfo.apiKey.image2Pos, baseUrl: ctx.difyInfo.baseUrl });
             const transResult = await aiInspect.posCalcDetailRead(validColSet, data.billsName, data.keyword, data.files);
             const parts = transResult.res.split('\n==++==\n').filter(x => { return !!x; });
             const pos = [];

+ 1 - 1
app/controller/tender_controller.js

@@ -1861,7 +1861,7 @@ module.exports = app => {
 
                 const result = await ctx.service.tempFile.addFiles(ctx.tender.id, uploadfiles, user);
                 const AIInspect = require('../lib/ai_inspect');
-                const aiInspect = new AIInspect({ apiKey: 'app-UGCJ6nlhZIcldyArOUyNwM21', baseUrl: 'http://39.108.81.93:8080/v1' });
+                const aiInspect = new AIInspect({ apiKey: ctx.difyInfo.apiKey.image2Excel, baseUrl: ctx.difyInfo.baseUrl });
                 const transResult = await aiInspect.imageTransExcel(result);
                 ctx.body = { err: 0, msg: '', data: transResult.res };
             } catch (err) {

+ 4 - 0
app/extend/context.js

@@ -90,6 +90,10 @@ module.exports = {
         return this.app.config.stashOssPath;
     },
 
+    get difyInfo() {
+        return this.app.config.difyInfo;
+    },
+
     print(str) {
         this.getLogger('out').info(str);
     },

+ 10 - 0
config/config.default.js

@@ -277,5 +277,15 @@ module.exports = appInfo => {
     };
 
     config.kkfileUrl = '/preview/onlinePreview?url=';
+
+    config.difyInfo = {
+        baseUrl: 'http://workflow.smartcost.com.cn/v1',
+        apiKey: {
+            image2Excel: 'app-UGCJ6nlhZIcldyArOUyNwM21',
+            image2PosCalcDetail: 'app-BIOhBbFlNSakoRGKU91e2ksJ',
+            image2AncGclDetail: 'app-BIOhBbFlNSakoRGKU91e2ksJ',
+            image2Pos: 'app-FtAs299O9xFzTOVB4TlaZ73O',
+        },
+    };
     return config;
 };

+ 10 - 0
config/config.local.js

@@ -117,5 +117,15 @@ module.exports = appInfo => {
 
     config.url3f = 'http://127.0.0.1:7005/3f';
     config.kkfileUrl = 'http://jlqa.smartcost.com.cn:8012/onlinePreview?url=';
+
+    config.difyInfo = {
+        baseUrl: 'http://39.108.81.93:8080/v1',
+        apiKey: {
+            image2Excel: 'app-UGCJ6nlhZIcldyArOUyNwM21',
+            image2PosCalcDetail: 'app-BIOhBbFlNSakoRGKU91e2ksJ',
+            image2AncGclDetail: 'app-BIOhBbFlNSakoRGKU91e2ksJ',
+            image2Pos: 'app-FtAs299O9xFzTOVB4TlaZ73O',
+        },
+    };
     return config;
 };

+ 10 - 0
config/config.qa.js

@@ -92,5 +92,15 @@ module.exports = appInfo => {
 
     config.url3f = 'http://jlqa.smartcost.com.cn:7005/3f';
     config.kkfileUrl = 'http://jlqa.smartcost.com.cn:8012/onlinePreview?url=';
+
+    config.difyInfo = {
+        baseUrl: 'http://39.108.81.93:8080/v1',
+        apiKey: {
+            image2Excel: 'app-UGCJ6nlhZIcldyArOUyNwM21',
+            image2PosCalcDetail: 'app-BIOhBbFlNSakoRGKU91e2ksJ',
+            image2AncGclDetail: 'app-BIOhBbFlNSakoRGKU91e2ksJ',
+            image2Pos: 'app-FtAs299O9xFzTOVB4TlaZ73O',
+        },
+    };
     return config;
 };