Skip to content

Commit 65ec918

Browse files
authored
Merge pull request #7132 from FlowFuse/move-expert-to-ee
Move expert to ee
2 parents 011c66e + 4ec85f6 commit 65ec918

7 files changed

Lines changed: 22 additions & 23 deletions

File tree

forge/ee/lib/index.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ module.exports = fp(async function (app, opts) {
3434
app.config.features.register('ffNodes', true, true)
3535
app.config.features.register('rbacApplication', true, true)
3636
require('./autoUpdateStacks').init(app)
37+
38+
// Expert
39+
await app.register(require('./expert'))
40+
41+
// Set the Generate Snapshot Description Feature Flag
42+
app.config.features.register('generatedSnapshotDescription', true, true)
43+
44+
// Set the assistant inline completions Feature Flag
45+
app.config.features.register('assistantInlineCompletions', true, true)
46+
47+
// Set the expert assistant Feature Flag
48+
app.config.features.register('expertAssistant', app.config?.expert?.enabled ?? false, true)
49+
50+
// temporary until FF Expert Insights can be enabled on Self Hosted EE instance
51+
const isInsightsEnabled = app.config?.expert?.enabled && app.config?.expert?.insights?.enabled
52+
app.config.features.register('expertInsights', isInsightsEnabled ?? false, false)
3753
}
3854

3955
// Set the Team Library Feature Flag
@@ -53,17 +69,4 @@ module.exports = fp(async function (app, opts) {
5369

5470
// Set the Editor Limits Feature Flag
5571
app.config.features.register('editorLimits', true, true)
56-
57-
// Set the Editor Limits Feature Flag
58-
app.config.features.register('generatedSnapshotDescription', true, true)
59-
60-
// Set the assistant inline completions Feature Flag
61-
app.config.features.register('assistantInlineCompletions', true, true)
62-
63-
// Set the expert assistant Feature Flag
64-
app.config.features.register('expertAssistant', app.config?.expert?.enabled ?? false, true)
65-
66-
// temporary until FF Expert Insights can be enabled on Self Hosted EE instance
67-
const isInsightsEnabled = app.config?.expert?.enabled && app.config?.expert?.insights?.enabled
68-
app.config.features.register('expertInsights', isInsightsEnabled ?? false, false)
6972
}, { name: 'app.ee.lib' })
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
const { default: axios } = require('axios')
1010
const { v4: uuidv4 } = require('uuid')
1111

12-
const { filterAccessibleMCPServerFeatures } = require('../../services/expert.js')
12+
const { filterAccessibleMCPServerFeatures } = require('../../../services/expert.js')
1313

1414
/**
1515
* @param {import('../../forge.js').ForgeApplication} app

forge/ee/routes/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = async function (app) {
4141
}
4242
await app.register(require('./mcp'), { prefix: '/api/v1/teams/:teamId/mcp', logLevel: app.config.logging.http })
4343
await app.register(require('./autoUpdateStacks'), { prefix: '/api/v1/projects/:projectId/autoUpdateStack', logLevel: app.config.logging.http })
44+
await app.register(require('./expert'), { prefix: '/api/v1/expert', logLevel: app.config.logging.http })
4445

4546
// Important: keep SSO last to avoid its error handling polluting other routes.
4647
await app.register(require('./sso'), { logLevel: app.config.logging.http })

forge/forge.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const config = require('./config') // eslint-disable-line n/no-unpublished-requi
1111
const containers = require('./containers')
1212
const db = require('./db')
1313
const ee = require('./ee')
14-
const expert = require('./expert')
1514
const housekeeper = require('./housekeeper')
1615
const { generatePassword } = require('./lib/userTeam')
1716
const license = require('./licensing')
@@ -254,8 +253,6 @@ module.exports = async (options = {}) => {
254253
await server.register(auditLog)
255254
// Housekeeper
256255
await server.register(housekeeper)
257-
// Expert
258-
await server.register(expert)
259256

260257
// HTTP Server configuration
261258
if (!server.settings.get('cookieSecret')) {

forge/routes/api/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const Admin = require('./admin.js')
99
const Application = require('./application.js')
1010
const Assistant = require('./assistant.js')
1111
const Device = require('./device.js')
12-
const Expert = require('./expert.js')
1312
const Project = require('./project.js')
1413
const ProjectType = require('./projectType.js')
1514
const Search = require('./search.js')
@@ -38,7 +37,6 @@ module.exports = async function (app) {
3837
app.register(ProjectType, { prefix: '/project-types' })
3938
app.register(Snapshot, { prefix: '/snapshots' })
4039
app.register(Assistant, { prefix: '/assistant' })
41-
app.register(Expert, { prefix: '/expert' })
4240
app.register(Search, { prefix: '/search' })
4341
app.get('*', function (request, reply) {
4442
reply.code(404).send({ code: 'not_found', error: 'Not Found' })

test/unit/forge/routes/api/expert_spec.js renamed to test/unit/forge/ee/routes/expert/index_spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ const { default: axios } = require('axios')
33
const should = require('should') // eslint-disable-line
44
const sinon = require('sinon')
55

6-
const { sha256 } = require('../../../../../forge/db/utils.js')
7-
const { Roles } = require('../../../../../forge/lib/roles.js')
6+
const { sha256 } = require('../../../../../../forge/db/utils.js')
7+
const { Roles } = require('../../../../../../forge/lib/roles.js')
88
// eslint-disable-next-line no-unused-vars
9-
const TestModelFactory = require('../../../../lib/TestModelFactory')
10-
const setup = require('../setup')
9+
const TestModelFactory = require('../../../../../lib/TestModelFactory.js')
10+
const setup = require('../../../routes/setup.js')
1111

1212
describe('Expert API', function () {
1313
async function setupApp (config = {}) {

0 commit comments

Comments
 (0)