diff --git a/frontend/src/lib/components/copilot/chat/AIChat.svelte b/frontend/src/lib/components/copilot/chat/AIChat.svelte
index d27077d989..848dd77f9f 100644
--- a/frontend/src/lib/components/copilot/chat/AIChat.svelte
+++ b/frontend/src/lib/components/copilot/chat/AIChat.svelte
@@ -1,5 +1,12 @@
- {#if contextElement.schema.lang === 'graphql'}
+ {#if contextElement.schema && contextElement.schema.lang === 'graphql'}
{#await import('$lib/components/GraphqlSchemaViewer.svelte')}
{:then Module}
@@ -62,8 +62,10 @@
class="h-full"
/>
{/await}
- {:else}
+ {:else if contextElement.schema}
+ {:else}
+
Not loaded yet
{/if}
{:else if contextElement.type === 'code'}
diff --git a/frontend/src/lib/components/copilot/chat/ContextTextarea.svelte b/frontend/src/lib/components/copilot/chat/ContextTextarea.svelte
new file mode 100644
index 0000000000..605b67628f
--- /dev/null
+++ b/frontend/src/lib/components/copilot/chat/ContextTextarea.svelte
@@ -0,0 +1,337 @@
+
+
+