mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-06 05:24:33 +08:00
fix: Fix the abnormal status of the ollama model (#8223)
This commit is contained in:
parent
818ef0e1f0
commit
7d81dad822
3 changed files with 16 additions and 4 deletions
|
@ -164,7 +164,18 @@ func (u *AIToolService) Recreate(req dto.OllamaModelName) error {
|
|||
taskItem.AddSubTask(i18n.GetWithName("OllamaModelPull", req.Name), func(t *task.Task) error {
|
||||
return cmd.ExecShellWithTask(taskItem, time.Hour, "docker", "exec", containerName, "ollama", "pull", req.Name)
|
||||
}, nil)
|
||||
_ = taskItem.Execute()
|
||||
taskItem.AddSubTask(i18n.GetWithName("OllamaModelSize", req.Name), func(t *task.Task) error {
|
||||
itemSize, err := loadModelSize(modelInfo.Name, containerName)
|
||||
if len(itemSize) != 0 {
|
||||
_ = aiRepo.Update(modelInfo.ID, map[string]interface{}{"status": constant.StatusSuccess, "size": itemSize})
|
||||
} else {
|
||||
_ = aiRepo.Update(modelInfo.ID, map[string]interface{}{"status": constant.StatusFailed, "message": err.Error()})
|
||||
}
|
||||
return nil
|
||||
}, nil)
|
||||
if err := taskItem.Execute(); err != nil {
|
||||
_ = aiRepo.Update(modelInfo.ID, map[string]interface{}{"status": constant.StatusFailed, "message": err.Error()})
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
:indeterminate="isIndeterminate"
|
||||
@change="handleCheckAllChange"
|
||||
>
|
||||
{{ $t('setting.all') }}
|
||||
{{ $t('commons.table.all') }}
|
||||
</el-checkbox>
|
||||
<el-checkbox-group v-model="checkedItems" @change="handleCheckedChange">
|
||||
<el-checkbox v-for="(item, index) in list" :key="index" :label="item.name" :value="item.id" />
|
||||
|
@ -55,9 +55,10 @@ interface DialogProps {
|
|||
list: Array<AI.OllamaModelDropInfo>;
|
||||
}
|
||||
const acceptParams = (props: DialogProps): void => {
|
||||
checkAll.value = false;
|
||||
checkedItems.value = [];
|
||||
list.value = props.list;
|
||||
checkAll.value = true;
|
||||
handleCheckAllChange(true);
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
|
|||
const initTerm = () => {
|
||||
nextTick(() => {
|
||||
terminalRef.value.acceptParams({
|
||||
endpoint: '/api/v2/ai/containers/exec',
|
||||
endpoint: '/api/v2/containers/exec',
|
||||
args: `source=ollama&name=${itemName.value}`,
|
||||
error: '',
|
||||
initCmd: '',
|
||||
|
|
Loading…
Add table
Reference in a new issue