Skip to content

Commit

Permalink
updated proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkundan committed Apr 29, 2024
1 parent 6fdabed commit feff0c8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const config: Config = {
config: {
saviynt:{
specPath: "static/api-specs/saviynt-rest-api-5.0-bundle.yaml",
proxy: "https://cors-anywhere.herokuapp.com",
proxy: "https://cors-api-18af4d883f64.herokuapp.com",
outputDir: "docs/reference/rest/5.0", // No trailing slash
sidebarOptions: {
groupPathsBy: "tag",
Expand Down
16 changes: 14 additions & 2 deletions src/components/OpenAI/LiveEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ import React from 'react';
import { LiveProvider, LiveEditor, LiveError, LivePreview } from 'react-live';

const LiveEditorComponent = ({ code, scope }) => {
const [output, setOutput] = useState('');

const runCode = async () => {
try {
const response = await axios.post('/api/openai', { prompt: code });
setOutput(response.data.choices[0].text);
} catch (error) {
setOutput('Error: ' + error.message);
}
};

return (
<LiveProvider code={code} scope={scope}>
<LiveEditor />
<LiveProvider code={code}>
<LiveEditor onChange={runCode} />
<LivePreview />
<div>{output}</div>
<LiveError />
</LiveProvider>
);
Expand Down
Empty file added src/pages/openai/chat.js
Empty file.

0 comments on commit feff0c8

Please sign in to comment.