-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b5328c
commit 76dd670
Showing
3 changed files
with
68 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import { Bird } from '../components/ui/icons'; | ||
|
||
export enum Working { | ||
Idle = 'Idle', | ||
Working = 'Working', | ||
} | ||
|
||
interface WingToWingProps { | ||
onExpand: () => void; | ||
progressMessage: string; | ||
working: Working; | ||
} | ||
|
||
const WingToWing: React.FC<WingToWingProps> = ({ onExpand, progressMessage, working }) => { | ||
return ( | ||
<div | ||
onClick={onExpand} | ||
className="flex items-center w-full h-28 bg-gradient-to-r from-gray-100 via-gray-200 to-gray-300 shadow-md rounded-lg p-4 cursor-pointer hover:shadow-lg transition-all duration-200"> | ||
{working === Working.Working && ( | ||
<div className="w-10 h-10 mr-4 flex-shrink-0"> | ||
<Bird /> | ||
</div> | ||
)} | ||
|
||
{/* Status Text */} | ||
<div className="flex flex-col text-left"> | ||
<span className="text-sm text-gray-600 font-medium">{progressMessage}</span> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default WingToWing; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { getApiUrl } from '../config'; | ||
|
||
/** | ||
* Utility to ask the LLM any question to clarify without wider context. | ||
*/ | ||
export async function askAi(promptTemplates: string[]) { | ||
const responses = await Promise.all( | ||
promptTemplates.map(async (template) => { | ||
const response = await fetch(getApiUrl('/ask'), { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ prompt: template }), | ||
}); | ||
|
||
if (!response.ok) { | ||
throw new Error('Failed to get response'); | ||
} | ||
|
||
const data = await response.json(); | ||
|
||
return data.response; | ||
}) | ||
); | ||
|
||
return responses; | ||
} |