Skip to content

Commit

Permalink
Merge pull request #150 from brainless/marketing/prep_buildspace_w2
Browse files Browse the repository at this point in the history
Fixes for compare UI; form fixes
  • Loading branch information
brainless authored Jul 5, 2024
2 parents 16cbad5 + 3a73872 commit 4ec539b
Show file tree
Hide file tree
Showing 111 changed files with 8,209 additions and 16,039 deletions.
47 changes: 32 additions & 15 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "publish-dwata-desktop-app"
name: "publish-desktop-app"

on:
push:
tags:
- "v"
branches:
- "marketing/prep_buildspace_w2"

# This is the example from the readme.
# On each push to the `release` branch it will create or update a GitHub release, build your app, and upload the artifacts to the release.
Expand All @@ -15,20 +15,30 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest]
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: Install pnpm
uses: pnpm/action-setup@v4
Expand All @@ -41,15 +51,22 @@ jobs:
node-version: 18
cache: "pnpm"

- name: install frontend dependencies
run: pnpm install # change this to npm or pnpm depending on which one you use
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: pnpm install # change this to npm, pnpm or bun depending on which one you use.

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: "Dwata v__VERSION__"
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: "App v__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dwata",
"version": "0.1.2",
"description": "A general purpose, multi-model and multi-modal AI studio",
"version": "0.1.3",
"description": "AI assistants for everyone",
"type": "module",
"author": {
"name": "Sumit Datta",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ members = ["openai"]

[package]
name = "dwata"
version = "0.1.2"
description = "A general purpose, multi-model and multi-modal AI studio"
version = "0.1.3"
description = "AI assistants for everyone"
authors = ["Sumit Datta <sumitdatta@gmail.com>"]
license = "Apache-2.0 license"
repository = "https://github.com/brainless/dwata"
Expand Down
8 changes: 4 additions & 4 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"productName": "dwata",
"version": "0.0.4",
"version": "0.1.3",
"identifier": "com.dwata.app",
"build": {
"beforeDevCommand": "pnpm dev",
Expand All @@ -13,9 +13,9 @@
{
"fullscreen": false,
"resizable": true,
"title": "ui-demo",
"width": 800,
"height": 600
"title": "dwata",
"width": 1280,
"height": 720
}
],
"security": {
Expand Down
49 changes: 7 additions & 42 deletions src/routes/Chat.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import {
Component,
For,
createComputed,
createMemo,
createResource,
} from "solid-js";
import Thread from "../widgets/chat/Thread";
import { Component, For, createComputed, createResource } from "solid-js";
import ThreadItem from "../widgets/chat/ThreadItem";
import {
Route,
RouteSectionProps,
Expand All @@ -14,11 +8,9 @@ import {
} from "@solidjs/router";
import Heading from "../widgets/typography/Heading";
import { ChatProvider, useChat } from "../stores/chat";
import ChatForm, { NewChatForm } from "../widgets/chat/ChatForm";
import ReplyItem from "../widgets/chat/ReplyItem";
import { NewChatForm } from "../widgets/chat/ChatForm";
import CompareChats from "./CompareChats";
import Button from "../widgets/interactable/Button";
import getColors from "../utils/colors/gitHubDark";
import ThreadView from "../widgets/chat/ThreadView";

interface LocationProps {
pathname: string;
Expand Down Expand Up @@ -65,47 +57,20 @@ const ChatThreadIndex: Component = () => {
}
});

const getRootChat = createMemo(() =>
chat.chatList.find((x) => x.id === parseInt(params.threadId)),
);

return (
<div class="flex h-full">
<div class="w-2/5 overflow-y-auto pr-4">
<Heading size="3xl">Chats with AI</Heading>
<For
each={chat.chatList.filter((x) => x.comparedToRootChatId === null)}
>
{(thread) => <Thread {...thread} />}
{(thread) => <ThreadItem {...thread} />}
</For>
</div>

<div class="w-3/5 overflow-y-auto pr-3">
{!!getRootChat() ? (
<>
<ReplyItem {...getRootChat()!} index={0} />

<div
class="mb-4 font-thin"
style={{ color: getColors().colors["editor.foreground"] }}
>
<Button
size="sm"
href={`/chat/compare/${params.threadId}`}
label="Compare"
/>{" "}
responses from different AI models
</div>

<For each={chat.chatReplyList[parseInt(params.threadId)]}>
{(reply, index) => <ReplyItem {...reply} index={index()} />}
</For>

<ChatForm
rootChatId={parseInt(params.threadId)}
defaultAIModel={getRootChat()!.requestedAiModel || undefined}
/>
</>
{!!params.threadId ? (
<ThreadView rootChatId={parseInt(params.threadId)} />
) : null}
</div>
</div>
Expand Down
25 changes: 4 additions & 21 deletions src/routes/CompareChats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
} from "solid-js";
import { useLocation, useParams } from "@solidjs/router";
import { useChat } from "../stores/chat";
import ChatForm from "../widgets/chat/ChatForm";
import ReplyItem from "../widgets/chat/ReplyItem";
import CreateChatComparison from "../widgets/chat/CreateChatComparison";
import Heading from "../widgets/typography/Heading";
import { useUserInterface } from "../stores/userInterface";
import ThreadView from "../widgets/chat/ThreadView";

interface LocationProps {
pathname: string;
Expand Down Expand Up @@ -75,30 +75,13 @@ const CompareChats: Component = () => {

<div class="flex flex-row h-full">
<div class="w-96 overflow-y-auto pr-3 pb-16">
<For each={chat.chatReplyList[getRootChatId()]}>
{(reply, index) => <ReplyItem {...reply} index={index()} />}
</For>

<ChatForm
rootChatId={getRootChatId()}
defaultAIModel={getRootChat()!.requestedAiModel || undefined}
/>
<ThreadView rootChatId={getRootChatId()} isComparing />
</div>

<For each={chat.comparisonList[getRootChatId()]}>
{(comparisonChatId) => (
{(comparisonChat) => (
<div class="w-96 overflow-y-auto pr-3 pb-16">
<For each={chat.chatReplyList[comparisonChatId]}>
{(reply, index) => <ReplyItem {...reply} index={index()} />}
</For>

<ChatForm
rootChatId={comparisonChatId}
defaultAIModel={
chat.chatList.find((x) => x.id === comparisonChatId)!
.requestedAiModel || undefined
}
/>
<ThreadView rootChatId={comparisonChat.id} isComparing />
</div>
)}
</For>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Home: Component = () => {
<p style={{ color: getColors().colors["editor.foreground"] }}>
To get started, please{" "}
<Button
href="/settings/ai-provider/add"
href="/settings/ai-integration/add"
size="sm"
label="add an AI provider"
/>
Expand Down
6 changes: 3 additions & 3 deletions src/routes/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const SettingsIndex: Component = () => {
<div class="mb-2" />
<Button
label="Add an AI provider"
href="/settings/ai-provider/add"
href="/settings/ai-integration/add"
size="sm"
></Button>
<div class="mb-6" />
Expand Down Expand Up @@ -85,8 +85,8 @@ const SettingsRoutes: Component = () => {
component={DirectorySourceForm}
/>

<Route path="/ai-provider/add" component={AIIntegrationForm} />
<Route path="/ai-provider/edit/:id" component={AIIntegrationForm} />
<Route path="/ai-integration/add" component={AIIntegrationForm} />
<Route path="/ai-integration/edit/:id" component={AIIntegrationForm} />

<Route path="/" component={SettingsIndex} />
</>
Expand Down
10 changes: 5 additions & 5 deletions src/stores/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ModuleFilters } from "../api_types/ModuleFilters";

interface IStore {
chatList: Array<Chat>;
comparisonList: { [rootChatId: number]: Array<number> };
comparisonList: { [rootChatId: number]: Array<Chat> };
chatReplyList: { [rootChatId: number]: Array<Chat> };

isFetching: boolean;
Expand Down Expand Up @@ -83,18 +83,18 @@ const makeStore = () => {
...store,
comparisonList: {
...store.comparisonList,
[rootChatId]: (result["Chat"] as Array<Chat>).map((x) => x.id),
[rootChatId]: result["Chat"] as Array<Chat>,
},
});

for (const comparedChatId of store.comparisonList[rootChatId]) {
for (const comparedChat of store.comparisonList[rootChatId]) {
const result = await invoke<ModuleDataReadList>(
"read_row_list_for_module_with_filter",
{
module: "Chat" as Module,
filters: {
Chat: {
rootChatId: comparedChatId,
rootChatId: comparedChat.id,
},
} as ModuleFilters,
},
Expand All @@ -105,7 +105,7 @@ const makeStore = () => {
...store,
chatReplyList: {
...store.chatReplyList,
[comparedChatId]: result["Chat"] as Array<Chat>,
[comparedChat.id]: result["Chat"] as Array<Chat>,
},
});
}
Expand Down
62 changes: 62 additions & 0 deletions src/widgets/chat/ChatStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Component } from "solid-js";
import { Chat } from "../../api_types/Chat";
import { ProcessStatus } from "../../api_types/ProcessStatus";
import { useUserInterface } from "../../stores/userInterface";
import Button from "../interactable/Button";
import { invoke } from "@tauri-apps/api/core";

const ChatStatus: Component<Chat> = (props) => {
const [_, { getColors }] = useUserInterface();

const handleResendChat = () => {
invoke("chat_with_ai", {
chatId: props.id,
});
};

if (props.processStatus === ("pending" as ProcessStatus)) {
return (
<div
class="p-3 rounded-md border overflow-x-scroll mb-4"
style={{
"background-color": getColors().colors["inlineChat.background"],
"border-color": getColors().colors["inlineChat.border"],
}}
>
<div
class="mb-2 font-normal"
style={{
color: getColors().colors["editor.foreground"],
"font-optical-sizing": "auto",
}}
>
Getting response from AI...
</div>
<div class="animate-pulse">
<div class="w-2/3 h-4 bg-gray-700 rounded mb-2"></div>
<div class="w-full h-8 bg-gray-600 rounded mb-2"></div>
<div class="w-full h-8 bg-gray-700 rounded mb-2"></div>
<div class="w-1/2 h-8 bg-gray-600 rounded"></div>
</div>

<div class="flex mt-4">
<div
class="grow font-thin text-sm content-center"
style={{
color: getColors().colors["editor.foreground"],
}}
>
Resend to AI (after 2 minutes)
</div>
<div>
<Button size="sm" label="Resend" onClick={handleResendChat} />
</div>
</div>
</div>
);
} else {
return null;
}
};

export default ChatStatus;
Loading

0 comments on commit 4ec539b

Please sign in to comment.