Skip to content

Commit aee527a

Browse files
authored
Merge pull request #70 from saagpatel/codex/refactor/use-llm-split
refactor(hooks): split useLlm into model / generation / streaming
2 parents 98be877 + e0cd94b commit aee527a

7 files changed

Lines changed: 536 additions & 515 deletions

File tree

src/components/Draft/DraftTab.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ import { WorkspaceDialogs } from "./WorkspaceDialogs";
4040
import { WorkspaceModeShell } from "./WorkspaceModeShell";
4141
import { WorkspacePanels } from "./WorkspacePanels";
4242
import { WorkspaceWorkflowStrip } from "./WorkspaceWorkflowStrip";
43-
import { useLlm } from "../../hooks/useLlm";
43+
import { useLlmGeneration } from "../../hooks/useLlmGeneration";
44+
import { useLlmStreaming } from "../../hooks/useLlmStreaming";
4445
import { useDrafts } from "../../hooks/useDrafts";
4546
import { useKb } from "../../hooks/useKb";
4647
import { useAnalytics } from "../../hooks/useAnalytics";
@@ -101,11 +102,13 @@ export const DraftTab = forwardRef<DraftTabHandle, DraftTabProps>(
101102
isStreaming,
102103
clearStreamingText,
103104
cancelGeneration,
105+
} = useLlmStreaming();
106+
const {
104107
generateFirstResponse,
105108
generateChecklist,
106109
updateChecklist,
107110
generateWithContextParams,
108-
} = useLlm();
111+
} = useLlmGeneration();
109112
const {
110113
saveDraft,
111114
updateDraft,

src/components/Settings/SettingsTab.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ vi.mock("../shared/Button", () => ({
121121
),
122122
}));
123123

124-
vi.mock("../../hooks/useLlm", () => ({
125-
useLlm: () => ({
124+
vi.mock("../../hooks/useLlmModel", () => ({
125+
useLlmModel: () => ({
126126
loadModel: loadModelMock,
127127
unloadModel: unloadModelMock,
128128
getLoadedModel: getLoadedModelMock,

src/components/Settings/SettingsTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { useDownload } from "../../hooks/useDownload";
1414
import { useEmbedding } from "../../hooks/useEmbedding";
1515
import { useJira } from "../../hooks/useJira";
1616
import { useKb } from "../../hooks/useKb";
17-
import { useLlm } from "../../hooks/useLlm";
17+
import { useLlmModel } from "../../hooks/useLlmModel";
1818
import { useSearchApiEmbedding } from "../../hooks/useSearchApiEmbedding";
1919
import { useSettingsOps } from "../../hooks/useSettingsOps";
2020
import {
@@ -72,7 +72,7 @@ export function SettingsTab() {
7272
setContextWindow,
7373
loadCustomModel,
7474
validateGgufFile,
75-
} = useLlm();
75+
} = useLlmModel();
7676
const {
7777
setKbFolder,
7878
getKbFolder,

0 commit comments

Comments
 (0)