Lyra Gen ସହ ଜେନେରେଟିଭ୍ UI
ମଡେଲ୍ ଉତ୍ତର ପ୍ରକୃତ, ଯାଞ୍ଚିତ Lyra କଣ୍ଟ୍ରୋଲ୍ ଭାବେ ଦେଖାଯାଏ।
Lyra Gen ଏକ ମଡେଲ୍ର ସଂରଚିତ ଉତ୍ତରକୁ ସମୀକ୍ଷିତ କାଟାଲଗ୍ ମାଧ୍ୟମରେ ସୁଗମ୍ୟ Lyra କମ୍ପୋନେଣ୍ଟରେ ବଦଳାଏ। ଉତ୍ପନ୍ନ ବିଷୟବସ୍ତୁ କେବଳ କାଟାଲଗ୍ର ଭୂମିକାର ନାମ ଦେଇପାରେ, କୌଣସି ଇଚ୍ଛାମୁତାବକ ଟ୍ୟାଗ୍, ସ୍କ୍ରିପ୍ଟ କିମ୍ବା କାର୍ଯ୍ୟର ନୁହେଁ; ମଡେଲ୍ ଅନୁରୋଧ, ଡାଟା, କାର୍ଯ୍ୟ ଓ ସଂରକ୍ଷଣ ଆପଣଙ୍କ ଆପ୍ଲିକେସନ୍ ପାଖରେ ରହେ।
ଉଦାହରଣ
ସମୀକ୍ଷିତ କାଟାଲଗ୍ର ଏକ ଉପସେଟ୍ ବାଛନ୍ତୁ, ତା'ପରେ ଉତ୍ପନ୍ନ ଦୃଶ୍ୟକୁ ଦେଖାଇବା ପୂର୍ବରୁ ଯାଞ୍ଚ କରନ୍ତୁ।
import '@aceshooting/lyra-ui/theme.css';
import { initialCatalog, subsetCatalog } from '@aceshooting/lyra-gen/catalog.js';
import { validateView } from '@aceshooting/lyra-gen/runtime.js';
import { LyraGenViewElement } from '@aceshooting/lyra-gen/gen-view.js';
const selected = subsetCatalog(initialCatalog, ['stack', 'heading', 'text']);
if (!selected.ok) throw new Error('The requested catalog is unavailable.');
const catalog = selected.value;
const result = validateView({
version: '1', catalog: { id: catalog.id, version: catalog.version },
surfaceId: 'answer-1', revision: 0,
root: { id: 'summary', type: 'stack', children: [
{ id: 'title', type: 'heading', text: 'Quarterly summary' },
{ id: 'detail', type: 'text', text: 'Revenue increased this quarter.' },
] },
}, catalog);
if (!result.ok) throw new Error('The generated view was rejected.');
const view = new LyraGenViewElement();
view.catalog = catalog;
view.document = result.value;
document.body.append(view);