mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
refac/fix: ollama model delete
This commit is contained in:
parent
c8071a3180
commit
0f3156651c
2 changed files with 5 additions and 8 deletions
|
|
@ -879,6 +879,7 @@ async def delete_model(
|
|||
url = request.app.state.config.OLLAMA_BASE_URLS[url_idx]
|
||||
key = get_api_key(url_idx, url, request.app.state.config.OLLAMA_API_CONFIGS)
|
||||
|
||||
r = None
|
||||
try:
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
|
|
@ -892,7 +893,7 @@ async def delete_model(
|
|||
method="DELETE",
|
||||
url=f"{url}/api/delete",
|
||||
headers=headers,
|
||||
data=form_data.model_dump_json(exclude_none=True).encode(),
|
||||
json=form_data,
|
||||
)
|
||||
r.raise_for_status()
|
||||
|
||||
|
|
@ -949,10 +950,7 @@ async def show_model_info(
|
|||
headers = include_user_info_headers(headers, user)
|
||||
|
||||
r = requests.request(
|
||||
method="POST",
|
||||
url=f"{url}/api/show",
|
||||
headers=headers,
|
||||
data=form_data.model_dump_json(exclude_none=True).encode(),
|
||||
method="POST", url=f"{url}/api/show", headers=headers, json=form_data
|
||||
)
|
||||
r.raise_for_status()
|
||||
|
||||
|
|
|
|||
|
|
@ -811,9 +811,8 @@
|
|||
bind:value={deleteModelTag}
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
>
|
||||
{#if !deleteModelTag}
|
||||
<option value="" disabled selected>{$i18n.t('Select a model')}</option>
|
||||
{/if}
|
||||
<option value="" disabled selected>{$i18n.t('Select a model')}</option>
|
||||
|
||||
{#each ollamaModels as model}
|
||||
<option value={model.id} class="bg-gray-50 dark:bg-gray-700"
|
||||
>{model.name + ' (' + (model.size / 1024 ** 3).toFixed(1) + ' GB)'}</option
|
||||
|
|
|
|||
Loading…
Reference in a new issue