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);

భాగాలను చూడండి · మార్గదర్శిని చదవండి (ఆంగ్లంలో)