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

ઘટકો જુઓ · માર્ગદર્શિકા વાંચો (અંગ્રેજીમાં)