Skip to content

Preserve URL path when building relative URLs in JS#733

Merged
cjpais merged 1 commit intomozilla-ai:mainfrom
dmcardle:js-fix-relative-url
Apr 9, 2025
Merged

Preserve URL path when building relative URLs in JS#733
cjpais merged 1 commit intomozilla-ai:mainfrom
dmcardle:js-fix-relative-url

Conversation

@dmcardle
Copy link
Copy Markdown
Contributor

It's necessary to preserve the path because the server might be hosted under a subdirectory, specified by --url-prefix.

Fixes #732

if (!generation_settings) {
const url_prefix = config.url_prefix || "";
const props = await fetch(`${url_prefix}/props`).then(r => r.json());
const props = await fetch(buildUrl(url_prefix, 'props')).then(r => r.json());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just updated this one mechanically, but couldn't figure out how to test it. Upon further inspection, I can't find any references to llamaModelInfo in the repo. Maybe it should just be deleted?

@dmcardle
Copy link
Copy Markdown
Contributor Author

@cjpais, PTAL if that makes sense!

I'm not sure whether I need to tag someone, but I figured you might still have context from #641.

@cjpais
Copy link
Copy Markdown
Collaborator

cjpais commented Mar 30, 2025

ahh ty, i will take a look, might be later in the week after i get 0.9.2 out, but i will try to get a patch with 0.9.3 with this in it after

@dmcardle
Copy link
Copy Markdown
Contributor Author

Awesome, thank you!

It's necessary to preserve the path because the server might be hosted
under a subdirectory, specified by `--url-prefix`.

Fixes mozilla-ai#732
@dmcardle dmcardle force-pushed the js-fix-relative-url branch from b699214 to b49946f Compare April 4, 2025 03:53
@dmcardle
Copy link
Copy Markdown
Contributor Author

dmcardle commented Apr 8, 2025

Ping @cjpais, but no rush :)

@cjpais
Copy link
Copy Markdown
Collaborator

cjpais commented Apr 8, 2025

I'll test and get it in tomorrow!

@cjpais
Copy link
Copy Markdown
Collaborator

cjpais commented Apr 9, 2025

thanks for this, tested and it works

@cjpais cjpais merged commit cf1cc74 into mozilla-ai:main Apr 9, 2025
1 check passed
@dmcardle dmcardle deleted the js-fix-relative-url branch April 9, 2025 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: UI attempts to fetch "/completion", ignoring value passed to --url-prefix

2 participants