Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
knoopx committed Oct 30, 2023
1 parent ae2aed7 commit d25d82d
Show file tree
Hide file tree
Showing 12 changed files with 462 additions and 294 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: prepare
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git fetch --no-tags --prune --depth=1 origin gh-pages
rm -rf dist
git worktree add -B gh-pages dist origin/gh-pages
yarn install
- name: dist
run: |
rm -rf dist/**/*
yarn vite build
git --work-tree dist add --all
git --work-tree dist commit -m "$(date +%Y%m%d)"
git push origin HEAD:gh-pages --force
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# LLM Workbench

# Future Ideas

- TTS via tranformers.js
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LLM</title>
<title>LLM Workbench</title>
</head>
<body>
<div id="root" />
Expand Down
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{
"name": "any-llm",
"module": "index.ts",
"name": "llm-workbench",
"type": "module",
"homepage": "https://knoopx.github.io/llm-workbench/",
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/node": "^20.8.9",
"@types/react": "^18.2.33",
Expand Down
46 changes: 24 additions & 22 deletions src/app/ChatConversation.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,37 @@
import { Input } from "@/components/ui/input"
import { observer } from "mobx-react"
import { Button } from "../components/ui/button"
import { IoMdTrash, IoMdRefresh } from "react-icons/io"
import { ScrollArea } from "../components/ui/scroll-area"
import { Message } from "./ChatConversationMessage"
import { ToggleDarkButton } from "./ToggleDarkButton"
import { useStore } from "@/store"
import { ImMagicWand } from "react-icons/im"
import { VscDebugContinueSmall } from "react-icons/vsc"
import { VscDebugContinue, VscDebugStart } from "react-icons/vsc"
import { BiArrowToTop } from "react-icons/bi"
import { Textarea } from "@/components/ui/textarea"

export const ChatConversation = observer(() => {
const { activeChat: chat } = useStore()
const messages = [
// {
// role: "system",
// content: chat.systemMessage,
// },
// {
// role: "user",
// content: chat.user_message,
// },
...chat.messages,
]
return (
<div className="flex flex-col">
<ScrollArea className="flex-auto ">
<div className="mx-auto w-3/5">
{messages.map((message, i) => (
{chat.messages.map((message, i) => (
<Message key={i} {...message} />
))}
</div>
</ScrollArea>
<div className="flex-none flex items-center space-x-4 p-8 min-h-0 mx-auto w-3/5">
<ToggleDarkButton />
<form className="flex-auto flex" onSubmit={chat.onSubmit}>
<Input autoFocus placeholder="Enter text..." />
</form>

<div className="flex-none flex-col flex items-center space-x-4 space-y-2 p-8 min-h-0 mx-auto w-3/5">
<div className="space-x-1">
<ToggleDarkButton />

<Button onClick={chat.regenerate}>
<IoMdRefresh size="1.5em" />
</Button>
<Button onClick={chat.respond}>
<VscDebugContinueSmall size="1.5em" />
<VscDebugStart size="1.5em" />
</Button>
<Button onClick={chat.respond}>
<VscDebugContinue size="1.5em" />
</Button>
<Button onClick={chat.pop}>
<BiArrowToTop size="1.5em" />
Expand All @@ -52,6 +40,20 @@ export const ChatConversation = observer(() => {
<IoMdTrash size="1.5em" />
</Button>
</div>
<Textarea
className="w-full !min-h-[3em]"
value={chat.prompt}
onChange={(e) => chat.setPrompt(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault()
chat.userMessage(e.target.value)
chat.setPrompt("")
}
}}
autoFocus
placeholder="Enter text..."
/>
</div>
</div>
)
Expand Down
Loading

0 comments on commit d25d82d

Please sign in to comment.