Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dOrgJelli committed Aug 31, 2023
2 parents ed29af9 + c94374a commit 4b1a5b3
Show file tree
Hide file tree
Showing 24 changed files with 13,153 additions and 8,846 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cd-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:

- name: Build
run: yarn build
env:
CI: false

- name: Move CNAME File
run: mv ./apps/browser/CNAME ./apps/browser/build
Expand Down
13 changes: 9 additions & 4 deletions apps/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"name": "@evo-ninja/ui",
"version": "0.1.0",
"private": true,
"workspaces": {
"packages": [
"../../packages/**"
]
},
"dependencies": {
"@evo-ninja/core": "0.1.0",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
Expand All @@ -20,8 +25,7 @@
"react-markdown": "^8.0.7",
"react-modal": "3.16.1",
"react-router-dom": "~6.15.0",
"react-scripts": "~5.0.1",
"typescript": "^4.9.5"
"react-scripts": "~5.0.1"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.17.0",
Expand All @@ -32,7 +36,8 @@
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@types/react-modal": "3.16.0",
"tailwindcss": "^3.3.3"
"tailwindcss": "^3.3.3",
"typescript": "^4.9.5"
},
"scripts": {
"start": "react-scripts start",
Expand All @@ -52,4 +57,4 @@
"last 1 safari version"
]
}
}
}
40 changes: 31 additions & 9 deletions apps/browser/src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { faMarkdown } from '@fortawesome/free-brands-svg-icons';
import "./Chat.css";

export interface ChatMessage {
text: string;
title: string;
content?: string;
user: string;
color?: string;
}
Expand All @@ -32,7 +33,7 @@ const Chat: React.FC<ChatProps> = ({ evo, onMessage, messages, goalEnded }: Chat
const [stopped, setStopped] = useState<boolean>(false);
const [showDisclaimer, setShowDisclaimer] = useState<boolean>(true);
const [trackUser, setTrackUser] = useState<boolean>(false);

const [hoveredMsgIndex, setHoveredMsgIndex] = useState<number>(-1);

const pausedRef = useRef(paused);
useEffect(() => {
Expand All @@ -58,7 +59,7 @@ const Chat: React.FC<ChatProps> = ({ evo, onMessage, messages, goalEnded }: Chat

// Create a new iteration thread
if (!evoItr) {
const goal = messages.filter((msg) => msg.user === "user")[0].text;
const goal = messages.filter((msg) => msg.user === "user")[0].title;
setEvoItr(evo.run(goal));
return Promise.resolve();
}
Expand All @@ -75,9 +76,10 @@ const Chat: React.FC<ChatProps> = ({ evo, onMessage, messages, goalEnded }: Chat

const response = await evoItr.next();

if (response.value && response.value.message) {
if (!response.done && response.value.message) {
const evoMessage = {
text: response.value.message,
title: response.value.message.title,
content: response.value.message.content,
user: "evo"
};
messageLog = [...messageLog, evoMessage];
Expand Down Expand Up @@ -112,7 +114,7 @@ const Chat: React.FC<ChatProps> = ({ evo, onMessage, messages, goalEnded }: Chat

const handleSend = async () => {
onMessage({
text: message,
title: message,
user: "user"
});
setSending(true);
Expand Down Expand Up @@ -146,7 +148,7 @@ const Chat: React.FC<ChatProps> = ({ evo, onMessage, messages, goalEnded }: Chat
let exportedContent = '';
if (format === 'md') {
exportedContent = messages.map((msg) => {
return `# ${msg.user.toUpperCase()}\n${msg.text}\n---\n`;
return `# ${msg.user.toUpperCase()}\n${msg.title}\n${msg.content}\n---\n`;
}).join('\n');
}

Expand Down Expand Up @@ -174,8 +176,28 @@ const Chat: React.FC<ChatProps> = ({ evo, onMessage, messages, goalEnded }: Chat
{messages.map((msg, index) => (
<div key={index} className={`MessageContainer ${msg.user}`}>
<div className="SenderName">{msg.user.toUpperCase()}</div>
<div className={`Message ${msg.user}`} style={msg.color ? { borderColor: msg.color } : undefined}>
<ReactMarkdown>{msg.text}</ReactMarkdown>
<div
className={`Message ${msg.user}`}
style={msg.color ? { borderColor: msg.color, cursor: 'pointer' } : { cursor: 'pointer'}}
onMouseEnter={() => setHoveredMsgIndex(index)}
onMouseLeave={() => setHoveredMsgIndex(-1)}
>
<div>
{
hoveredMsgIndex === index
? (
<>
<div>{msg.title}</div>
<ReactMarkdown>{msg.content ?? ""}</ReactMarkdown>
</>
)
: (
<>
<div>{msg.title}</div>
</>
)
}
</div>
</div>
</div>
))}
Expand Down
2 changes: 1 addition & 1 deletion apps/browser/src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const Sidebar = ({ onSettingsClick, scripts, userFiles, uploadUserFiles }: Sideb
<FontAwesomeIcon icon={faTwitter} />
</a>
<a
href="https://discord.polywrap.io"
href="https://discord.gg/X7ystzGcf5"
target="_blank"
rel="noopener noreferrer"
>
Expand Down
2 changes: 1 addition & 1 deletion apps/browser/src/pages/Dojo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function Dojo() {
onLog: (markdown: string, color?: string) => {
onMessage({
user: "evo",
text: markdown,
title: markdown,
color
});
}
Expand Down
2 changes: 1 addition & 1 deletion apps/browser/src/pages/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function Landing() {
<div className="Landing">
<header className="Landing-header">
<section className="Header-Links">
<a href="https://discord.polywrap.io" target="_blank" rel="noopener noreferrer">
<a href="https://discord.gg/X7ystzGcf5" target="_blank" rel="noopener noreferrer">
<img src="discord.svg" alt="Discord" />
</a>
<a href="https://twitter.com/evo_ninja_ai" target="_blank" rel="noopener noreferrer">
Expand Down
Loading

0 comments on commit 4b1a5b3

Please sign in to comment.