Fixed port handling so it returns the correct port and not only 6663

This commit is contained in:
tuxBurner 2024-01-04 16:07:54 +01:00
parent 609ae8703d
commit 2355cb2ec5
1 changed files with 5 additions and 1 deletions

View File

@ -257,14 +257,18 @@ class Qdrant_VectorStores implements INode {
* @param qdrantServerUrl the url to get the port from
*/
static determinePortByUrl(qdrantServerUrl: string) :number {
let port = 6333;
const parsedUrl = new URL(qdrantServerUrl);
let port = parsedUrl.port ? parseInt(parsedUrl.port) : 6663
if (parsedUrl.protocol === 'https:' && parsedUrl.port === '') {
port = 443;
}
if (parsedUrl.protocol === 'http:' && parsedUrl.port === '') {
port = 80;
}
return port;
}
}