feat(kol): expand variable schema and polish KOL UI
- Add length/range limits to KOL variable definitions: max_length and default_value for input/textarea, min_value/max_value/default_number for number. Backend validates and normalizes; frontend renders limit inputs in KolVariableConfig and applies limits at runtime in KolDynamicForm. - Sort workspace cards by most recent prompt/package update, falling back to granted_at. Adds updated_at to KolWorkspaceCard. - Polish TemplatesView, WorkspaceView, and KOL package management UI; route create/update/publish/archive/delete toasts through i18n and expand package form copy and status labels. - Remove stale KnowledgeView.vue.patch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,11 @@ import { kolGenerateApi } from "@/lib/api";
|
||||
import KolDynamicForm from "@/components/kol/KolDynamicForm.vue";
|
||||
import KnowledgeGroupSelect from "@/components/KnowledgeGroupSelect.vue";
|
||||
import { parseKolCardConfig } from "@/lib/kol-card-config";
|
||||
import {
|
||||
getKolVariableInitialValue,
|
||||
isKolVariableValueEmpty,
|
||||
normalizeKolVariableDefinition,
|
||||
} from "@/lib/kol-placeholders";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@@ -42,7 +47,7 @@ watch(
|
||||
if (schema?.schema_json?.variables) {
|
||||
const newValues: Record<string, any> = {};
|
||||
schema.schema_json.variables.forEach((v) => {
|
||||
newValues[fieldKey(v.key, v.id)] = v.type === "checkbox" ? [] : undefined;
|
||||
newValues[fieldKey(v.key, v.id)] = getKolVariableInitialValue(normalizeKolVariableDefinition(v));
|
||||
});
|
||||
values.value = newValues;
|
||||
enableWebSearch.value = false;
|
||||
@@ -78,7 +83,8 @@ function handleSubmit() {
|
||||
|
||||
const missingLabels: string[] = [];
|
||||
schema.schema_json.variables.forEach((v) => {
|
||||
if (v.required && !values.value[fieldKey(v.key, v.id)]) {
|
||||
const normalizedVariable = normalizeKolVariableDefinition(v);
|
||||
if (normalizedVariable.required && isKolVariableValueEmpty(normalizedVariable, values.value[fieldKey(v.key, v.id)])) {
|
||||
missingLabels.push(v.label);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user