Last active
August 22, 2024 03:51
-
-
Save ranfysvalle02/7ff3b80827379a8747d1095cd2e67b1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openai import AzureOpenAI | |
import os | |
import subprocess | |
import json | |
from shutil import rmtree | |
# Azure OpenAI configuration | |
azure_openai_endpoint = os.getenv('OPENAI_AZURE_ENDPOINT', '') | |
azure_openai_api_key = os.getenv('OPENAI_API_KEY', '') | |
azure_openai_deployment_id = '' | |
client = AzureOpenAI( | |
azure_endpoint=azure_openai_endpoint, | |
api_version="2023-07-01-preview", | |
api_key=azure_openai_api_key | |
) | |
sample_code = """ | |
```ORACLE FORMS IN XML``` | |
<?xml version = '1.0' encoding = 'UTF-8'?> | |
<Module version="122011900" xmlns="http://xmlns.oracle.com/Forms"> | |
<FormModule Name="QAFE_FORM3" DirtyInfo="true" Title="QAFE Form 3" ConsoleWindow="WINDOW1" MenuModule="DEFAULT&SMARTBAR"> | |
<Coordinate CharacterCellWidth="7" RealUnit="Point" DefaultFontScaling="true" CharacterCellHeight="14" CoordinateSystem="Real"/> | |
<Block Name="SECTION" QueryDataSourceName="SECTION" RecordsDisplayCount="5" DirtyInfo="true" WhereClause="section.course_no = :course.course_no" ScrollbarWidth="14" ScrollbarLength="135"> | |
<Item Name="SECTION_ID" Prompt="Section Id" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="68" MaximumLength="9" ItemType="Text Item" DataType="Number" XPosition="13" Required="true" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="SECTION_ID" PromptDisplayStyle="First Record" ItemsDisplay="0" Height="14"/> | |
<Item Name="COURSE_NO" Prompt="Course No" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="68" MaximumLength="9" ItemType="Text Item" DataType="Number" XPosition="81" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="COURSE_NO" PromptDisplayStyle="First Record" ItemsDisplay="0" Height="14"> | |
<Trigger Name="WHEN-VALIDATE-ITEM" DirtyInfo="true" TriggerText="/*&#10;Check whether the entered course_no exists in the database.&#10;*/&#10;DECLARE&#10;	CURSOR c_get_course is SELECT course_no&#10;											FROM course&#10;											WHERE course.course_no = :section.course_no;&#10;	v_invalid BOOLEAN;&#10;	x number;&#10;BEGIN&#10;	OPEN c_get_course;&#10;	FETCH c_get_course INTO :course.course_no;&#10;	v_invalid := c_get_course%NOTFOUND;&#10;	IF v_invalid THEN&#10;		MESSAGE('This course does not exist in the database.');&#10;		RAISE FORM_TRIGGER_FAILURE;&#10;	END IF;&#10;END;"/> | |
</Item> | |
<Item Name="SECTION_NO" Prompt="Section No" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="34" MaximumLength="4" ItemType="Text Item" DataType="Number" XPosition="151" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="SECTION_NO" PromptDisplayStyle="First Record" ItemsDisplay="0" Height="14"/> | |
<Item Name="START_DATE_TIME" Prompt="Start Date Time" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="81" MaximumLength="11" ItemType="Text Item" DataType="Date" XPosition="187" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="START_DATE_TIME" PromptDisplayStyle="First Record" ItemsDisplay="0" Height="14"/> | |
<Item Name="LOCATION" Prompt="Location" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="344" MaximumLength="50" ItemType="Text Item" XPosition="268" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="LOCATION" PromptDisplayStyle="First Record" DataLengthSemantics="BYTE" ItemsDisplay="0" Height="14"/> | |
<Item Name="INSTRUCTOR_ID" Prompt="Instructor Id" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="68" MaximumLength="9" ItemType="Text Item" DataType="Number" XPosition="612" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="INSTRUCTOR_ID" PromptDisplayStyle="First Record" ItemsDisplay="0" Height="14"/> | |
<Item Name="CAPACITY" Prompt="Capacity" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="34" MaximumLength="4" ItemType="Text Item" DataType="Number" XPosition="680" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="CAPACITY" PromptDisplayStyle="First Record" ItemsDisplay="0" Height="14"/> | |
<Item Name="CREATED_BY" Prompt="Created By" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="209" ItemType="Text Item" XPosition="714" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="CREATED_BY" PromptDisplayStyle="First Record" DataLengthSemantics="BYTE" ItemsDisplay="0" Height="14"/> | |
<Item Name="CREATED_DATE" Prompt="Created Date" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="81" MaximumLength="11" ItemType="Text Item" DataType="Date" XPosition="923" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="CREATED_DATE" PromptDisplayStyle="First Record" ItemsDisplay="0" Height="14"/> | |
<Item Name="MODIFIED_BY" Prompt="Modified By" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="209" ItemType="Text Item" XPosition="1004" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="MODIFIED_BY" PromptDisplayStyle="First Record" DataLengthSemantics="BYTE" ItemsDisplay="0" Height="14"/> | |
<Item Name="MODIFIED_DATE" Prompt="Modified Date" PromptAttachmentEdge="Top" TabPageName="" PromptAlign="Center" Width="81" MaximumLength="11" ItemType="Text Item" DataType="Date" XPosition="1213" YPosition="37" DirtyInfo="true" CanvasName="CANVAS10" ColumnName="MODIFIED_DATE" PromptDisplayStyle="First Record" ItemsDisplay="0" Height="14"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="true" DSCPrecision="8" DSCName="SECTION_ID" DSCScale="0" DSCType="NUMBER" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="8" DSCName="COURSE_NO" DSCScale="0" DSCType="NUMBER" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="3" DSCName="SECTION_NO" DSCScale="0" DSCType="NUMBER" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="0" DSCName="START_DATE_TIME" DSCScale="0" DSCType="DATE" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="50" DSCMandatory="false" DSCPrecision="0" DSCName="LOCATION" DSCScale="0" DSCType="VARCHAR2" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="8" DSCName="INSTRUCTOR_ID" DSCScale="0" DSCType="NUMBER" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="3" DSCName="CAPACITY" DSCScale="0" DSCType="NUMBER" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="30" DSCMandatory="false" DSCPrecision="0" DSCName="CREATED_BY" DSCScale="0" DSCType="VARCHAR2" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="0" DSCName="CREATED_DATE" DSCScale="0" DSCType="DATE" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="30" DSCMandatory="false" DSCPrecision="0" DSCName="MODIFIED_BY" DSCScale="0" DSCType="VARCHAR2" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="0" DSCName="MODIFIED_DATE" DSCScale="0" DSCType="DATE" DSCNochildren="false" Type="Query"/> | |
<Trigger Name="WHEN-NEW-BLOCK-INSTANCE" DirtyInfo="true" TriggerText="execute_query;"/> | |
</Block> | |
<Block Name="SUB_BLOCK" DirtyInfo="true" ScrollbarWidth="14" ScrollbarLength="135"> | |
<Item Name="PUSH_BUTTON_CLOSE" Width="99" ItemType="Push Button" BackColor="gray12" XPosition="9" FontName="Tahoma" YPosition="131" FontSize="800" FontStyle="Plain" DirtyInfo="true" FontWeight="Demilight" Label="Close Window" FontSpacing="Normal" ForegroundColor="black" CanvasName="CANVAS10" Height="19"> | |
<Trigger Name="WHEN-BUTTON-PRESSED" DirtyInfo="true" TriggerText="go_back_to_home_screen;"/> | |
</Item> | |
</Block> | |
<Block Name="COURSE" QueryDataSourceName="COURSE" DirtyInfo="true" RecordsFetchedCount="0" ScrollbarWidth="14" ScrollbarLength="135"> | |
<Item Name="COURSE_NO" Prompt="Course No" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="270" MaximumLength="39" ItemType="Text Item" DataType="Number" XPosition="74" Required="true" YPosition="31" DirtyInfo="true" CanvasName="CANVAS2" ColumnName="COURSE_NO" PromptDisplayStyle="All Records" ItemsDisplay="0" Height="14"/> | |
<Item Name="DESCRIPTION" Prompt="Description" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="344" MaximumLength="50" ItemType="Text Item" XPosition="74" YPosition="45" DirtyInfo="true" CanvasName="CANVAS2" ColumnName="DESCRIPTION" PromptDisplayStyle="All Records" DataLengthSemantics="BYTE" ItemsDisplay="0" Height="14"/> | |
<Item Name="COST" Prompt="Cost" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="81" MaximumLength="11" ItemType="Text Item" DataType="Number" XPosition="74" YPosition="59" DirtyInfo="true" CanvasName="CANVAS2" ColumnName="COST" PromptDisplayStyle="All Records" ItemsDisplay="0" Height="14"> | |
<Trigger Name="WHEN-VALIDATE-ITEM" DirtyInfo="true" TriggerText="if :course.cost < 5 then&#10;	message('Course cost has to be greater than 5');&#10;	raise form_trigger_failure;&#10;end if;&#10;&#10;"/> | |
</Item> | |
<Item Name="PREREQUISITE" Prompt="Prerequisite" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="68" MaximumLength="9" ItemType="Text Item" DataType="Number" XPosition="74" YPosition="73" DirtyInfo="true" CanvasName="CANVAS2" ColumnName="PREREQUISITE" PromptDisplayStyle="All Records" ItemsDisplay="0" Height="14"/> | |
<Item Name="CREATED_BY" Prompt="Created By" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="209" ItemType="Text Item" XPosition="74" YPosition="87" DirtyInfo="true" CanvasName="CANVAS2" ColumnName="CREATED_BY" PromptDisplayStyle="All Records" DataLengthSemantics="BYTE" ItemsDisplay="0" Height="14"/> | |
<Item Name="CREATED_DATE" Prompt="Created Date" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="81" MaximumLength="11" ItemType="Text Item" DataType="Date" XPosition="74" YPosition="101" DirtyInfo="true" CanvasName="CANVAS2" ColumnName="CREATED_DATE" PromptDisplayStyle="All Records" ItemsDisplay="0" Height="14"/> | |
<Item Name="MODIFIED_BY" Prompt="Modified By" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="209" ItemType="Text Item" XPosition="74" YPosition="115" DirtyInfo="true" CanvasName="CANVAS2" ColumnName="MODIFIED_BY" PromptDisplayStyle="All Records" DataLengthSemantics="BYTE" ItemsDisplay="0" Height="14"/> | |
<Item Name="MODIFIED_DATE" Prompt="Modified Date" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="81" MaximumLength="11" ItemType="Text Item" DataType="Date" XPosition="74" YPosition="129" DirtyInfo="true" CanvasName="CANVAS2" ColumnName="MODIFIED_DATE" PromptDisplayStyle="All Records" ItemsDisplay="0" Height="14"/> | |
<Item Name="SECTIONCOUNT" Prompt="Section Count" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="68" XPosition="74" YPosition="143" DatabaseItem="false" DirtyInfo="true" CanvasName="CANVAS2" PromptDisplayStyle="All Records" ItemsDisplay="0" Height="14"/> | |
<Item Name="STUDENTCOUNT" Prompt="Student Count" TabPageName="" PromptAttachmentOffset="7" DistanceBetweenRecords="143" Width="68" XPosition="74" YPosition="157" DatabaseItem="false" DirtyInfo="true" PromptFontName="" CanvasName="CANVAS2" PromptDisplayStyle="All Records" ItemsDisplay="0" Height="14"/> | |
<Item Name="PUSH_BUTTON_WINDOW" DistanceBetweenRecords="140" Width="131" ItemType="Push Button" BackColor="white" XPosition="74" FontName="Tahoma" YPosition="171" FontSize="800" FontStyle="Plain" DirtyInfo="true" FontWeight="Demilight" Label="Show Sections" FontSpacing="Normal" ForegroundColor="black" CanvasName="CANVAS2" ItemsDisplay="0" Height="17"> | |
<Trigger Name="WHEN-BUTTON-PRESSED" DirtyInfo="true" TriggerText="show_window('WINDOW2');&#10;go_block('SECTION');&#10;go_item('section.section_id');"/> | |
</Item> | |
<Item Name="HIDESTUDENTCOUNT" Width="101" ItemType="Push Button" BackColor="white" XPosition="209" FontName="Tahoma" YPosition="170" FontSize="800" FontStyle="Plain" DirtyInfo="true" FontWeight="Demilight" Label="Hide Student Count" FontSpacing="Normal" ForegroundColor="black" CanvasName="CANVAS2" Height="18"> | |
<Trigger Name="WHEN-BUTTON-PRESSED" DirtyInfo="true" TriggerText="if get_item_property('STUDENTCOUNT', VISIBLE) = 'TRUE' then&#10;	set_item_property('STUDENTCOUNT', VISIBLE, PROPERTY_FALSE); &#10;else&#10;	set_item_property('STUDENTCOUNT', VISIBLE, PROPERTY_TRUE); &#10;end if;"/> | |
</Item> | |
<DataSourceColumn DSCLength="0" DSCMandatory="true" DSCPrecision="38" DSCName="COURSE_NO" DSCScale="0" DSCType="NUMBER" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="50" DSCMandatory="false" DSCPrecision="0" DSCName="DESCRIPTION" DSCScale="0" DSCType="VARCHAR2" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="9" DSCName="COST" DSCScale="2" DSCType="NUMBER" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="8" DSCName="PREREQUISITE" DSCScale="0" DSCType="NUMBER" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="30" DSCMandatory="false" DSCPrecision="0" DSCName="CREATED_BY" DSCScale="0" DSCType="VARCHAR2" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="0" DSCName="CREATED_DATE" DSCScale="0" DSCType="DATE" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="30" DSCMandatory="false" DSCPrecision="0" DSCName="MODIFIED_BY" DSCScale="0" DSCType="VARCHAR2" DSCNochildren="false" Type="Query"/> | |
<DataSourceColumn DSCLength="0" DSCMandatory="false" DSCPrecision="0" DSCName="MODIFIED_DATE" DSCScale="0" DSCType="DATE" DSCNochildren="false" Type="Query"/> | |
<Trigger Name="POST-QUERY" DirtyInfo="true" TriggerText="select count(sec.section_id) into :course.sectioncount &#10;from section sec &#10;where sec.course_no = :course.course_no;&#10;&#10;select count(enr.student_id) into :course.studentcount &#10;from enrollment enr, section sec &#10;where sec.course_no = :course.course_no and sec.section_id = enr.section_id;"/> | |
</Block> | |
<Canvas Name="CANVAS10" DirtyInfo="true" Width="1309" WindowName="WINDOW2" Height="324" ViewportHeight="324" ViewportWidth="540"> | |
<Graphics Name="FRAME21" RecordsDisplayCount="5" Width="1295" EdgeBackColor="white" FillPattern="none" EdgePattern="solid" FrameTitleOffset="14" XPosition="6" FrameTitleSpacing="7" YPosition="13" FrameTitle="Sections" Bevel="Inset" LayoutStyle="Tabular" DirtyInfo="true" LayoutDataBlockName="SECTION" GraphicsType="Frame" HorizontalMargin="7" ScrollbarWidth="14" VerticalMargin="14" HorizontalObjectOffset="0" Height="108" StartPromptOffset="7"/> | |
</Canvas> | |
<Canvas Name="CANVAS2" DirtyInfo="true" Width="540" WindowName="WINDOW1" Height="324" ViewportHeight="324" ViewportWidth="540"> | |
<Graphics Name="FRAME5" Width="418" EdgeBackColor="white" FillPattern="none" EdgePattern="solid" FrameTitleOffset="14" XPosition="7" FrameTitleSpacing="7" YPosition="17" FrameTitle="Courses" Bevel="Inset" DirtyInfo="true" LayoutDataBlockName="COURSE" GraphicsType="Frame" HorizontalMargin="7" ScrollbarWidth="14" VerticalMargin="14" HorizontalObjectOffset="14" Height="185" StartPromptOffset="7"/> | |
</Canvas> | |
<ProgramUnit Name="GO_BACK_TO_HOME_SCREEN" ProgramUnitText="PROCEDURE GO_BACK_TO_HOME_SCREEN IS&#10;BEGIN&#10; HIDE_WINDOW('WINDOW2');&#10;	go_item('COURSE.COURSE_NO');&#10;END;" ProgramUnitType="Procedure"/> | |
<Trigger Name="WHEN-NEW-FORM-INSTANCE" DirtyInfo="true" TriggerText=":global.user_id := 'Qafe';&#10;&#10;go_block('COURSE');&#10;execute_query();&#10;"/> | |
<Window Name="WINDOW2" DirtyInfo="true" Title="Newly opened window" Width="540" Height="324"/> | |
<Window Name="WINDOW1" Width="540" Height="324"/> | |
</FormModule> | |
</Module> | |
""" | |
ai_msg = client.chat.completions.create( | |
model=azure_openai_deployment_id, | |
messages=[ | |
{"role": "system", "content": "You are a helpful assistant. You are an expert converting ORACLE FORMS into HTML/JS/CSS specifically in React."}, | |
{"role": "user", "content": "Given this provided code :```\n\n"+sample_code+"""\n```\n | |
Write a JSON array of objects representing the components in the provided code. | |
important! think critically and step by step! | |
carefully analyze the provided coded and then write a JSON array of objects representing the components in the provided code. | |
[response criteria] | |
JSON array of objects under the key `components`, each representing a react component with the following keys: | |
* `id`: The ID of the component. | |
* `name`: The name of the component. | |
* `description`: The description of the component and its functionality. | |
* `smallReactComponent`: A small react component that can be used in the App.tsx file. | |
""" | |
} | |
], | |
response_format={ "type": "json_object" } | |
) | |
demo_result = ai_msg.choices[0].message.content | |
print(demo_result) | |
ai_msg = client.chat.completions.create( | |
model=azure_openai_deployment_id, | |
messages=[ | |
{"role": "system", "content": "You are a helpful assistant. You are an expert React developer who is highly capable in building modern and minimalistic user interfaces."}, | |
{"role": "user", "content": "Given this collection of small react components:\n\n"+str(demo_result)+"""\n\n | |
Generate a cohesive, fully functional App.tsx file from the provided collection of small react components. | |
You have react-bootstrap. And you are an expert at CSS. Think critically and step by step. | |
[response criteria] | |
Return the entire App.tsx contents as part of a JSON response under the key `app`. | |
Return the entire App.css contents as part of a JSON response under the key `css`. | |
CSS must be MongoDB-themed. | |
Include a <p> element with the text "Hello, World!" in the App.tsx file. | |
Include a <p> element with text explaining how to use App.tsx. | |
Put all the components directly into App.tsx. !IMPORTANT! | |
[end response criteria] | |
## IMPORTANT! MUST BE VALID JSON! | |
EVERYTHING HAS TO BE IN JUST TWO FILES [App.tsx, App.css] | |
Keep in mind, this was the original provided code: | |
\n | |
```"""+sample_code+"""\n``` | |
Using all the information provided, build the best possible App.tsx file. | |
""" | |
}, | |
], | |
response_format={ "type": "json_object" } | |
) | |
demo_result = json.loads(ai_msg.choices[0].message.content) | |
print("========") | |
print(demo_result) | |
dir_name = 'demo' | |
# Try to remove the 'demo' directory if it exists | |
try: | |
if os.path.exists(dir_name): | |
rmtree(dir_name) | |
print(f"Directory '{dir_name}' emptied successfully.") | |
except OSError as e: | |
print(f"Error emptying directory '{dir_name}': {e}") | |
# Create the 'demo' directory with `exist_ok=True` | |
os.makedirs(dir_name, exist_ok=True) | |
# Change the current working directory | |
os.chdir(dir_name) | |
# Try to create the Vite app using npx | |
try: | |
subprocess.run(["npx", "create-vite", ".", "--template", "react-ts"], check=True) | |
print("Vite application created successfully.") | |
except subprocess.CalledProcessError as e: | |
print(f"Error creating Vite app: {e}") | |
# Try to overwrite App.tsx | |
try: | |
with open("src/App.tsx", "w") as file: | |
file.write(str(demo_result["app"])) | |
print("App.tsx overwritten successfully.") | |
except FileNotFoundError as e: | |
print(f"Error overwriting App.tsx: File not found ({e})") | |
except Exception as e: # Catch generic exceptions | |
print(f"Unexpected error overwriting App.tsx: {e}") | |
# Try to overwrite App.css | |
try: | |
with open("src/App.css", "w") as file: | |
file.write(str(demo_result["css"])) | |
print("App.css overwritten successfully.") | |
except FileNotFoundError as e: | |
print(f"Error overwriting App.css: File not found ({e})") | |
except Exception as e: # Catch generic exceptions | |
print(f"Unexpected error overwriting App.css: {e}") | |
# Install Bootstrap and React-Bootstrap using npm | |
try: | |
subprocess.run(["npm", "install", "bootstrap", "react-bootstrap"], check=True) | |
print("Bootstrap and React-Bootstrap installed successfully.") | |
except subprocess.CalledProcessError as e: | |
print(f"Error installing dependencies: {e}") | |
# Run npm run dev | |
try: | |
subprocess.run(["npm", "run", "dev"], check=True) | |
print("Development server started successfully.") | |
except subprocess.CalledProcessError as e: | |
print(f"Error starting development server: {e}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GPT4o supports structured JSON output.
Today I decided to play with it a bit, the results were pretty cool
**No Function-Calling; Just orchestration
SUPER HACKY -- just an experiment**
Potential Problems:
As of recently, I've been questioning the "intelligence" of these models without any context augmentation.
Function-calling and function-calling libraries add overhead that is not always as controllable as I like for building solutions.
By moving the 'planning/orchestration' back to human/developer control, and leveraging things like response_format={"type":"json_object"} we can get a lot of the benefits of function-calling, and retain some of the control in the automation.