feat: Oracle Canvas Component Schema and Qwen 3.6 integration (#31)
Co-authored-by: Sagnik <sagnik7896@gmail.com> Reviewed-on: #31
This commit was merged in pull request #31.
This commit is contained in:
@@ -10,6 +10,7 @@ import type { CanvasComponent } from '../types/canvas';
|
||||
import { KpiTileRenderer } from './renderers/KpiTileRenderer';
|
||||
import { ErrorNoticeRenderer } from './renderers/ErrorNoticeRenderer';
|
||||
import { TimelineRenderer } from './renderers/TimelineRenderer';
|
||||
import { TextCanvasRenderer } from './renderers/TextCanvasRenderer';
|
||||
|
||||
// ── Lazy renderers (heavier) ──────────────────────────────────────────────────
|
||||
const BarChartRenderer = lazy(() => import('./renderers/BarChartRenderer').then((m) => ({ default: m.BarChartRenderer })));
|
||||
@@ -76,6 +77,9 @@ export function ComponentRegistry({ component, ctx }: RegistryRendererProps) {
|
||||
}
|
||||
|
||||
switch (component.type) {
|
||||
case 'textCanvas':
|
||||
return <TextCanvasRenderer component={component} ctx={ctx} />;
|
||||
|
||||
case 'kpiTile':
|
||||
return <KpiTileRenderer component={component} ctx={ctx} />;
|
||||
|
||||
|
||||
35
app/src/oracle/components/renderers/TextCanvasRenderer.tsx
Normal file
35
app/src/oracle/components/renderers/TextCanvasRenderer.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { CanvasComponent } from '../../types/canvas';
|
||||
import { RendererWrapper, type ComponentRenderContext } from './RendererWrapper';
|
||||
|
||||
interface Props {
|
||||
component: CanvasComponent;
|
||||
ctx: ComponentRenderContext;
|
||||
}
|
||||
|
||||
export function TextCanvasRenderer({ component, ctx }: Props) {
|
||||
const params = component.visualizationParameters as {
|
||||
content?: string;
|
||||
};
|
||||
|
||||
const content = String(params.content ?? '').trim();
|
||||
const paragraphs = content
|
||||
.split(/\n{2,}/)
|
||||
.map((block) => block.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
return (
|
||||
<RendererWrapper component={component} ctx={ctx} minHeight={180}>
|
||||
<div className="flex h-full flex-col gap-3 text-sm leading-7 text-zinc-200">
|
||||
{paragraphs.length ? (
|
||||
paragraphs.map((paragraph, index) => (
|
||||
<p key={`${component.componentId}-${index}`} className="whitespace-pre-wrap text-zinc-300">
|
||||
{paragraph}
|
||||
</p>
|
||||
))
|
||||
) : (
|
||||
<p className="text-zinc-500">No planning notes were generated for this prompt.</p>
|
||||
)}
|
||||
</div>
|
||||
</RendererWrapper>
|
||||
);
|
||||
}
|
||||
@@ -16,6 +16,7 @@ export type OracleRole =
|
||||
| 'platform_admin';
|
||||
|
||||
export type ComponentType =
|
||||
| 'textCanvas'
|
||||
| 'kpiTile'
|
||||
| 'barChart'
|
||||
| 'lineChart'
|
||||
@@ -34,7 +35,7 @@ export type ComponentLifecycleState = 'draft' | 'active' | 'superseded' | 'archi
|
||||
|
||||
export type PrivacyTier = 'standard' | 'restricted' | 'sensitive';
|
||||
|
||||
export type SourceType = 'postgres' | 'warehouse' | 'api' | 'materialized_view' | 'derived_dataset';
|
||||
export type SourceType = 'postgres' | 'warehouse' | 'api' | 'materialized_view' | 'derived_dataset' | 'inline';
|
||||
|
||||
export type CachePolicyMode = 'none' | 'ttl' | 'revision_scoped';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user