Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions workspaces/lightspeed/.changeset/cold-taxis-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@red-hat-developer-hub/backstage-plugin-lightspeed-backend': patch
---

Make Lightspeed service port configurable
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ lightspeed:
- id: <server id>
url: <serverURL>
token: <api key>
questionValidation: true # Optional - To disable question (prompt) validation set it to false.
questionValidation: true # Optional - To disable question (prompt) validation set it to false.
servicePort: <portNumber> # Optional - Change the LS service port nubmer. Defaults to 8080.
```

Example local development configuration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,10 @@ export interface Config {
* @visibility frontend
*/
questionValidation?: boolean;
/**
* configure the port number for the lightspeed service.
* @visibility backend
*/
servicePort?: number;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export async function createRouter(
const router = Router();
router.use(express.json());

const port = config.getOptionalNumber('lightspeed.servicePort') ?? 8080;

router.get('/health', (_, response) => {
response.json({ status: 'ok' });
});
Expand Down Expand Up @@ -127,7 +129,7 @@ export async function createRouter(
// Proxy middleware configuration
const apiProxy = createProxyMiddleware({
// target: config.getConfigArray('lightspeed.servers')[0].getString('url'), // currently only single llm server is supported
target: 'http://0.0.0.0:8080',
target: `http://0.0.0.0:${port}`,
changeOrigin: true,
pathRewrite: (path, _) => {
// Add user query parameter from the authenticated user
Expand Down Expand Up @@ -170,7 +172,7 @@ export async function createRouter(
request.body.media_type = 'application/json'; // set media_type to receive start and end event
const requestBody = JSON.stringify(request.body);
const fetchResponse = await fetch(
`http://0.0.0.0:8080/v1/streaming_query?${userQueryParam}`,
`http://0.0.0.0:${port}/v1/streaming_query?${userQueryParam}`,
{
method: 'POST',
headers: {
Expand Down