-
Notifications
You must be signed in to change notification settings - Fork 1
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
17bd2d3
commit 3d006bd
Showing
2 changed files
with
60 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"use client" | ||
import React from "react" | ||
import { AiChat, AiChatProps } from "@mitodl/smoot-design/ai" | ||
import styled from "@emotion/styled" | ||
|
||
const INITIAL_MESSAGES: AiChatProps["initialMessages"] = [ | ||
{ | ||
content: "Hi! What are you interested in learning about?", | ||
role: "assistant", | ||
}, | ||
] | ||
|
||
const STARTERS = [ | ||
{ content: "I'm interested in quantum computing" }, | ||
{ content: "I want to understand global warming. " }, | ||
{ content: "I am curious about AI applications for business" }, | ||
] | ||
|
||
const REQUEST_OPTS: AiChatProps["requestOpts"] = { | ||
apiUrl: `${process.env.NEXT_PUBLIC_MITOL_API_BASE_URL}/http/recommendation_agent/`, | ||
transformBody(messages) { | ||
const message = messages[messages.length - 1].content | ||
return { message } | ||
}, | ||
fetchOpts: { | ||
credentials: "include", | ||
}, | ||
} | ||
|
||
const StyledChat = styled(AiChat)({ | ||
height: "calc(80vh - 72px)", | ||
marginTop: "16px", | ||
}) | ||
|
||
const HomePage: React.FC = () => { | ||
return ( | ||
<StyledChat | ||
initialMessages={INITIAL_MESSAGES} | ||
requestOpts={REQUEST_OPTS} | ||
conversationStarters={STARTERS} | ||
/> | ||
) | ||
} | ||
|
||
export default HomePage |
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,45 +1,22 @@ | ||
"use client" | ||
import React from "react" | ||
import { AiChat, AiChatProps } from "@mitodl/smoot-design/ai" | ||
import styled from "@emotion/styled" | ||
import Link from "next/link" | ||
|
||
const INITIAL_MESSAGES: AiChatProps["initialMessages"] = [ | ||
{ | ||
content: "Hi! What are you interested in learning about?", | ||
role: "assistant", | ||
}, | ||
] | ||
|
||
const STARTERS = [ | ||
{ content: "I'm interested in quantum computing" }, | ||
{ content: "I want to understand global warming. " }, | ||
{ content: "I am curious about AI applications for business" }, | ||
] | ||
|
||
const REQUEST_OPTS: AiChatProps["requestOpts"] = { | ||
apiUrl: `${process.env.NEXT_PUBLIC_MITOL_API_BASE_URL}/http/recommendation_agent/`, | ||
transformBody(messages) { | ||
const message = messages[messages.length - 1].content | ||
return { message } | ||
}, | ||
fetchOpts: { | ||
credentials: "include", | ||
}, | ||
export const metadata = { | ||
title: "Home", | ||
} | ||
|
||
const StyledChat = styled(AiChat)({ | ||
height: "calc(80vh - 72px)", | ||
marginTop: "16px", | ||
}) | ||
|
||
const HomePage: React.FC = () => { | ||
const Page = () => { | ||
return ( | ||
<StyledChat | ||
initialMessages={INITIAL_MESSAGES} | ||
requestOpts={REQUEST_OPTS} | ||
conversationStarters={STARTERS} | ||
/> | ||
<div> | ||
<ul> | ||
<li> | ||
<Link href="/http">Http Chat</Link> | ||
</li> | ||
<li> | ||
<Link href="/ws">Websocket Chat</Link> | ||
</li> | ||
</ul> | ||
</div> | ||
) | ||
} | ||
|
||
export default HomePage | ||
export default Page |