Skip to content

Commit

Permalink
chore: save vendor id and fk on review
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelovicentegc committed Oct 31, 2023
1 parent 7e4039f commit eadf213
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<img alt="Eu tive um sonho - HITL" src="https://raw.githubusercontent.com/eutiveumsonho/.github/main/profile/assets/logo-512x512.png" height="192" width="192" />
<h3 align="center">Human-in-the-loop back-office service</h3>
<img alt="Eu tive um sonho - Chiron" src="https://raw.githubusercontent.com/eutiveumsonho/.github/main/profile/assets/logo-512x512.png" height="192" width="192" />
<h3 align="center">Chiron - Human-in-the-loop back-office service</h3>
<p align="center">Make your AI system smarter.</p>
</p>

Expand All @@ -16,6 +16,8 @@ openssl rand -base64 32

After generating the key, paste it as the `ENCRYPTION_KEY` value from the `.env.local` file.

Include all emails that should be able to sign in to the application on the `ALLOWED_EMAILS` environment variable.

You're good to go now. Install the dependencies and run the development server:

```sh
Expand All @@ -38,4 +40,17 @@ Take a look at the `.env.example` file to see which environment variables you ne

This project is deployed using [Vercel](https://vercel.com/). You can deploy your own instance using the button below (feel free to deploy it anywhere else):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/eutiveumsonho/hitl)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/eutiveumsonho/chiron)

## Human-in-the-loop sequence

```mermaid
sequenceDiagram
Human->>+Chiron: Accesses the service based on the ALLOWED_EMAILS list
Human->>+Chiron: Provides vendor information (via API Management page)
Chiron->>+Human: Outputs vendor-specific API keys
Human->>+App: Configures App to hit Chiron with given API keys
App->>+Chiron: Hits Chiron with any data generated by AI (or not)
Human->>+Chiron: Review generated data (Human-in-the-loop)
Chiron->>+App: Hits App back with reviewed data
```
13 changes: 7 additions & 6 deletions containers/completions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export function CompletionsContainer(props) {
return completion[0]._id === JSON.parse(selected.item)._id;
})[1];

if (
!completionWithForeignKey?.[CHIRON_VENDOR_ID] ||
!completionWithForeignKey?.[CHIRON_FOREIGN_KEY]
) {
const vendorId = completionWithForeignKey?.[CHIRON_VENDOR_ID];
const foreignKey = completionWithForeignKey?.[CHIRON_FOREIGN_KEY];

if (!vendorId || !foreignKey) {
setReviewing(false);
return alert("Missing data");
}
Expand All @@ -50,15 +50,16 @@ export function CompletionsContainer(props) {
direction,
data: {
...JSON.parse(data),
[CHIRON_VENDOR_ID]: selected[CHIRON_VENDOR_ID],
[CHIRON_FOREIGN_KEY]: selected[CHIRON_FOREIGN_KEY],
[CHIRON_VENDOR_ID]: vendorId,
[CHIRON_FOREIGN_KEY]: foreignKey,
},
}),
});

if (res.status !== 200) {
alert(res.statusText);
} else {
// TODO: Refetch on success to refresh data in the UI
alert("Sucess");
}

Expand Down
1 change: 1 addition & 0 deletions lib/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export async function f(input, init = {}) {

return fetch(url, {
...init,
cache: "no-cache", // 'force-cache' is the default in Next.js 🤦‍
headers: headers(),
});
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "hitl",
"name": "chiron",
"version": "0.1.0",
"private": true,
"scripts": {
Expand Down

0 comments on commit eadf213

Please sign in to comment.