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

घटक देखीं · गाइड पढ़ीं (अंग्रेजी में)