Skip to content

Commit

Permalink
Merge pull request Azure#148 from Azure/dev
Browse files Browse the repository at this point in the history
Remove Service Descriptions
  • Loading branch information
jameshoff-msft authored Feb 12, 2023
2 parents 9475744 + e6e2bfd commit 51252ba
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 5 deletions.
19 changes: 19 additions & 0 deletions src/frontend/api/isdeployed/function.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
}
],
"scriptFile": "../dist/isdeployed/index.js"
}
25 changes: 25 additions & 0 deletions src/frontend/api/isdeployed/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//import { SearchIndexClient, AzureKeyCredential } from "@azure/search-documents";
import { AzureFunction, Context, HttpRequest } from "@azure/functions"
import axios, { AxiosRequestConfig } from "axios";


const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> {

try {
const isDeployed = (process.env.OPENAI_ENDPOINT) ? true : false
context.res = {
body : {
isDeployed: isDeployed
}
}
} catch (err) {
context.log(err)
context.res = {
status: err
}
return
}
}


export default httpTrigger;
31 changes: 27 additions & 4 deletions src/frontend/src/App/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
import { Text, Button } from '@fluentui/react-northstar';
import { useEffect, useState } from 'react';
import axios from 'axios'

export default function Home(props) {

const [isOAIDeployed, setIsOAIDeployed] = useState(false)

useEffect(() => {
axios.get("/api/isdeployed").then(v => {
setIsOAIDeployed(v.data.isDeployed)
})
}, [])

const renderOAIOptions = () => {
if (isOAIDeployed) {
return (
<>
|
<Button id="OPENAI_VIEWER" onClick={(e) => props.onClick(e)} text style={{ color: "rgb(0, 120, 212)" }} content="OpenAI Viewer" />
|
<Button id="VECTOR_SEARCH" onClick={(e) => props.onClick(e)} text style={{ color: "rgb(0, 120, 212)" }} content="OpenAI Vector Search Application" />
</>


)
}
}

return (
<div style={{ paddingLeft: "0px", paddingTop: "50px" }}>
<Text weight="semibold" style={{ fontSize: "25px", display: "block", marginBottom: "20px" }}>Welcome to the Business Process Automation Accelerator</Text>
Expand All @@ -25,10 +50,8 @@ export default function Home(props) {
<Button id="UPLOAD_DOCUMENTS" onClick={(e) => props.onClick(e)} text style={{ color: "rgb(0, 120, 212)" }} content="Ingest Documents" />
|
<Button id="VIEW_INSIGHTS" onClick={(e) => props.onClick(e)} text style={{ color: "rgb(0, 120, 212)" }} content="Sample Search Application" />
|
<Button id="OPENAI_VIEWER" onClick={(e) => props.onClick(e)} text style={{ color: "rgb(0, 120, 212)" }} content="OpenAI Viewer" />
|
<Button id="VECTOR_SEARCH" onClick={(e) => props.onClick(e)} text style={{ color: "rgb(0, 120, 212)" }} content="OpenAI Vector Search Application" />
{renderOAIOptions()}

{/* </div> */}
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/Components/OptionCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function OptionCard(props) {
<Card.Header style={{paddingLeft: "10px", paddingRight: "10px", paddingTop: "10px"}}><Text content={props.option.label} weight="semibold" /></Card.Header>
<Card.Body style={{paddingLeft: "10px", paddingRight: "10px"}}>

<Text content="These are some details that will be given about the service." size="small" />
{/* <Text content="These are some details that will be given about the service." size="small" /> */}
</Card.Body>
</Card>
)
Expand Down

0 comments on commit 51252ba

Please sign in to comment.