Skip to content

Commit 5fa950e

Browse files
authored
Merge pull request #148 from ArbiusIntern/moshi
Moshi integration [WebXR]
2 parents c9c203b + 1a031b9 commit 5fa950e

36 files changed

+445
-1818
lines changed

package-lock.json

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"iwer": "^1.0.4",
5252
"lil-gui": "^0.19.2",
5353
"next": "^14.2.13",
54+
"ogg-opus-decoder": "^1.6.14",
5455
"opus-recorder": "^8.0.5",
5556
"react": "^18.3.1",
5657
"react-dom": "^18.3.1",

src/components/settings.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { ChatGPTSettingsPage } from './settings/ChatGPTSettingsPage';
4242
import { LlamaCppSettingsPage } from './settings/LlamaCppSettingsPage';
4343
import { OllamaSettingsPage } from './settings/OllamaSettingsPage';
4444
import { KoboldAiSettingsPage } from './settings/KoboldAiSettingsPage';
45+
import { MoshiSettingsPage } from './settings/MoshiSettingsPage';
4546

4647
import { TTSBackendPage } from './settings/TTSBackendPage';
4748
import { ElevenLabsSettingsPage } from './settings/ElevenLabsSettingsPage';
@@ -96,6 +97,7 @@ export const Settings = ({
9697
const [koboldAiUrl, setKoboldAiUrl] = useState(config("koboldai_url"));
9798
const [koboldAiUseExtra, setKoboldAiUseExtra] = useState<boolean>(config("koboldai_use_extra") === 'true' ? true : false);
9899
const [koboldAiStopSequence, setKoboldAiStopSequence] = useState(config("koboldai_stop_sequence"));
100+
const [moshiUrl, setMoshiUrl] = useState(config("moshi_url"));
99101

100102
const [ttsBackend, setTTSBackend] = useState(config("tts_backend"));
101103
const [elevenlabsApiKey, setElevenlabsApiKey] = useState(config("elevenlabs_apikey"));
@@ -261,6 +263,7 @@ export const Settings = ({
261263
llamaCppUrl, llamaCppStopSequence,
262264
ollamaUrl, ollamaModel,
263265
koboldAiUrl, koboldAiUseExtra, koboldAiStopSequence,
266+
moshiUrl,
264267
ttsBackend,
265268
elevenlabsApiKey, elevenlabsVoiceId,
266269
speechT5SpeakerEmbeddingsUrl,
@@ -341,7 +344,7 @@ export const Settings = ({
341344

342345
case 'chatbot':
343346
return <MenuPage
344-
keys={["chatbot_backend", "name", "system_prompt", "arbius_llm_settings", "chatgpt_settings", "llamacpp_settings", "ollama_settings", "koboldai_settings"]}
347+
keys={["chatbot_backend", "name", "system_prompt", "arbius_llm_settings", "chatgpt_settings", "llamacpp_settings", "ollama_settings", "koboldai_settings", "moshi_settings"]}
345348
menuClick={handleMenuClick} />;
346349

347350
case 'language':
@@ -486,6 +489,13 @@ export const Settings = ({
486489
setSettingsUpdated={setSettingsUpdated}
487490
/>
488491

492+
case 'moshi_settings':
493+
return <MoshiSettingsPage
494+
moshiUrl={moshiUrl}
495+
setMoshiUrl={setMoshiUrl}
496+
setSettingsUpdated={setSettingsUpdated}
497+
/>
498+
489499
case 'tts_backend':
490500
return <TTSBackendPage
491501
ttsBackend={ttsBackend}

src/components/settings/ChatbotBackendPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const chatbotBackends = [
1313
...isTauri() ? [] : [{key: "windowai", label: "Window.ai"}], // Hides Window.ai when using the desktop app
1414
{key: "ollama", label: "Ollama"},
1515
{key: "koboldai", label: "KoboldAI"},
16+
{key: "moshi", label: "Moshi"},
1617
];
1718

1819
function idToTitle(id: string): string {
@@ -73,7 +74,7 @@ export function ChatbotBackendPage({
7374
</select>
7475
</FormRow>
7576
</li>
76-
{ ["arbius_llm", "chatgpt", "llamacpp", "ollama", "koboldai"].includes(chatbotBackend) && (
77+
{ ["arbius_llm", "chatgpt", "llamacpp", "ollama", "koboldai", "moshi"].includes(chatbotBackend) && (
7778
<li className="py-4">
7879
<FormRow label={`${t("Configure")} ${t(idToTitle(chatbotBackend))}`}>
7980
<button
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { useTranslation } from 'react-i18next';
2+
3+
import { BasicPage, FormRow, NotUsingAlert } from "./common";
4+
import { TextInput } from "@/components/textInput";
5+
import { config, updateConfig } from "@/utils/config";
6+
7+
export function MoshiSettingsPage({
8+
moshiUrl,
9+
setMoshiUrl,
10+
setSettingsUpdated,
11+
}: {
12+
moshiUrl: string;
13+
setMoshiUrl: (url: string) => void;
14+
setSettingsUpdated: (updated: boolean) => void;
15+
}) {
16+
const { t } = useTranslation();
17+
18+
const description = <>{t("moshi_desc", "Moshi is a speech-text foundation model and full-duplex spoken dialogue framework.")} <a href="https://kyutai.org/">{t("kyutai")}</a></>;
19+
20+
return (
21+
<BasicPage
22+
title={t("Moshi") + " " + t("Settings")}
23+
description={description}
24+
>
25+
{ config("chatbot_backend") !== "moshi" && (
26+
<NotUsingAlert>
27+
{t("not_using_alert", "You are not currently using {{name}} as your {{what}} backend. These settings will not be used.", {name: t("Moshi"), what: t("ChatBot")})}
28+
</NotUsingAlert>
29+
) }
30+
<ul role="list" className="divide-y divide-gray-100 max-w-xs">
31+
<li className="py-4">
32+
<FormRow label={t("API URL")}>
33+
<TextInput
34+
value={moshiUrl}
35+
onChange={(event: React.ChangeEvent<any>) => {
36+
setMoshiUrl(event.target.value);
37+
updateConfig("moshi_url", event.target.value);
38+
setSettingsUpdated(true);
39+
}}
40+
/>
41+
</FormRow>
42+
</li>
43+
</ul>
44+
</BasicPage>
45+
);
46+
}

src/components/settings/common.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export function getIconFromPage(page: string): JSX.Element {
160160
case 'llamacpp_settings': return <AdjustmentsHorizontalIcon className="h-5 w-5 flex-none text-gray-800" aria-hidden="true" />;
161161
case 'ollama_settings': return <AdjustmentsHorizontalIcon className="h-5 w-5 flex-none text-gray-800" aria-hidden="true" />;
162162
case 'koboldai_settings': return <AdjustmentsHorizontalIcon className="h-5 w-5 flex-none text-gray-800" aria-hidden="true" />;
163+
case 'moshi_settings': return <AdjustmentsHorizontalIcon className="h-5 w-5 flex-none text-gray-800" aria-hidden="true" />;
163164
case 'name': return <IdentificationIcon className="h-5 w-5 flex-none text-gray-800" aria-hidden="true" />;
164165
case 'system_prompt': return <DocumentTextIcon className="h-5 w-5 flex-none text-gray-800" aria-hidden="true" />;
165166

@@ -213,6 +214,7 @@ function getLabelFromPage(page: string): string {
213214
case 'llamacpp_settings': return t('LLama.cpp');
214215
case 'ollama_settings': return t('Ollama');
215216
case 'koboldai_settings': return t('KoboldAI');
217+
case 'moshi_settings': return t('Moshi');
216218
case 'name' : return t('Name');
217219
case 'system_prompt': return t('System Prompt');
218220

0 commit comments

Comments
 (0)