File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,13 +9,8 @@ const POINT_CLOUDS = {
99
1010// Function to generate point cloud based on instruction
1111async function processInstruction ( ) {
12- const apiKey = document . getElementById ( 'apiKey' ) . value ;
1312 const instruction = document . getElementById ( 'instruction' ) . value ;
1413
15- if ( ! apiKey ) {
16- alert ( 'Please enter your OpenAI API Key' ) ;
17- return ;
18- }
1914 if ( ! instruction ) {
2015 alert ( 'Please enter an instruction' ) ;
2116 return ;
@@ -26,14 +21,14 @@ async function processInstruction() {
2621
2722 try {
2823 // Call OpenAI API
29- const response = await fetch ( 'https://api. openai.com /v1/chat/completions' , {
24+ const response = await fetch ( 'https://openai-cf.codediffuser.workers.dev /v1/chat/completions' , {
3025 method : 'POST' ,
3126 headers : {
3227 'Content-Type' : 'application/json' ,
33- 'Authorization' : `Bearer ${ apiKey } `
28+ 'Authorization' : `Bearer robopil_codediffuser `
3429 } ,
3530 body : JSON . stringify ( {
36- model : "gpt-3.5-turbo " ,
31+ model : "@cf/meta/llama-2-7b-chat-int8 " ,
3732 messages : [ {
3833 role : "user" ,
3934 content : `Based on this instruction: "${ instruction } ", select the most appropriate 3D shape from these options:
Original file line number Diff line number Diff line change 3636 < div class ="container ">
3737 < h1 class ="mb-4 "> 3D Point Cloud Generator</ h1 >
3838
39- < div class ="input-group mb-3 ">
40- < input type ="password " id ="apiKey " class ="form-control " placeholder ="Enter your OpenAI API Key ">
41- </ div >
42-
4339 < div class ="input-group ">
4440 < input type ="text " id ="instruction " class ="form-control " placeholder ="Enter your instruction (e.g., 'Generate a sphere with 1000 points') ">
4541 < button class ="btn btn-primary " onclick ="processInstruction() "> Generate</ button >
You can’t perform that action at this time.
0 commit comments