-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1679889
commit 5edb53e
Showing
12 changed files
with
118 additions
and
15 deletions.
There are no files selected for viewing
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,18 @@ | ||
import store, { useAppSelector } from '@renderer/store' | ||
import { setOllamaKeepAliveTime } from '@renderer/store/llm' | ||
import { useDispatch } from 'react-redux' | ||
|
||
export function useOllamaSettings() { | ||
const settings = useAppSelector((state) => state.llm.settings.ollama) | ||
const dispatch = useDispatch() | ||
|
||
return { ...settings, setKeepAliveTime: (time: number) => dispatch(setOllamaKeepAliveTime(time)) } | ||
} | ||
|
||
export function getOllamaSettings() { | ||
return store.getState().llm.settings.ollama | ||
} | ||
|
||
export function getOllamaKeepAliveTime() { | ||
return store.getState().llm.settings.ollama.keepAliveTime + 'm' | ||
} |
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
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
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
35 changes: 35 additions & 0 deletions
35
src/renderer/src/pages/settings/providers/OllamaSettings.tsx
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,35 @@ | ||
import { useOllamaSettings } from '@renderer/hooks/useOllama' | ||
import { InputNumber } from 'antd' | ||
import { FC, useState } from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import styled from 'styled-components' | ||
|
||
import { SettingSubtitle } from '../components' | ||
import { HelpText, HelpTextRow } from '../components/ProviderSetting' | ||
|
||
const OllamSettings: FC = () => { | ||
const { keepAliveTime, setKeepAliveTime } = useOllamaSettings() | ||
const [keepAliveMinutes, setKeepAliveMinutes] = useState(keepAliveTime) | ||
const { t } = useTranslation() | ||
|
||
return ( | ||
<Container> | ||
<SettingSubtitle>{t('ollama.keep_alive_time.title')}</SettingSubtitle> | ||
<InputNumber | ||
style={{ width: '100%' }} | ||
value={keepAliveMinutes} | ||
onChange={(e) => setKeepAliveMinutes(Number(e))} | ||
onBlur={() => setKeepAliveTime(keepAliveMinutes)} | ||
suffix={t('ollama.keep_alive_time.placeholder')} | ||
step={5} | ||
/> | ||
<HelpTextRow> | ||
<HelpText>{t('ollama.keep_alive_time.description')}</HelpText> | ||
</HelpTextRow> | ||
</Container> | ||
) | ||
} | ||
|
||
const Container = styled.div`` | ||
|
||
export default OllamSettings |
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
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