fix false missing Hermes CLI detection after deployment
This commit is contained in:
@@ -1,19 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { checkHermesCliAvailable, resetHermesCliProbe } from "@/api/hermes/system";
|
||||
import { getHermesCliStatus, resetHermesCliProbe, type HermesCliStatus } from "@/api/hermes/system";
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const rechecking = ref(false);
|
||||
const status = ref<HermesCliStatus | null>(null);
|
||||
const issue = computed(() => status.value?.reason === 'permission_denied' ? 'permission' : status.value?.reason === 'failed' ? 'failed' : 'missing');
|
||||
const title = computed(() => t(issue.value === 'missing' ? 'hermesMissing.title' : `hermesMissing.${issue.value}Title`));
|
||||
const intro = computed(() => t(issue.value === 'missing' ? 'hermesMissing.intro' : `hermesMissing.${issue.value}Intro`));
|
||||
onMounted(async () => { status.value = await getHermesCliStatus(); });
|
||||
|
||||
async function handleRetry() {
|
||||
rechecking.value = true;
|
||||
try {
|
||||
resetHermesCliProbe();
|
||||
const available = await checkHermesCliAvailable();
|
||||
if (available) {
|
||||
status.value = await getHermesCliStatus();
|
||||
if (status.value.available || status.value.reason === 'timeout') {
|
||||
router.replace("/hermes/chat");
|
||||
}
|
||||
} finally {
|
||||
@@ -27,17 +32,18 @@ async function handleRetry() {
|
||||
<div class="hermes-missing-card">
|
||||
<header class="hermes-missing-hd">
|
||||
<div class="hermes-missing-mark" aria-hidden="true">⚠</div>
|
||||
<h1 class="hermes-missing-title">{{ t("hermesMissing.title") }}</h1>
|
||||
<p class="hermes-missing-desc">{{ t("hermesMissing.intro") }}</p>
|
||||
<h1 class="hermes-missing-title">{{ title }}</h1>
|
||||
<p class="hermes-missing-desc">{{ intro }}</p>
|
||||
</header>
|
||||
|
||||
<div class="hermes-missing-bd">
|
||||
<pre class="hermes-missing-term"><code>{{ t("hermesMissing.installCmd") }}</code></pre>
|
||||
<pre v-if="issue === 'missing'" class="hermes-missing-term"><code>{{ t("hermesMissing.installCmd") }}</code></pre>
|
||||
<pre v-else-if="status?.bin" class="hermes-missing-term"><code>{{ status.bin }}</code></pre>
|
||||
|
||||
<p class="hermes-missing-desc">{{ t("hermesMissing.envIntro") }}</p>
|
||||
<pre class="hermes-missing-term"><code>{{ t("hermesMissing.envCmd") }}</code></pre>
|
||||
|
||||
<p class="hermes-missing-hint">{{ t("hermesMissing.restartHint") }}</p>
|
||||
<p class="hermes-missing-hint">{{ t(issue === 'missing' ? "hermesMissing.restartHint" : "hermesMissing.repairHint") }}</p>
|
||||
|
||||
<button class="hermes-missing-btn" :disabled="rechecking" @click="handleRetry">
|
||||
{{ rechecking ? "..." : t("hermesMissing.retry") }}
|
||||
|
||||
Reference in New Issue
Block a user