diff --git a/forge/config/index.js b/forge/config/index.js index 5b710fa44c..d4db276c5b 100644 --- a/forge/config/index.js +++ b/forge/config/index.js @@ -130,6 +130,15 @@ module.exports = { } } + if (config.assistant?.enabled === true && !config.assistant.service?.url) { + config.assistant.service = config.assistant.service || {} + config.assistant.service.url = 'https://expert.flowfuse/v1/openai' + } + if (config.expert?.enabled === true && !config.expert.service?.url) { + config.expert.service = config.expert.service || {} + config.expert.service.url = 'https://expert.flowfuse/v4/expert' + } + const defaultLogging = { level: 'info', http: 'warn', diff --git a/test/unit/forge/routes/api/assistant_spec.js b/test/unit/forge/routes/api/assistant_spec.js index 046197d863..a936978480 100644 --- a/test/unit/forge/routes/api/assistant_spec.js +++ b/test/unit/forge/routes/api/assistant_spec.js @@ -69,18 +69,6 @@ describe('Assistant API', async function () { }) response.statusCode.should.equal(501) }) - it('should return 501 if assistant service url is not set', async function () { - app2 = await setupApp({ assistant: { enabled: true, service: { url: null } } }) - const instance = app2.project - const token = (await instance.refreshAuthTokens()).token - const response = await app2.inject({ - method: 'POST', - url: '/api/v1/assistant/function', - headers: { authorization: 'Bearer ' + token }, - payload: { prompt: 'multiply by 5', transactionId: '1234' } - }) - response.statusCode.should.equal(501) - }) }) describe('service enabled', async function () { diff --git a/test/unit/forge/routes/api/expert_spec.js b/test/unit/forge/routes/api/expert_spec.js index 6e6f4d47ab..c7ee5c6cfd 100644 --- a/test/unit/forge/routes/api/expert_spec.js +++ b/test/unit/forge/routes/api/expert_spec.js @@ -1497,17 +1497,5 @@ describe('Expert API', function () { }) response.statusCode.should.equal(501) }) - it('should return 501 if expert service url is not set', async function () { - app = await setupApp({ expert: { enabled: true, service: { url: null } } }) - const instance = app.project - const token = (await instance.refreshAuthTokens()).token - const response = await app.inject({ - method: 'POST', - url: '/api/v1/expert/chat', - headers: { authorization: 'Bearer ' + token }, - payload: { context: { team: 'teamid' }, query: 'test' } - }) - response.statusCode.should.equal(501) - }) }) })