diff --git a/src/browser.ts b/src/browser.ts index 1ea64f7..7057ff2 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -25,7 +25,7 @@ import type { ShowResponse, StatusResponse, } from './interfaces.js' -import { defaultHost } from './defaultHost.js' +import { defaultHost } from './constant.js' export class Ollama { protected readonly config: Config diff --git a/src/constant.ts b/src/constant.ts new file mode 100644 index 0000000..33162b2 --- /dev/null +++ b/src/constant.ts @@ -0,0 +1,2 @@ +export const defaultPort = '11434'; +export const defaultHost = `http://127.0.0.1:${defaultPort}`; diff --git a/src/defaultHost.ts b/src/defaultHost.ts deleted file mode 100644 index fc5a587..0000000 --- a/src/defaultHost.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const defaulPort = '11434'; -export const defaultHost = `http://127.0.0.1:${defaulPort}`; \ No newline at end of file diff --git a/src/utils.ts b/src/utils.ts index ed21fbd..6a76670 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,6 +1,6 @@ import { version } from './version.js' import type { ErrorResponse, Fetch } from './interfaces.js' -import { defaulPort, defaultHost } from './defaultHost.js' +import { defaultPort, defaultHost } from './constant.js' /** * An error class for response errors. @@ -289,7 +289,7 @@ export const formatHost = (host: string): string => { let port = url.port if (!port) { if (!isExplicitProtocol) { - port = defaulPort + port = defaultPort } else { // Assign default ports based on the protocol port = url.protocol === 'https:' ? '443' : '80'