Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: installer populates vector store (#76)
## Motivation - added a new step into the installer, that explains how to use the prompt and it populates the vector store - made sure that "unpack" can now also delete the downloaded file after it was extracted - cleaned up "main" - added translations for de
- Loading branch information
1 parent
79ba43e
commit e7b1a08
Showing
32 changed files
with
545 additions
and
146 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,165 @@ | ||
import { AppFrame } from "@captn/joy/app-frame"; | ||
import { TitleBar } from "@captn/joy/title-bar"; | ||
import Alert from "@mui/joy/Alert"; | ||
import Box from "@mui/joy/Box"; | ||
import Button from "@mui/joy/Button"; | ||
import CircularProgress from "@mui/joy/CircularProgress"; | ||
import Input from "@mui/joy/Input"; | ||
import Typography from "@mui/joy/Typography"; | ||
import type { InferGetStaticPropsType } from "next"; | ||
import { useTranslation } from "next-i18next"; | ||
import { useEffect, useState } from "react"; | ||
|
||
import { buildKey } from "#/build-key"; | ||
import { ID } from "#/enums"; | ||
import { Captain } from "@/atoms/logo/captain"; | ||
import { makeStaticProperties } from "@/ions/i18n/get-static"; | ||
|
||
function DummyPrompt() { | ||
const { t } = useTranslation(["labels", "texts"]); | ||
return ( | ||
<Box | ||
sx={{ | ||
position: "relative", | ||
fontSize: 24, | ||
my: "1em", | ||
mx: 1, | ||
overflow: "hidden", | ||
boxShadow: "md", | ||
}} | ||
> | ||
<Input | ||
readOnly | ||
placeholder={t("labels:placeholder.prompt")} | ||
endDecorator={ | ||
<Box | ||
sx={{ | ||
flex: 1, | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
height: 44, | ||
width: 44, | ||
}} | ||
> | ||
<Captain sx={{ height: "100%" }} /> | ||
</Box> | ||
} | ||
sx={{ | ||
fontSize: "inherit", | ||
lineHeight: 1.25, | ||
p: 2, | ||
flexDirection: "row", | ||
}} | ||
/> | ||
</Box> | ||
); | ||
} | ||
|
||
export default function Page(_properties: InferGetStaticPropsType<typeof getStaticProps>) { | ||
const { t } = useTranslation(["labels", "texts"]); | ||
const [loading, setLoading] = useState(true); | ||
const [starting, setStarting] = useState(false); | ||
const [error, setError] = useState(null); | ||
|
||
let buttonText; | ||
|
||
useEffect(() => { | ||
const unsubscribeInitialized = window.ipc.on( | ||
buildKey([ID.INSTALL], { suffix: ":initialized" }), | ||
() => { | ||
setLoading(false); | ||
setError(null); | ||
} | ||
); | ||
|
||
const unsubscribeError = window.ipc.on( | ||
buildKey([ID.INSTALL], { suffix: ":error" }), | ||
error => { | ||
setLoading(false); | ||
setError(error); | ||
} | ||
); | ||
|
||
window.ipc.send(buildKey([ID.INSTALL], { suffix: ":initialize" })); | ||
|
||
return () => { | ||
unsubscribeInitialized(); | ||
unsubscribeError(); | ||
}; | ||
}, []); | ||
|
||
if (loading) { | ||
buttonText = t("labels:preparation"); | ||
} else if (starting) { | ||
buttonText = t("labels:starting"); | ||
} else { | ||
buttonText = t("labels:start"); | ||
} | ||
|
||
return ( | ||
<AppFrame titleBar={<TitleBar disableMaximize />}> | ||
<Box sx={{ minHeight: "100%", display: "flex", flexDirection: "column" }}> | ||
<Box sx={{ height: 200, alignContent: "center", px: 2 }}> | ||
<DummyPrompt /> | ||
</Box> | ||
|
||
<Typography level="h1" sx={{ my: 2, textAlign: "center" }}> | ||
{t("labels:finishing")} | ||
</Typography> | ||
|
||
<Box | ||
sx={{ | ||
flex: 1, | ||
display: "flex", | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
mx: 8, | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
p: 2, | ||
backgroundColor: "background.default", | ||
borderRadius: "8px", | ||
flexDirection: "column", | ||
}} | ||
> | ||
<Typography level="body-lg" sx={{ my: 2, textAlign: "center" }}> | ||
{t("texts:howToUseCaptain")} | ||
</Typography> | ||
|
||
{error ? ( | ||
<Alert color="danger">{error}</Alert> | ||
) : ( | ||
<Typography level="body-lg" sx={{ my: 2, textAlign: "center" }}> | ||
{loading ? t("texts:preparation") : t("texts:preparationDone")} | ||
</Typography> | ||
)} | ||
</Box> | ||
</Box> | ||
|
||
<Box sx={{ display: "flex", justifyContent: "flex-end", m: 1 }}> | ||
<Box sx={{ display: "flex", gap: 1 }}> | ||
<Button | ||
endDecorator={ | ||
loading || starting ? <CircularProgress size="sm" /> : null | ||
} | ||
onClick={() => { | ||
setStarting(true); | ||
window.ipc.send(buildKey([ID.APP], { suffix: ":ready" }), true); | ||
}} | ||
> | ||
{buttonText} | ||
</Button> | ||
</Box> | ||
</Box> | ||
</Box> | ||
</AppFrame> | ||
); | ||
} | ||
|
||
export const getStaticProps = makeStaticProperties(["common", "installer", "texts", "labels"]); | ||
|
||
export { getStaticPaths } from "@/ions/i18n/get-static"; |
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,10 +1,14 @@ | ||
{ | ||
"analyzingImages": "Bleib dran! Wir analysieren gerade die von dir bereitgestellten Bilder, um die perfekte Geschichte darum zu weben. Dieser Prozess nutzt fortschrittliche KI-Algorithmen, um den Kontext und die Elemente in deinen Bildern zu verstehen und eine Erzählung zu gewährleisten, die wirklich mit den Bildern harmoniert. Abhängig von der Komplexität und Anzahl der Bilder kann dies einige Minuten dauern. Wir schätzen deine Geduld. Mach dich bereit, von den Geschichten, die unsere KI speziell für dich kreieren kann, erstaunt zu werden.", | ||
"downloadSuccessUnpacking": "Download erfolgreich! Jetzt packen wir diesen Schatz der Technologie aus.", | ||
"howToUseCaptain": "Captain kannst du ganz einfach über den Prompt steuern, welchen du mit der Tastenkombination Strg + Alt + Leertaste jederzeit öffnen kannst. Schreibe dann einfach, was du machen möchtest und wir erledigen den Rest.", | ||
"preparation": "Damit der Prompt funktioniert, bereiten wir noch kurz alles vor.", | ||
"preparationDone": "Alle Vorbereitungen sind abgeschlossen! Viel Spaß mit Captain.", | ||
"quote1": "Wie Menschen träumen KIs auch von elektrischen Schafen. Zzz...", | ||
"quote2": "Ich lerne neue Dinge! Wusstest du, dass ich keinen Kaffee genießen kann? Aber ich kann helfen, einen zu brauen!", | ||
"quote3": "Wenn du denkst, eine Minute vergeht wirklich schnell, warst du noch nie in den 'letzten Sekunden' eines Downloads.", | ||
"quote4": "Mit KI zu arbeiten ist wie einen Freund zu haben, der fast alles weiß, aber immer noch nicht seine Schuhe binden kann.", | ||
"quote5": "Ich bat eine KI um einen Witz. Sie sagte: 'Ich könnte dir einen UDP-Witz erzählen, aber du verstehst ihn vielleicht nicht.'", | ||
"storyFormIntroduction": "Willkommen zu unserem Tool zur Geschichtsanpassung! Nachdem du deine Visionen mit unserem KI-gestützten Malwerkzeug zum Leben erweckt hast, ist es nun an der Zeit, Geschichten um deine Kreationen zu weben. Wähle unten deine Präferenzen, um die Geschichte zu formen, die am besten zu deinem Meisterwerk passt. Ob du eine kurze und süße Erzählung wünschst, eine mittellange Reise ins Fantastische oder einen tiefen Tauchgang in die Reiche des Unbekannten, wir sind hier, um deine Geschichte zum Leben zu erwecken. Wähle deinen Erzählstil, setze den emotionalen Ton und lass uns gemeinsam eine magische Geschichte erschaffen." | ||
"storyFormIntroduction": "Willkommen zu unserem Tool zur Geschichtsanpassung! Nachdem du deine Visionen mit unserem KI-gestützten Malwerkzeug zum Leben erweckt hast, ist es nun an der Zeit, Geschichten um deine Kreationen zu weben. Wähle unten deine Präferenzen, um die Geschichte zu formen, die am besten zu deinem Meisterwerk passt. Ob du eine kurze und süße Erzählung wünschst, eine mittellange Reise ins Fantastische oder einen tiefen Tauchgang in die Reiche des Unbekannten, wir sind hier, um deine Geschichte zum Leben zu erwecken. Wähle deinen Erzählstil, setze den emotionalen Ton und lass uns gemeinsam eine magische Geschichte erschaffen.", | ||
"unpackingSuccess": "Super, alles wurde installiert. Du hast es fast geschafft." | ||
} |
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.