refactor: frontend TS migration + Tailwind4/daisyUI5 unify + BUILDPLATFORM docker build
- migrate frontend to TypeScript (vue-tsc strict in build), upgrade all deps to latest (Vite 8, Tailwind 4, daisyUI 5, Pinia 4, vue-router 5) - restructure frontend dirs (api/components/common/layouts/styles/types/views) - drop Element Plus, add daisyUI TagInput; main CSS 490KB->163KB, entry JS 618KB->1.3KB - rewrite Dockerfile(.cn): frontend/backend stages pinned to $BUILDPLATFORM, CGO_ENABLED=0 cross-compile, no QEMU in multi-arch builds; add .dockerignore - local dev: Vite /api proxy + make dev targets; go:embed all:dist with .gitkeep so backend runs without prior frontend build - fix latent bugs: Keys.vue users ref, Settings.vue undefined userStore, Login.vue Ref-as-error display, res.error misuse - add REFACTOR_PLAN.md (phased refactor log)
This commit is contained in:
@@ -125,8 +125,8 @@
|
||||
</label>
|
||||
<!-- <textarea id="support_models" v-model="key.support_models_text"
|
||||
placeholder='["model1", "model2"]' class="textarea textarea-sm textarea-bordered w-full"></textarea> -->
|
||||
<el-input-tag v-model="key.support_models_array" :trigger="'Enter'" clearable
|
||||
placeholder="Please input" @change="onchange_supportmodel"/>
|
||||
<TagInput v-model="key.support_models_array" clearable
|
||||
placeholder="Please input" @change="onchange_supportmodel" />
|
||||
</div>
|
||||
|
||||
<div class="form-control">
|
||||
@@ -157,31 +157,28 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, inject, reactive } from 'vue';
|
||||
import { useRoute,useRouter } from 'vue-router';
|
||||
import { Eye, EyeOff, BadgeCheck, Send, CircleX, CircleCheckBig, TrashIcon, Infinity } from 'lucide-vue-next';
|
||||
import { useKeyStore } from '../../stores/key';
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useKeyStore } from '@/stores/key';
|
||||
import BreadcrumbHeader from '@/components/dashboard/BreadcrumbHeader.vue';
|
||||
import TagInput from '@/components/common/TagInput.vue';
|
||||
import { useToast } from '@/composables/toast';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const keyStore = useKeyStore();
|
||||
const { setToast } = inject('toast');
|
||||
const { setToast } = useToast();
|
||||
|
||||
const keyId = computed(() => route.query.id);
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
});
|
||||
|
||||
const key = computed(() => keyStore.key);
|
||||
const loading = computed(() => keyStore.loading);
|
||||
|
||||
onMounted(async () => {
|
||||
console.log('keyId', keyId.value)
|
||||
if (keyId.value) {
|
||||
await keyStore.fetchKey(keyId.value);
|
||||
await keyStore.fetchKey(keyId.value as string);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -194,7 +191,7 @@ const keyOption = reactive([
|
||||
{name: 'openai-compatible', label: 'OpenAI Compatible'}
|
||||
])
|
||||
|
||||
const apiKeyImageMap = {
|
||||
const apiKeyImageMap: Record<string, string> = {
|
||||
'openai': '/assets/openai.svg',
|
||||
'claude': '/assets/claude.svg',
|
||||
'gemini': '/assets/gemini.svg',
|
||||
@@ -202,16 +199,17 @@ const apiKeyImageMap = {
|
||||
'github': '/assets/github.svg'
|
||||
};
|
||||
|
||||
const apiKeyImageUrl = (keytype) => {
|
||||
const apiKeyImageUrl = (keytype: string) => {
|
||||
return apiKeyImageMap[keytype] || '/assets/logo.svg';
|
||||
};
|
||||
|
||||
const onchange_supportmodel = () => {
|
||||
if (!key.value) return;
|
||||
key.value.support_models = JSON.stringify(key.value.support_models_array)
|
||||
}
|
||||
|
||||
const updateKey = async () => {
|
||||
|
||||
if (!key.value) return;
|
||||
try {
|
||||
const res = await keyStore.updateKey(key.value);
|
||||
console.log('updateKey', res)
|
||||
@@ -219,7 +217,7 @@ const updateKey = async () => {
|
||||
setToast(`Key ${key.value.name} updated`, 'success');
|
||||
}
|
||||
await keyStore.refreshKey(key.value.id);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
console.error('Error updating key:', err);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user