Skip to content

Commit cea41b4

Browse files
authored
Merge pull request #6949 from FlowFuse/default-ff-expect-urls
Add default expert URLs
2 parents c8c9ce5 + e01799c commit cea41b4

3 files changed

Lines changed: 9 additions & 24 deletions

File tree

forge/config/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ module.exports = {
130130
}
131131
}
132132

133+
if (config.assistant?.enabled === true && !config.assistant.service?.url) {
134+
config.assistant.service = config.assistant.service || {}
135+
config.assistant.service.url = 'https://expert.flowfuse/v1/openai'
136+
}
137+
if (config.expert?.enabled === true && !config.expert.service?.url) {
138+
config.expert.service = config.expert.service || {}
139+
config.expert.service.url = 'https://expert.flowfuse/v4/expert'
140+
}
141+
133142
const defaultLogging = {
134143
level: 'info',
135144
http: 'warn',

test/unit/forge/routes/api/assistant_spec.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,6 @@ describe('Assistant API', async function () {
6969
})
7070
response.statusCode.should.equal(501)
7171
})
72-
it('should return 501 if assistant service url is not set', async function () {
73-
app2 = await setupApp({ assistant: { enabled: true, service: { url: null } } })
74-
const instance = app2.project
75-
const token = (await instance.refreshAuthTokens()).token
76-
const response = await app2.inject({
77-
method: 'POST',
78-
url: '/api/v1/assistant/function',
79-
headers: { authorization: 'Bearer ' + token },
80-
payload: { prompt: 'multiply by 5', transactionId: '1234' }
81-
})
82-
response.statusCode.should.equal(501)
83-
})
8472
})
8573

8674
describe('service enabled', async function () {

test/unit/forge/routes/api/expert_spec.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,17 +1497,5 @@ describe('Expert API', function () {
14971497
})
14981498
response.statusCode.should.equal(501)
14991499
})
1500-
it('should return 501 if expert service url is not set', async function () {
1501-
app = await setupApp({ expert: { enabled: true, service: { url: null } } })
1502-
const instance = app.project
1503-
const token = (await instance.refreshAuthTokens()).token
1504-
const response = await app.inject({
1505-
method: 'POST',
1506-
url: '/api/v1/expert/chat',
1507-
headers: { authorization: 'Bearer ' + token },
1508-
payload: { context: { team: 'teamid' }, query: 'test' }
1509-
})
1510-
response.statusCode.should.equal(501)
1511-
})
15121500
})
15131501
})

0 commit comments

Comments
 (0)