-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Eval meta #242
Merged
feat: Eval meta #242
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7037863
feat: eval meta
Ciroye 176786b
debug
Ciroye cf80927
debug
Ciroye e2b84f5
feat: update service name
Ciroye 07a21df
feat: update service name
Ciroye 25e89bb
feat: update service name
Ciroye c1a371b
feat: upload alias
Ciroye 92f7a6e
feat: fixing typos and update libraries versions
Ciroye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
fastapi==0.63.0 | ||
fastapi==0.109.1 | ||
mangum==0.10.0 | ||
pydantic==1.7.3 | ||
python-dotenv==0.15.0 | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
fastapi==0.63.0 | ||
fastapi==0.109.1 | ||
mangum==0.10.0 | ||
pydantic==1.7.3 | ||
python-dotenv==0.15.0 | ||
|
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
95 changes: 95 additions & 0 deletions
95
...onents/CreateSamples/CreateSamples/AnnotationInterfaces/Contexts/ChatWithInstructions.tsx
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,95 @@ | ||
import React, { FC, useContext, useEffect, useState } from "react"; | ||
import SignContract from "new_front/components/Modals/SignContract"; | ||
import SimpleChatbot from "new_front/components/CreateSamples/CreateSamples/AnnotationInterfaces/Contexts/SimpleChatbot"; | ||
import useFetch from "use-http"; | ||
import { ContextAnnotationFactoryType } from "new_front/types/createSamples/createSamples/annotationFactory"; | ||
import { ContextConfigType } from "new_front/types/createSamples/createSamples/annotationContext"; | ||
import UserContext from "containers/UserContext"; | ||
import Modal from "react-bootstrap/Modal"; | ||
import { ChatHistoryType } from "new_front/types/createSamples/createSamples/utils"; | ||
import { CreateInterfaceContext } from "new_front/context/CreateInterface/Context"; | ||
|
||
const ChatWithInstructions: FC< | ||
ContextAnnotationFactoryType & ContextConfigType | ||
> = ({ taskId, generative_context, setIsGenerativeContext, contextId }) => { | ||
const [signInConsent, setSignInConsent] = useState(false); | ||
const { post, response } = useFetch(); | ||
const [chatHistory, setChatHistory] = useState<ChatHistoryType>({ | ||
user: [], | ||
bot: [], | ||
}); | ||
const [modelName, setModelName] = useState(""); | ||
const [provider, setProvider] = useState(""); | ||
const [artifactsInput, setArtifactsInput] = useState<any>( | ||
generative_context.artifacts, | ||
); | ||
const [finishConversation, setFinishConversation] = useState(false); | ||
const { updateModelInputs } = useContext(CreateInterfaceContext); | ||
const { user } = useContext(UserContext); | ||
|
||
const checkIfUserIsSignedInConsent = async () => { | ||
const signConsent = await post("/task/check_signed_consent", { | ||
user_id: user.id, | ||
task_id: taskId, | ||
}); | ||
if (response.ok) { | ||
setSignInConsent(signConsent); | ||
} | ||
}; | ||
|
||
const handleSignInConsent = async () => { | ||
await post("/task/sign_in_consent", { | ||
user_id: user.id, | ||
task_id: taskId, | ||
}); | ||
setSignInConsent(true); | ||
window.location.reload(); | ||
}; | ||
|
||
useEffect(() => { | ||
checkIfUserIsSignedInConsent(); | ||
}, [signInConsent]); | ||
|
||
return ( | ||
<> | ||
{signInConsent ? ( | ||
<div className="grid grid-cols-3 gap-3 divide-x-2"> | ||
<div className="col-span-2"> | ||
<SimpleChatbot | ||
instructions={"<p>Instructions</p>"} | ||
chatHistory={chatHistory} | ||
username={user.username} | ||
modelName={modelName} | ||
provider={provider} | ||
setChatHistory={setChatHistory} | ||
updateModelInputs={updateModelInputs} | ||
setIsGenerativeContext={setIsGenerativeContext} | ||
/> | ||
</div> | ||
<div className="col-span-1"> | ||
<div className="p-4 bg-white"> | ||
<h2 className="mb-4 text-2xl font-bold">Instructions</h2> | ||
<p className="text-gray-600"> | ||
You are playing the part of a 47-year-old female patient who is | ||
concerned about having problems with her memory. She keeps | ||
forgetting basic things around the house, like where she put her | ||
keys or why she walked into a room. She has sticky notes all | ||
over the house to help her remember everything. She first | ||
started noticing about six months ago, but it has gotten worse, | ||
to the point that some of her colleagues at work have also asked | ||
about it. She is worried that it could be something to do with | ||
dementia. | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
) : ( | ||
<Modal show={true} onHide={() => setSignInConsent} size="lg"> | ||
<SignContract handleClose={handleSignInConsent} /> | ||
</Modal> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default ChatWithInstructions; |
21 changes: 2 additions & 19 deletions
21
...ew_front/components/CreateSamples/CreateSamples/AnnotationInterfaces/Contexts/Chatbot.tsx
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
59 changes: 59 additions & 0 deletions
59
...nt/components/CreateSamples/CreateSamples/AnnotationInterfaces/Contexts/DescribeImage.tsx
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,59 @@ | ||
import GeneralButton from "new_front/components/Buttons/GeneralButton"; | ||
import BasicInput from "new_front/components/Inputs/BasicInput"; | ||
import React, { useState } from "react"; | ||
|
||
type ImageUploadProps = { | ||
setImage: (image: string) => void; | ||
}; | ||
|
||
const ImageUpload = ({ setImage }: ImageUploadProps) => { | ||
const handleImageChange = (e: any) => { | ||
const file = e.target.files[0]; | ||
const reader = new FileReader(); | ||
reader.onloadend = () => { | ||
setImage(reader.result as string); | ||
}; | ||
reader.readAsDataURL(file); | ||
}; | ||
|
||
return ( | ||
<div className="flex justify-center align-center"> | ||
<div className="flex flex-col items-center py-2 space-y-3 align-center"> | ||
<input type="file" accept="image/*" onChange={handleImageChange} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
const DescribeImage = () => { | ||
const [image, setImage] = useState<string>( | ||
"https://w7.pngwing.com/pngs/527/625/png-transparent-scalable-graphics-computer-icons-upload-uploading-cdr-angle-text-thumbnail.png", | ||
); | ||
const [description, setDescription] = useState<string>(""); | ||
|
||
return ( | ||
<div className="flex justify-center align-center"> | ||
<div className="flex flex-col items-center py-2 space-y-3 align-center"> | ||
<img | ||
height={640} | ||
width={640} | ||
src={image} | ||
alt="src" | ||
className="rounded-lg cursor-pointer" | ||
/> | ||
<ImageUpload setImage={setImage} /> | ||
<BasicInput | ||
placeholder="Enter text here. Do not copy and paste" | ||
onChange={(e) => setDescription(e.target.value)} | ||
/> | ||
<GeneralButton | ||
onClick={() => console.log(description)} | ||
text="Send" | ||
className="px-4 mt-[2px] font-semibold border-0 font-weight-bold light-gray-bg task-action-btn " | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DescribeImage; |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason you want to keep this placeholder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be replaced in the next PR