Compare commits

...

4 Commits

Author SHA1 Message Date
niki-on-github
29cbfb2c1f Merge 728919f7bf into 4c73caadf6 2025-02-18 01:10:20 +01:00
ItzCrazyKns
4c73caadf6 feat(custom-openai): save live changes 2025-02-17 16:24:41 +05:30
nix
728919f7bf formating 2025-01-31 20:09:58 +01:00
nix
68048dfd56 add websocket subpath support 2025-01-31 20:01:26 +01:00
2 changed files with 37 additions and 20 deletions

View File

@@ -563,12 +563,16 @@ const Page = () => {
<Input
type="text"
placeholder="Model name"
defaultValue={config.customOpenaiModelName}
onChange={(e) =>
setConfig({
...config,
value={config.customOpenaiModelName}
isSaving={savingStates['customOpenaiModelName']}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setConfig((prev) => ({
...prev!,
customOpenaiModelName: e.target.value,
})
}));
}}
onSave={(value) =>
saveConfig('customOpenaiModelName', value)
}
/>
</div>
@@ -579,12 +583,16 @@ const Page = () => {
<Input
type="text"
placeholder="Custom OpenAI API Key"
defaultValue={config.customOpenaiApiKey}
onChange={(e) =>
setConfig({
...config,
value={config.customOpenaiApiKey}
isSaving={savingStates['customOpenaiApiKey']}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setConfig((prev) => ({
...prev!,
customOpenaiApiKey: e.target.value,
})
}));
}}
onSave={(value) =>
saveConfig('customOpenaiApiKey', value)
}
/>
</div>
@@ -595,12 +603,16 @@ const Page = () => {
<Input
type="text"
placeholder="Custom OpenAI Base URL"
defaultValue={config.customOpenaiApiUrl}
onChange={(e) =>
setConfig({
...config,
value={config.customOpenaiApiUrl}
isSaving={savingStates['customOpenaiApiUrl']}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setConfig((prev) => ({
...prev!,
customOpenaiApiUrl: e.target.value,
})
}));
}}
onSave={(value) =>
saveConfig('customOpenaiApiUrl', value)
}
/>
</div>

View File

@@ -377,11 +377,16 @@ const ChatWindow = ({ id }: { id?: string }) => {
const [isReady, setIsReady] = useState(false);
const [isWSReady, setIsWSReady] = useState(false);
const ws = useSocket(
process.env.NEXT_PUBLIC_WS_URL!,
setIsWSReady,
setHasError,
);
let websocketUrl = process.env.NEXT_PUBLIC_WS_URL!;
if (websocketUrl.startsWith('/')) {
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
const host = window.location.host;
const path = websocketUrl;
websocketUrl = `${protocol}${host}${path}`;
}
const ws = useSocket(websocketUrl, setIsWSReady, setHasError);
const [loading, setLoading] = useState(false);
const [messageAppeared, setMessageAppeared] = useState(false);