@vib3code/sdk 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +118 -0
- package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +34 -0
- package/DOCS/CI_TESTING.md +38 -0
- package/DOCS/CLI_ONBOARDING.md +75 -0
- package/DOCS/CONTROL_REFERENCE.md +64 -0
- package/DOCS/DEV_TRACK_ANALYSIS.md +77 -0
- package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +42 -0
- package/DOCS/DEV_TRACK_SESSION_2026-01-31.md +220 -0
- package/DOCS/ENV_SETUP.md +189 -0
- package/DOCS/EXPORT_FORMATS.md +417 -0
- package/DOCS/GPU_DISPOSAL_GUIDE.md +21 -0
- package/DOCS/LICENSING_TIERS.md +275 -0
- package/DOCS/MASTER_PLAN_2026-01-31.md +570 -0
- package/DOCS/OBS_SETUP_GUIDE.md +98 -0
- package/DOCS/PROJECT_SETUP.md +66 -0
- package/DOCS/RENDERER_LIFECYCLE.md +40 -0
- package/DOCS/REPO_MANIFEST.md +121 -0
- package/DOCS/SESSION_014_PLAN.md +195 -0
- package/DOCS/SESSION_LOG_2026-01-07.md +56 -0
- package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +72 -0
- package/DOCS/SYSTEM_AUDIT_2026-01-30.md +738 -0
- package/DOCS/SYSTEM_INVENTORY.md +520 -0
- package/DOCS/TELEMETRY_EXPORTS.md +34 -0
- package/DOCS/WEBGPU_STATUS.md +38 -0
- package/DOCS/XR_BENCHMARKS.md +608 -0
- package/LICENSE +21 -0
- package/README.md +426 -0
- package/docs/.nojekyll +0 -0
- package/docs/01-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/02-hyperspatial_ego_death.html +346 -0
- package/docs/03-post_cartesian_sublime.html +346 -0
- package/docs/04-crystalline_void_meditation.html +346 -0
- package/docs/05-quantum_decoherence_ballet.html +346 -0
- package/docs/06-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/07-hyperspatial_ego_death.html +346 -0
- package/docs/08-post_cartesian_sublime.html +346 -0
- package/docs/09-crystalline_void_meditation.html +346 -0
- package/docs/10-quantum_decoherence_ballet.html +346 -0
- package/docs/11-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/12-hyperspatial_ego_death.html +346 -0
- package/docs/13-post_cartesian_sublime.html +346 -0
- package/docs/index.html +794 -0
- package/docs/test-hub.html +441 -0
- package/docs/url-state.js +102 -0
- package/docs/vib3-exports/01-quantum-quantum-tetrahedron-lattice.html +489 -0
- package/docs/vib3-exports/02-quantum-quantum-hypersphere-matrix.html +489 -0
- package/docs/vib3-exports/03-quantum-quantum-hypertetra-fractal.html +489 -0
- package/docs/vib3-exports/04-faceted-faceted-crystal-structure.html +407 -0
- package/docs/vib3-exports/05-faceted-faceted-klein-bottle.html +407 -0
- package/docs/vib3-exports/06-faceted-faceted-hypertetra-torus.html +407 -0
- package/docs/vib3-exports/07-holographic-holographic-wave-field.html +457 -0
- package/docs/vib3-exports/08-holographic-holographic-hypersphere-sphere.html +457 -0
- package/docs/vib3-exports/09-holographic-holographic-hypertetra-crystal.html +457 -0
- package/docs/vib3-exports/index.html +238 -0
- package/docs/webgpu-live.html +702 -0
- package/package.json +367 -0
- package/src/advanced/AIPresetGenerator.js +777 -0
- package/src/advanced/MIDIController.js +703 -0
- package/src/advanced/OffscreenWorker.js +1051 -0
- package/src/advanced/WebGPUCompute.js +1051 -0
- package/src/advanced/WebXRRenderer.js +680 -0
- package/src/agent/cli/AgentCLI.js +615 -0
- package/src/agent/cli/index.js +14 -0
- package/src/agent/index.js +73 -0
- package/src/agent/mcp/MCPServer.js +950 -0
- package/src/agent/mcp/index.js +9 -0
- package/src/agent/mcp/tools.js +548 -0
- package/src/agent/telemetry/EventStream.js +669 -0
- package/src/agent/telemetry/Instrumentation.js +618 -0
- package/src/agent/telemetry/TelemetryExporters.js +427 -0
- package/src/agent/telemetry/TelemetryService.js +464 -0
- package/src/agent/telemetry/index.js +52 -0
- package/src/benchmarks/BenchmarkRunner.js +381 -0
- package/src/benchmarks/MetricsCollector.js +299 -0
- package/src/benchmarks/index.js +9 -0
- package/src/benchmarks/scenes.js +259 -0
- package/src/cli/index.js +675 -0
- package/src/config/ApiConfig.js +88 -0
- package/src/core/CanvasManager.js +217 -0
- package/src/core/ErrorReporter.js +117 -0
- package/src/core/ParameterMapper.js +333 -0
- package/src/core/Parameters.js +396 -0
- package/src/core/RendererContracts.js +200 -0
- package/src/core/UnifiedResourceManager.js +370 -0
- package/src/core/VIB3Engine.js +636 -0
- package/src/core/renderers/FacetedRendererAdapter.js +32 -0
- package/src/core/renderers/HolographicRendererAdapter.js +29 -0
- package/src/core/renderers/QuantumRendererAdapter.js +29 -0
- package/src/core/renderers/RendererLifecycleManager.js +63 -0
- package/src/creative/ColorPresetsSystem.js +980 -0
- package/src/creative/ParameterTimeline.js +1061 -0
- package/src/creative/PostProcessingPipeline.js +1113 -0
- package/src/creative/TransitionAnimator.js +683 -0
- package/src/export/CSSExporter.js +226 -0
- package/src/export/CardGeneratorBase.js +279 -0
- package/src/export/ExportManager.js +580 -0
- package/src/export/FacetedCardGenerator.js +279 -0
- package/src/export/HolographicCardGenerator.js +543 -0
- package/src/export/LottieExporter.js +552 -0
- package/src/export/QuantumCardGenerator.js +315 -0
- package/src/export/SVGExporter.js +519 -0
- package/src/export/ShaderExporter.js +903 -0
- package/src/export/TradingCardGenerator.js +3055 -0
- package/src/export/TradingCardManager.js +181 -0
- package/src/export/VIB3PackageExporter.js +559 -0
- package/src/export/index.js +14 -0
- package/src/export/systems/TradingCardSystemFaceted.js +494 -0
- package/src/export/systems/TradingCardSystemHolographic.js +452 -0
- package/src/export/systems/TradingCardSystemQuantum.js +411 -0
- package/src/faceted/FacetedSystem.js +963 -0
- package/src/features/CollectionManager.js +433 -0
- package/src/gallery/CollectionManager.js +240 -0
- package/src/gallery/GallerySystem.js +485 -0
- package/src/geometry/GeometryFactory.js +314 -0
- package/src/geometry/GeometryLibrary.js +72 -0
- package/src/geometry/buffers/BufferBuilder.js +338 -0
- package/src/geometry/buffers/index.js +18 -0
- package/src/geometry/generators/Crystal.js +420 -0
- package/src/geometry/generators/Fractal.js +298 -0
- package/src/geometry/generators/KleinBottle.js +197 -0
- package/src/geometry/generators/Sphere.js +192 -0
- package/src/geometry/generators/Tesseract.js +160 -0
- package/src/geometry/generators/Tetrahedron.js +225 -0
- package/src/geometry/generators/Torus.js +304 -0
- package/src/geometry/generators/Wave.js +341 -0
- package/src/geometry/index.js +142 -0
- package/src/geometry/warp/HypersphereCore.js +211 -0
- package/src/geometry/warp/HypertetraCore.js +386 -0
- package/src/geometry/warp/index.js +57 -0
- package/src/holograms/HolographicVisualizer.js +1073 -0
- package/src/holograms/RealHolographicSystem.js +966 -0
- package/src/holograms/variantRegistry.js +69 -0
- package/src/integrations/FigmaPlugin.js +854 -0
- package/src/integrations/OBSMode.js +754 -0
- package/src/integrations/ThreeJsPackage.js +660 -0
- package/src/integrations/TouchDesignerExport.js +552 -0
- package/src/integrations/frameworks/Vib3React.js +591 -0
- package/src/integrations/frameworks/Vib3Svelte.js +654 -0
- package/src/integrations/frameworks/Vib3Vue.js +628 -0
- package/src/llm/LLMParameterInterface.js +240 -0
- package/src/llm/LLMParameterUI.js +577 -0
- package/src/math/Mat4x4.js +708 -0
- package/src/math/Projection.js +341 -0
- package/src/math/Rotor4D.js +637 -0
- package/src/math/Vec4.js +476 -0
- package/src/math/constants.js +164 -0
- package/src/math/index.js +68 -0
- package/src/math/projections.js +54 -0
- package/src/math/rotations.js +196 -0
- package/src/quantum/QuantumEngine.js +906 -0
- package/src/quantum/QuantumVisualizer.js +1103 -0
- package/src/reactivity/ReactivityConfig.js +499 -0
- package/src/reactivity/ReactivityManager.js +586 -0
- package/src/reactivity/SpatialInputSystem.js +1783 -0
- package/src/reactivity/index.js +93 -0
- package/src/render/CommandBuffer.js +465 -0
- package/src/render/MultiCanvasBridge.js +340 -0
- package/src/render/RenderCommand.js +514 -0
- package/src/render/RenderResourceRegistry.js +523 -0
- package/src/render/RenderState.js +552 -0
- package/src/render/RenderTarget.js +512 -0
- package/src/render/ShaderLoader.js +253 -0
- package/src/render/ShaderProgram.js +599 -0
- package/src/render/UnifiedRenderBridge.js +496 -0
- package/src/render/backends/WebGLBackend.js +1108 -0
- package/src/render/backends/WebGPUBackend.js +1409 -0
- package/src/render/commands/CommandBufferExecutor.js +607 -0
- package/src/render/commands/RenderCommandBuffer.js +661 -0
- package/src/render/commands/index.js +17 -0
- package/src/render/index.js +367 -0
- package/src/scene/Disposable.js +498 -0
- package/src/scene/MemoryPool.js +618 -0
- package/src/scene/Node4D.js +697 -0
- package/src/scene/ResourceManager.js +599 -0
- package/src/scene/Scene4D.js +540 -0
- package/src/scene/index.js +98 -0
- package/src/schemas/error.schema.json +84 -0
- package/src/schemas/extension.schema.json +88 -0
- package/src/schemas/index.js +214 -0
- package/src/schemas/parameters.schema.json +142 -0
- package/src/schemas/tool-pack.schema.json +44 -0
- package/src/schemas/tool-response.schema.json +127 -0
- package/src/shaders/common/fullscreen.vert.glsl +5 -0
- package/src/shaders/common/fullscreen.vert.wgsl +17 -0
- package/src/shaders/common/geometry24.glsl +65 -0
- package/src/shaders/common/geometry24.wgsl +54 -0
- package/src/shaders/common/rotation4d.glsl +85 -0
- package/src/shaders/common/rotation4d.wgsl +86 -0
- package/src/shaders/common/uniforms.glsl +44 -0
- package/src/shaders/common/uniforms.wgsl +48 -0
- package/src/shaders/faceted/faceted.frag.glsl +129 -0
- package/src/shaders/faceted/faceted.frag.wgsl +164 -0
- package/src/shaders/holographic/holographic.frag.glsl +406 -0
- package/src/shaders/holographic/holographic.frag.wgsl +185 -0
- package/src/shaders/quantum/quantum.frag.glsl +513 -0
- package/src/shaders/quantum/quantum.frag.wgsl +361 -0
- package/src/testing/ParallelTestFramework.js +519 -0
- package/src/testing/__snapshots__/exportFormats.test.js.snap +24 -0
- package/src/testing/exportFormats.test.js +8 -0
- package/src/testing/projections.test.js +14 -0
- package/src/testing/rotations.test.js +37 -0
- package/src/ui/InteractivityMenu.js +516 -0
- package/src/ui/StatusManager.js +96 -0
- package/src/ui/adaptive/renderers/webgpu/BufferLayout.ts +252 -0
- package/src/ui/adaptive/renderers/webgpu/PolytopeInstanceBuffer.ts +144 -0
- package/src/ui/adaptive/renderers/webgpu/TripleBufferedUniform.ts +170 -0
- package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +735 -0
- package/src/ui/adaptive/renderers/webgpu/index.ts +112 -0
- package/src/variations/VariationManager.js +431 -0
- package/src/viewer/AudioReactivity.js +505 -0
- package/src/viewer/CardBending.js +481 -0
- package/src/viewer/GalleryUI.js +832 -0
- package/src/viewer/ReactivityManager.js +590 -0
- package/src/viewer/TradingCardExporter.js +600 -0
- package/src/viewer/ViewerPortal.js +374 -0
- package/src/viewer/index.js +12 -0
- package/src/wasm/WasmLoader.js +296 -0
- package/src/wasm/index.js +132 -0
- package/tools/agentic/mcpTools.js +88 -0
- package/tools/cli/agent-cli.js +92 -0
- package/tools/export/formats.js +24 -0
- package/tools/math/rotation-baseline.mjs +64 -0
- package/tools/shader-sync-verify.js +937 -0
- package/tools/telemetry/manifestPipeline.js +141 -0
- package/tools/telemetry/telemetryEvents.js +35 -0
- package/types/adaptive-sdk.d.ts +185 -0
- package/types/advanced/AIPresetGenerator.d.ts +81 -0
- package/types/advanced/MIDIController.d.ts +100 -0
- package/types/advanced/OffscreenWorker.d.ts +82 -0
- package/types/advanced/WebGPUCompute.d.ts +52 -0
- package/types/advanced/WebXRRenderer.d.ts +77 -0
- package/types/advanced/index.d.ts +46 -0
- package/types/core/ErrorReporter.d.ts +50 -0
- package/types/core/VIB3Engine.d.ts +204 -0
- package/types/creative/ColorPresetsSystem.d.ts +91 -0
- package/types/creative/ParameterTimeline.d.ts +74 -0
- package/types/creative/PostProcessingPipeline.d.ts +109 -0
- package/types/creative/TransitionAnimator.d.ts +71 -0
- package/types/creative/index.d.ts +35 -0
- package/types/integrations/FigmaPlugin.d.ts +46 -0
- package/types/integrations/OBSMode.d.ts +74 -0
- package/types/integrations/ThreeJsPackage.d.ts +62 -0
- package/types/integrations/TouchDesignerExport.d.ts +36 -0
- package/types/integrations/Vib3React.d.ts +74 -0
- package/types/integrations/Vib3Svelte.d.ts +63 -0
- package/types/integrations/Vib3Vue.d.ts +55 -0
- package/types/integrations/index.d.ts +52 -0
- package/types/reactivity/SpatialInputSystem.d.ts +173 -0
- package/types/reactivity/index.d.ts +394 -0
- package/types/render/CommandBuffer.d.ts +169 -0
- package/types/render/RenderCommand.d.ts +312 -0
- package/types/render/RenderState.d.ts +279 -0
- package/types/render/RenderTarget.d.ts +254 -0
- package/types/render/ShaderProgram.d.ts +277 -0
- package/types/render/UnifiedRenderBridge.d.ts +143 -0
- package/types/render/WebGLBackend.d.ts +168 -0
- package/types/render/WebGPUBackend.d.ts +186 -0
- package/types/render/index.d.ts +141 -0
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Parameter UI for VIB34D
|
|
3
|
+
* Beautiful overlay interface for natural language parameter generation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export class LLMParameterUI {
|
|
7
|
+
constructor(llmInterface) {
|
|
8
|
+
this.llmInterface = llmInterface;
|
|
9
|
+
this.overlay = null;
|
|
10
|
+
this.input = null;
|
|
11
|
+
this.isProcessing = false;
|
|
12
|
+
|
|
13
|
+
this.exampleDescriptions = [
|
|
14
|
+
// Emotional/Mood based
|
|
15
|
+
"calm peaceful meditation",
|
|
16
|
+
"energetic dance party",
|
|
17
|
+
"mysterious magical portal",
|
|
18
|
+
"warm sunset glow",
|
|
19
|
+
"cool ocean waves",
|
|
20
|
+
"intense lightning storm",
|
|
21
|
+
|
|
22
|
+
// Color based
|
|
23
|
+
"bright cyan holographic",
|
|
24
|
+
"deep purple mystical",
|
|
25
|
+
"warm orange sunset",
|
|
26
|
+
"cool blue technology",
|
|
27
|
+
"rainbow spectrum shift",
|
|
28
|
+
"monochrome minimal",
|
|
29
|
+
|
|
30
|
+
// Effect based
|
|
31
|
+
"slow morphing crystals",
|
|
32
|
+
"fast chaotic particles",
|
|
33
|
+
"smooth flowing liquid",
|
|
34
|
+
"sharp geometric patterns",
|
|
35
|
+
"organic natural growth",
|
|
36
|
+
"glitchy digital artifacts",
|
|
37
|
+
|
|
38
|
+
// Style based
|
|
39
|
+
"retro synthwave aesthetic",
|
|
40
|
+
"futuristic hologram",
|
|
41
|
+
"sacred geometry mandala",
|
|
42
|
+
"psychedelic kaleidoscope",
|
|
43
|
+
"minimalist zen garden",
|
|
44
|
+
"maximalist explosion"
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
this.init();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Initialize UI components
|
|
52
|
+
*/
|
|
53
|
+
init() {
|
|
54
|
+
this.createOverlay();
|
|
55
|
+
this.setupEventHandlers();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Create the overlay UI
|
|
60
|
+
*/
|
|
61
|
+
createOverlay() {
|
|
62
|
+
// Create overlay container
|
|
63
|
+
this.overlay = document.createElement('div');
|
|
64
|
+
this.overlay.className = 'llm-overlay';
|
|
65
|
+
this.overlay.innerHTML = `
|
|
66
|
+
<div class="llm-modal">
|
|
67
|
+
<div class="llm-header">
|
|
68
|
+
<h2>🤖 AI Parameter Generator</h2>
|
|
69
|
+
<button class="llm-close" title="Close">×</button>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<div class="llm-content">
|
|
73
|
+
<div class="llm-description">
|
|
74
|
+
Describe the visualization you want to create using natural language.
|
|
75
|
+
The AI will generate parameters to match your description.
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div class="llm-input-container">
|
|
79
|
+
<input type="text"
|
|
80
|
+
class="llm-input"
|
|
81
|
+
placeholder="e.g. bright cyan holographic effect with fast rotation"
|
|
82
|
+
autocomplete="off">
|
|
83
|
+
<button class="llm-generate">Generate</button>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div class="llm-examples">
|
|
87
|
+
<div class="llm-examples-label">Try these examples:</div>
|
|
88
|
+
<div class="llm-examples-grid">
|
|
89
|
+
${this.exampleDescriptions.slice(0, 6).map(desc =>
|
|
90
|
+
`<button class="llm-example-btn" data-description="${desc}">${desc}</button>`
|
|
91
|
+
).join('')}
|
|
92
|
+
</div>
|
|
93
|
+
<button class="llm-more-examples">Show more examples...</button>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div class="llm-status"></div>
|
|
97
|
+
|
|
98
|
+
<div class="llm-api-key-section" style="display: none;">
|
|
99
|
+
<div class="llm-api-key-prompt">
|
|
100
|
+
<p>Please enter your Gemini API key to use AI features:</p>
|
|
101
|
+
<input type="password" class="llm-api-key-input" placeholder="Your Gemini API key">
|
|
102
|
+
<button class="llm-api-key-save">Save API Key</button>
|
|
103
|
+
<p class="llm-api-key-help">
|
|
104
|
+
Get your API key from
|
|
105
|
+
<a href="https://makersuite.google.com/app/apikey" target="_blank">Google AI Studio</a>
|
|
106
|
+
</p>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
// Add styles
|
|
114
|
+
const style = document.createElement('style');
|
|
115
|
+
style.textContent = `
|
|
116
|
+
.llm-overlay {
|
|
117
|
+
position: fixed;
|
|
118
|
+
top: 0;
|
|
119
|
+
left: 0;
|
|
120
|
+
right: 0;
|
|
121
|
+
bottom: 0;
|
|
122
|
+
background: rgba(0, 0, 0, 0.9);
|
|
123
|
+
backdrop-filter: blur(10px);
|
|
124
|
+
display: none;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
align-items: center;
|
|
127
|
+
z-index: 10000;
|
|
128
|
+
animation: llmFadeIn 0.3s ease-out;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.llm-overlay.active {
|
|
132
|
+
display: flex;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@keyframes llmFadeIn {
|
|
136
|
+
from { opacity: 0; }
|
|
137
|
+
to { opacity: 1; }
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.llm-modal {
|
|
141
|
+
background: linear-gradient(135deg, rgba(20, 20, 40, 0.95) 0%, rgba(30, 30, 50, 0.9) 100%);
|
|
142
|
+
border: 2px solid rgba(0, 255, 255, 0.3);
|
|
143
|
+
border-radius: 20px;
|
|
144
|
+
padding: 30px;
|
|
145
|
+
max-width: 600px;
|
|
146
|
+
width: 90%;
|
|
147
|
+
max-height: 80vh;
|
|
148
|
+
overflow-y: auto;
|
|
149
|
+
box-shadow:
|
|
150
|
+
0 20px 60px rgba(0, 0, 0, 0.5),
|
|
151
|
+
0 0 100px rgba(0, 255, 255, 0.1),
|
|
152
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
|
153
|
+
animation: llmModalSlide 0.3s ease-out;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@keyframes llmModalSlide {
|
|
157
|
+
from { transform: translateY(-20px); opacity: 0; }
|
|
158
|
+
to { transform: translateY(0); opacity: 1; }
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.llm-header {
|
|
162
|
+
display: flex;
|
|
163
|
+
justify-content: space-between;
|
|
164
|
+
align-items: center;
|
|
165
|
+
margin-bottom: 20px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.llm-header h2 {
|
|
169
|
+
color: #00ffff;
|
|
170
|
+
font-family: 'Orbitron', monospace;
|
|
171
|
+
font-size: 1.8rem;
|
|
172
|
+
margin: 0;
|
|
173
|
+
text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.llm-close {
|
|
177
|
+
background: transparent;
|
|
178
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
179
|
+
color: #fff;
|
|
180
|
+
font-size: 1.5rem;
|
|
181
|
+
width: 40px;
|
|
182
|
+
height: 40px;
|
|
183
|
+
border-radius: 50%;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
transition: all 0.3s ease;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.llm-close:hover {
|
|
189
|
+
background: rgba(255, 255, 255, 0.1);
|
|
190
|
+
border-color: rgba(255, 255, 255, 0.4);
|
|
191
|
+
transform: rotate(90deg);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.llm-description {
|
|
195
|
+
color: rgba(255, 255, 255, 0.8);
|
|
196
|
+
margin-bottom: 20px;
|
|
197
|
+
line-height: 1.6;
|
|
198
|
+
font-family: 'Orbitron', monospace;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.llm-input-container {
|
|
202
|
+
display: flex;
|
|
203
|
+
gap: 10px;
|
|
204
|
+
margin-bottom: 20px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.llm-input {
|
|
208
|
+
flex: 1;
|
|
209
|
+
background: rgba(0, 0, 0, 0.3);
|
|
210
|
+
border: 2px solid rgba(0, 255, 255, 0.3);
|
|
211
|
+
color: #fff;
|
|
212
|
+
padding: 15px;
|
|
213
|
+
border-radius: 10px;
|
|
214
|
+
font-size: 1rem;
|
|
215
|
+
font-family: 'Orbitron', monospace;
|
|
216
|
+
transition: all 0.3s ease;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.llm-input:focus {
|
|
220
|
+
outline: none;
|
|
221
|
+
border-color: #00ffff;
|
|
222
|
+
box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
|
|
223
|
+
background: rgba(0, 0, 0, 0.5);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.llm-generate {
|
|
227
|
+
background: linear-gradient(135deg, #00ffff 0%, #0080ff 100%);
|
|
228
|
+
border: none;
|
|
229
|
+
color: #000;
|
|
230
|
+
padding: 15px 30px;
|
|
231
|
+
border-radius: 10px;
|
|
232
|
+
font-weight: bold;
|
|
233
|
+
font-family: 'Orbitron', monospace;
|
|
234
|
+
cursor: pointer;
|
|
235
|
+
transition: all 0.3s ease;
|
|
236
|
+
text-transform: uppercase;
|
|
237
|
+
letter-spacing: 1px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.llm-generate:hover {
|
|
241
|
+
transform: translateY(-2px);
|
|
242
|
+
box-shadow: 0 10px 30px rgba(0, 255, 255, 0.4);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.llm-generate:disabled {
|
|
246
|
+
opacity: 0.5;
|
|
247
|
+
cursor: not-allowed;
|
|
248
|
+
transform: none;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.llm-examples {
|
|
252
|
+
margin-top: 30px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.llm-examples-label {
|
|
256
|
+
color: rgba(255, 255, 255, 0.6);
|
|
257
|
+
margin-bottom: 10px;
|
|
258
|
+
font-size: 0.9rem;
|
|
259
|
+
font-family: 'Orbitron', monospace;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.llm-examples-grid {
|
|
263
|
+
display: grid;
|
|
264
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
265
|
+
gap: 10px;
|
|
266
|
+
margin-bottom: 10px;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.llm-example-btn {
|
|
270
|
+
background: rgba(0, 255, 255, 0.1);
|
|
271
|
+
border: 1px solid rgba(0, 255, 255, 0.3);
|
|
272
|
+
color: #00ffff;
|
|
273
|
+
padding: 10px 15px;
|
|
274
|
+
border-radius: 8px;
|
|
275
|
+
cursor: pointer;
|
|
276
|
+
transition: all 0.3s ease;
|
|
277
|
+
font-family: 'Orbitron', monospace;
|
|
278
|
+
font-size: 0.85rem;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.llm-example-btn:hover {
|
|
282
|
+
background: rgba(0, 255, 255, 0.2);
|
|
283
|
+
border-color: #00ffff;
|
|
284
|
+
transform: translateY(-1px);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.llm-more-examples {
|
|
288
|
+
background: transparent;
|
|
289
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
290
|
+
color: rgba(255, 255, 255, 0.6);
|
|
291
|
+
padding: 8px 16px;
|
|
292
|
+
border-radius: 6px;
|
|
293
|
+
cursor: pointer;
|
|
294
|
+
transition: all 0.3s ease;
|
|
295
|
+
font-family: 'Orbitron', monospace;
|
|
296
|
+
font-size: 0.85rem;
|
|
297
|
+
width: 100%;
|
|
298
|
+
margin-top: 10px;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.llm-more-examples:hover {
|
|
302
|
+
border-color: rgba(255, 255, 255, 0.4);
|
|
303
|
+
color: rgba(255, 255, 255, 0.8);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.llm-status {
|
|
307
|
+
margin-top: 20px;
|
|
308
|
+
padding: 15px;
|
|
309
|
+
border-radius: 10px;
|
|
310
|
+
font-family: 'Orbitron', monospace;
|
|
311
|
+
display: none;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.llm-status.processing {
|
|
315
|
+
display: block;
|
|
316
|
+
background: rgba(0, 100, 255, 0.1);
|
|
317
|
+
border: 1px solid rgba(0, 100, 255, 0.3);
|
|
318
|
+
color: #4080ff;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.llm-status.success {
|
|
322
|
+
display: block;
|
|
323
|
+
background: rgba(0, 255, 100, 0.1);
|
|
324
|
+
border: 1px solid rgba(0, 255, 100, 0.3);
|
|
325
|
+
color: #00ff64;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.llm-status.error {
|
|
329
|
+
display: block;
|
|
330
|
+
background: rgba(255, 0, 100, 0.1);
|
|
331
|
+
border: 1px solid rgba(255, 0, 100, 0.3);
|
|
332
|
+
color: #ff0064;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.llm-api-key-section {
|
|
336
|
+
margin-top: 20px;
|
|
337
|
+
padding: 20px;
|
|
338
|
+
background: rgba(255, 150, 0, 0.1);
|
|
339
|
+
border: 1px solid rgba(255, 150, 0, 0.3);
|
|
340
|
+
border-radius: 10px;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.llm-api-key-input {
|
|
344
|
+
width: 100%;
|
|
345
|
+
background: rgba(0, 0, 0, 0.3);
|
|
346
|
+
border: 1px solid rgba(255, 150, 0, 0.3);
|
|
347
|
+
color: #fff;
|
|
348
|
+
padding: 10px;
|
|
349
|
+
border-radius: 6px;
|
|
350
|
+
margin: 10px 0;
|
|
351
|
+
font-family: monospace;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.llm-api-key-save {
|
|
355
|
+
background: linear-gradient(135deg, #ff9600 0%, #ff6432 100%);
|
|
356
|
+
border: none;
|
|
357
|
+
color: #000;
|
|
358
|
+
padding: 10px 20px;
|
|
359
|
+
border-radius: 6px;
|
|
360
|
+
cursor: pointer;
|
|
361
|
+
font-weight: bold;
|
|
362
|
+
font-family: 'Orbitron', monospace;
|
|
363
|
+
transition: all 0.3s ease;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.llm-api-key-save:hover {
|
|
367
|
+
transform: translateY(-1px);
|
|
368
|
+
box-shadow: 0 5px 20px rgba(255, 150, 0, 0.3);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.llm-api-key-help {
|
|
372
|
+
font-size: 0.85rem;
|
|
373
|
+
color: rgba(255, 255, 255, 0.6);
|
|
374
|
+
margin-top: 10px;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.llm-api-key-help a {
|
|
378
|
+
color: #ff9600;
|
|
379
|
+
text-decoration: none;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.llm-api-key-help a:hover {
|
|
383
|
+
text-decoration: underline;
|
|
384
|
+
}
|
|
385
|
+
`;
|
|
386
|
+
|
|
387
|
+
document.head.appendChild(style);
|
|
388
|
+
document.body.appendChild(this.overlay);
|
|
389
|
+
|
|
390
|
+
// Get references
|
|
391
|
+
this.input = this.overlay.querySelector('.llm-input');
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Setup event handlers
|
|
396
|
+
*/
|
|
397
|
+
setupEventHandlers() {
|
|
398
|
+
// Close button
|
|
399
|
+
this.overlay.querySelector('.llm-close').addEventListener('click', () => this.hide());
|
|
400
|
+
|
|
401
|
+
// Click outside to close
|
|
402
|
+
this.overlay.addEventListener('click', (e) => {
|
|
403
|
+
if (e.target === this.overlay) {
|
|
404
|
+
this.hide();
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// Generate button
|
|
409
|
+
this.overlay.querySelector('.llm-generate').addEventListener('click', () => {
|
|
410
|
+
this.generateFromInput();
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
// Enter key in input
|
|
414
|
+
this.input.addEventListener('keypress', (e) => {
|
|
415
|
+
if (e.key === 'Enter' && !this.isProcessing) {
|
|
416
|
+
this.generateFromInput();
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
// Example buttons
|
|
421
|
+
this.overlay.querySelectorAll('.llm-example-btn').forEach(btn => {
|
|
422
|
+
btn.addEventListener('click', () => {
|
|
423
|
+
this.input.value = btn.dataset.description;
|
|
424
|
+
this.generateFromInput();
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
// More examples button
|
|
429
|
+
this.overlay.querySelector('.llm-more-examples').addEventListener('click', (e) => {
|
|
430
|
+
const grid = this.overlay.querySelector('.llm-examples-grid');
|
|
431
|
+
const currentCount = grid.children.length;
|
|
432
|
+
|
|
433
|
+
if (currentCount < this.exampleDescriptions.length) {
|
|
434
|
+
// Show all examples
|
|
435
|
+
grid.innerHTML = this.exampleDescriptions.map(desc =>
|
|
436
|
+
`<button class="llm-example-btn" data-description="${desc}">${desc}</button>`
|
|
437
|
+
).join('');
|
|
438
|
+
e.target.textContent = 'Show fewer examples...';
|
|
439
|
+
} else {
|
|
440
|
+
// Show only first 6
|
|
441
|
+
grid.innerHTML = this.exampleDescriptions.slice(0, 6).map(desc =>
|
|
442
|
+
`<button class="llm-example-btn" data-description="${desc}">${desc}</button>`
|
|
443
|
+
).join('');
|
|
444
|
+
e.target.textContent = 'Show more examples...';
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// Re-attach handlers to new buttons
|
|
448
|
+
grid.querySelectorAll('.llm-example-btn').forEach(btn => {
|
|
449
|
+
btn.addEventListener('click', () => {
|
|
450
|
+
this.input.value = btn.dataset.description;
|
|
451
|
+
this.generateFromInput();
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
// API key save button
|
|
457
|
+
this.overlay.querySelector('.llm-api-key-save').addEventListener('click', () => {
|
|
458
|
+
const apiKeyInput = this.overlay.querySelector('.llm-api-key-input');
|
|
459
|
+
const apiKey = apiKeyInput.value.trim();
|
|
460
|
+
|
|
461
|
+
if (!apiKey) {
|
|
462
|
+
this.showStatus('Please enter an API key', 'error');
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (!apiKey.startsWith('AIza') || apiKey.length < 30) {
|
|
467
|
+
this.showStatus('Invalid API key format. Should start with "AIza" and be longer than 30 characters.', 'error');
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
try {
|
|
472
|
+
this.llmInterface.setApiKey(apiKey);
|
|
473
|
+
this.overlay.querySelector('.llm-api-key-section').style.display = 'none';
|
|
474
|
+
this.showStatus('API key saved successfully! You can now generate parameters.', 'success');
|
|
475
|
+
|
|
476
|
+
// Clear the input to prevent accidental retries
|
|
477
|
+
apiKeyInput.value = '';
|
|
478
|
+
|
|
479
|
+
// DON'T auto-retry - let user manually trigger generation
|
|
480
|
+
console.log('✅ API key set. Ready for manual generation.');
|
|
481
|
+
|
|
482
|
+
} catch (error) {
|
|
483
|
+
this.showStatus('Failed to save API key', 'error');
|
|
484
|
+
console.error('API key save error:', error);
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Show the overlay
|
|
491
|
+
*/
|
|
492
|
+
async show() {
|
|
493
|
+
this.overlay.classList.add('active');
|
|
494
|
+
|
|
495
|
+
// Initialize LLM interface
|
|
496
|
+
await this.llmInterface.initialize();
|
|
497
|
+
|
|
498
|
+
// Focus on input
|
|
499
|
+
setTimeout(() => this.input.focus(), 100);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Hide the overlay
|
|
504
|
+
*/
|
|
505
|
+
hide() {
|
|
506
|
+
this.overlay.classList.remove('active');
|
|
507
|
+
this.input.value = '';
|
|
508
|
+
this.hideStatus();
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Generate parameters from input
|
|
513
|
+
*/
|
|
514
|
+
async generateFromInput() {
|
|
515
|
+
const description = this.input.value.trim();
|
|
516
|
+
|
|
517
|
+
if (!description) {
|
|
518
|
+
this.showStatus('Please enter a description', 'error');
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
if (this.isProcessing) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
this.isProcessing = true;
|
|
527
|
+
this.showStatus('Generating parameters...', 'processing');
|
|
528
|
+
|
|
529
|
+
const generateBtn = this.overlay.querySelector('.llm-generate');
|
|
530
|
+
generateBtn.disabled = true;
|
|
531
|
+
|
|
532
|
+
try {
|
|
533
|
+
const parameters = await this.llmInterface.generateParameters(description);
|
|
534
|
+
|
|
535
|
+
this.showStatus('Parameters generated successfully!', 'success');
|
|
536
|
+
|
|
537
|
+
// Close after a short delay
|
|
538
|
+
setTimeout(() => this.hide(), 1500);
|
|
539
|
+
|
|
540
|
+
} catch (error) {
|
|
541
|
+
console.error('Generation error:', error);
|
|
542
|
+
|
|
543
|
+
if (error.message.includes('No API key set')) {
|
|
544
|
+
// Show API key input
|
|
545
|
+
this.overlay.querySelector('.llm-api-key-section').style.display = 'block';
|
|
546
|
+
this.showStatus('Please enter your Gemini API key to use AI generation', 'error');
|
|
547
|
+
} else if (error.message.includes('API request failed')) {
|
|
548
|
+
this.showStatus('API request failed. Please check your API key is valid and try again.', 'error');
|
|
549
|
+
// Also show API key input in case they need to fix it
|
|
550
|
+
this.overlay.querySelector('.llm-api-key-section').style.display = 'block';
|
|
551
|
+
} else {
|
|
552
|
+
this.showStatus(`Generation failed: ${error.message}`, 'error');
|
|
553
|
+
}
|
|
554
|
+
} finally {
|
|
555
|
+
this.isProcessing = false;
|
|
556
|
+
generateBtn.disabled = false;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Show status message
|
|
562
|
+
*/
|
|
563
|
+
showStatus(message, type) {
|
|
564
|
+
const status = this.overlay.querySelector('.llm-status');
|
|
565
|
+
status.textContent = message;
|
|
566
|
+
status.className = `llm-status ${type}`;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Hide status message
|
|
571
|
+
*/
|
|
572
|
+
hideStatus() {
|
|
573
|
+
const status = this.overlay.querySelector('.llm-status');
|
|
574
|
+
status.className = 'llm-status';
|
|
575
|
+
status.textContent = '';
|
|
576
|
+
}
|
|
577
|
+
}
|