Skip to content

Commit

Permalink
26 - Adding final changes before merging with dev
Browse files Browse the repository at this point in the history
Signed-off-by: julianbollig <[email protected]>
  • Loading branch information
julianbollig committed Nov 26, 2024
1 parent d12a89f commit 8ad22a0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
27 changes: 13 additions & 14 deletions WebUI/src/components/AddLLMDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<script setup lang="ts">
import { useGlobalSetup } from '@/assets/js/store/globalSetup';
import { useI18N } from '@/assets/js/store/i18n';
import { useModels, userModels , ModelType} from '@/assets/js/store/models';
import { useModels, userModels } from '@/assets/js/store/models';
const i18nState = useI18N().state;
Expand Down Expand Up @@ -62,9 +62,15 @@ async function addModel() {
addModelError.value = false
const is_llm = await isLLM(modelRequest.value);
if (!is_llm) {
emits("showWarning", i18nState.WARNING_MODEL_TYPE_WRONG, () => {performDownload()});
emits("showWarning", i18nState.WARNING_MODEL_TYPE_WRONG, async() => {
await registerModel();
emits("callCheckModel");
closeAdd();
});
} else {
await performDownload()
await registerModel()
emits("callCheckModel");
closeAdd();
}
} else {
globalSetup.modelSettings.llm_model = previousModel
Expand All @@ -78,16 +84,14 @@ async function addModel() {
}
}
async function performDownload() {
async function registerModel() {
userModels.push({name: modelRequest.value, type: 'llm', downloaded: false})
await models.refreshModels()
globalSetup.modelSettings.llm_model = modelRequest.value;
emits("callCheckModel");
closeAdd()
}
async function urlExists(repo_id: string) {
const response = await fetch(`${globalSetup.apiHost}/api/checkURLExists?repo_id=${repo_id}`)
const response = await fetch(`${globalSetup.apiHost}/api/checkHFRepoExists?repo_id=${repo_id}`)
const data = await response.json()
return data.exists;
}
Expand All @@ -99,17 +103,12 @@ async function isLLM(repo_id: string) {
}
function closeAdd() {
addModelErrorMessage.value = "";
addModelError.value = false;
modelRequest.value = "";
emits("close");
}
defineExpose({ onShow });
</script>
<style scoped>
table {
border-collapse: separate;
border-spacing: 10px;
}
</style>
</script>
8 changes: 1 addition & 7 deletions WebUI/src/components/WarningDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,4 @@ function onShow(){
defineExpose({warningMessage, confirmFunction, onShow });
</script>
<style scoped>
table {
border-collapse: separate;
border-spacing: 10px;
}
</style>
</script>
4 changes: 2 additions & 2 deletions service/web_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ def check_model_exist():
return jsonify({"code": 0, "message": "success", "exists": result_list})


@app.route("/api/checkURLExists", methods=["GET"])
def check_url_exists():
@app.route("/api/checkHFRepoExists", methods=["GET"])
def check_if_huggingface_repo_exists():
repo_id = request.args.get('repo_id')
downloader = HFPlaygroundDownloader()
exists = downloader.hf_url_exists(repo_id)
Expand Down

0 comments on commit 8ad22a0

Please sign in to comment.