feat: multi-branch template scanning from git repo + manual template selection

- Rewrite template.rs to scan all remote branches via git commands
  (git fetch/branch -r/ls-tree/git show/git archive)
- Add manual template picker dropdown in CreateForm UI
- Remove sentence-transformers/embed.py from Dockerfile (separate container)
- Clean up Gitea API approach, use local git repo instead
- Add chat panel and sidebar layout improvements
This commit is contained in:
Fam Zheng
2026-03-07 16:24:56 +00:00
parent cb81d7eb41
commit 07f1f285b6
14 changed files with 1030 additions and 321 deletions

View File

@@ -1,20 +1,30 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { api } from '../api'
import examples from '../examples.json'
const emit = defineEmits<{
submit: [requirement: string]
submit: [requirement: string, templateId?: string]
cancel: []
}>()
const requirement = ref('')
const inputEl = ref<HTMLTextAreaElement>()
const templates = ref<{ id: string; name: string; description: string }[]>([])
const selectedTemplate = ref('')
onMounted(() => inputEl.value?.focus())
onMounted(async () => {
inputEl.value?.focus()
try {
templates.value = await api.listTemplates()
} catch {
// ignore — templates dropdown just won't show
}
})
function onSubmit() {
const text = requirement.value.trim()
if (text) emit('submit', text)
if (text) emit('submit', text, selectedTemplate.value || undefined)
}
</script>
@@ -38,6 +48,13 @@ function onSubmit() {
@keydown.ctrl.enter="onSubmit"
@keydown.meta.enter="onSubmit"
/>
<div v-if="templates.length" class="template-select">
<label>模板</label>
<select v-model="selectedTemplate">
<option value="">自动选择</option>
<option v-for="t in templates" :key="t.id" :value="t.id">{{ t.name }}</option>
</select>
</div>
<div class="create-hint">Ctrl+Enter 提交</div>
<div class="create-actions">
<button class="btn-cancel" @click="emit('cancel')">取消</button>
@@ -100,6 +117,34 @@ function onSubmit() {
border-color: var(--accent);
}
.template-select {
display: flex;
align-items: center;
gap: 8px;
}
.template-select label {
font-size: 13px;
color: var(--text-secondary);
white-space: nowrap;
}
.template-select select {
flex: 1;
padding: 6px 8px;
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: 6px;
color: var(--text-primary);
font-size: 13px;
font-family: inherit;
outline: none;
}
.template-select select:focus {
border-color: var(--accent);
}
.create-hint {
font-size: 12px;
color: var(--text-secondary);