code-ollama 0.18.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -843,17 +843,17 @@ function Suggestions({ options, isDisabled = false, maxVisibleOptions = DEFAULT_
843
843
  onHighlight,
844
844
  options
845
845
  ]);
846
- useInput((_, key) => {
846
+ useInput((input, key) => {
847
847
  if (isDisabled || !options.length) return;
848
- if (key.downArrow) {
848
+ if (key.downArrow || input === "\x1B[B") {
849
849
  setFocusedIndex((currentIndex) => Math.min(currentIndex + 1, options.length - 1));
850
850
  return;
851
851
  }
852
- if (key.upArrow) {
852
+ if (key.upArrow || input === "\x1B[A") {
853
853
  setFocusedIndex((currentIndex) => Math.max(currentIndex - 1, 0));
854
854
  return;
855
855
  }
856
- if (key.tab || key.return) onSelect(options[focusedIndex]);
856
+ if (key.tab || key.return || input === " " || input === "\r") onSelect(options[focusedIndex]);
857
857
  });
858
858
  if (!options.length) return null;
859
859
  const visibleStart = Math.min(Math.max(0, focusedIndex - maxVisibleOptions + 1), Math.max(0, options.length - maxVisibleOptions));
@@ -1145,10 +1145,10 @@ function ChatInput({ history: sessionHistory, isDisabled = false, onInterrupt, o
1145
1145
  var ACTION_NOT_PERFORMED = "The requested action was NOT performed";
1146
1146
  var PLAN_CHECKLIST_REMINDER = "Then display the execution plan as an unchecked Markdown checklist only";
1147
1147
  var PLAN_EXECUTION_REMINDER = `Do not claim success and do not call ${Array.from(WRITE_TOOLS).join(", ")} until the user approves execution`;
1148
- var INTERRUPT_REASON = /* @__PURE__ */ function(INTERRUPT_REASON) {
1149
- INTERRUPT_REASON["INTERRUPTED"] = "interrupted";
1150
- INTERRUPT_REASON["REJECTED"] = "rejected";
1151
- return INTERRUPT_REASON;
1148
+ var InterruptReason = /* @__PURE__ */ function(InterruptReason) {
1149
+ InterruptReason["Interrupted"] = "interrupted";
1150
+ InterruptReason["Rejected"] = "rejected";
1151
+ return InterruptReason;
1152
1152
  }({});
1153
1153
  //#endregion
1154
1154
  //#region src/components/Chat/plan.ts
@@ -1216,13 +1216,15 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
1216
1216
  abortControllerRef.current = null;
1217
1217
  setIsLoading(false);
1218
1218
  setStreamingMessage(null);
1219
- setInterruptReason(INTERRUPT_REASON.INTERRUPTED);
1219
+ setInterruptReason(InterruptReason.Interrupted);
1220
1220
  setMessages((prev) => [...prev, {
1221
1221
  role: USER,
1222
1222
  content: TURN_ABORTED_MESSAGE
1223
1223
  }]);
1224
1224
  }, []);
1225
1225
  const processStream = useCallback(async (currentMessages, executionMode = mode) => {
1226
+ // v8 ignore next
1227
+ if (!model) throw new Error("Model is required");
1226
1228
  const controller = new AbortController();
1227
1229
  abortControllerRef.current = controller;
1228
1230
  const assistantMessage = {
@@ -1297,6 +1299,9 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
1297
1299
  theme
1298
1300
  ]);
1299
1301
  const processStreamReadOnly = useCallback(async (currentMessages) => {
1302
+ const modelName = model;
1303
+ // v8 ignore next
1304
+ if (!modelName) throw new Error("Model is required");
1300
1305
  const controller = new AbortController();
1301
1306
  abortControllerRef.current = controller;
1302
1307
  const assistantMessage = {
@@ -1327,7 +1332,7 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
1327
1332
  setStreamingMessage(assistantMessage);
1328
1333
  try {
1329
1334
  const readOnlyTools = TOOLS.filter((tool) => READ_TOOLS.has(tool.function.name));
1330
- for await (const chunk of streamChat(withSystemMessage(currentMessages), model, readOnlyTools, controller.signal)) {
1335
+ for await (const chunk of streamChat(withSystemMessage(currentMessages), modelName, readOnlyTools, controller.signal)) {
1331
1336
  // v8 ignore next 3
1332
1337
  if (controller.signal.aborted) return;
1333
1338
  if (chunk.type === "content") {
@@ -1363,7 +1368,7 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
1363
1368
  };
1364
1369
  setStreamingMessage(planAssistantMessage);
1365
1370
  try {
1366
- for await (const chunk of streamChat(withSystemMessage(planMessages), model, [], controller.signal)) {
1371
+ for await (const chunk of streamChat(withSystemMessage(planMessages), modelName, [], controller.signal)) {
1367
1372
  // v8 ignore next 3
1368
1373
  if (controller.signal.aborted) return;
1369
1374
  if (chunk.type === "content") {
@@ -1455,7 +1460,7 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
1455
1460
  content: TURN_ABORTED_MESSAGE
1456
1461
  }]);
1457
1462
  setIsLoading(false);
1458
- setInterruptReason(INTERRUPT_REASON.REJECTED);
1463
+ setInterruptReason(InterruptReason.Rejected);
1459
1464
  break;
1460
1465
  }
1461
1466
  }, [
@@ -1511,7 +1516,7 @@ function Chat({ initialMessages, model, onCommand, onMessagesChange, mode, onMod
1511
1516
  marginBottom: 1,
1512
1517
  children: /* @__PURE__ */ jsx(Text, {
1513
1518
  color: theme.colors.error,
1514
- children: interruptReason === INTERRUPT_REASON.REJECTED ? `❗ Tool call rejected.` : `❗ Execution interrupted.`
1519
+ children: interruptReason === InterruptReason.Rejected ? `❗ Tool call rejected.` : `❗ Execution interrupted.`
1515
1520
  })
1516
1521
  }),
1517
1522
  !pendingPlan && !pendingToolCall && /* @__PURE__ */ jsx(Box, {
@@ -1538,6 +1543,7 @@ function getModeColor(mode, theme) {
1538
1543
  }
1539
1544
  }
1540
1545
  function Footer({ mode, model, onToggleMode, theme = getTheme() }) {
1546
+ const modelLabel = model || "not configured";
1541
1547
  useInput((_, key) => {
1542
1548
  if (key.tab && key.shift) onToggleMode();
1543
1549
  });
@@ -1561,7 +1567,7 @@ function Footer({ mode, model, onToggleMode, theme = getTheme() }) {
1561
1567
  " Model: ",
1562
1568
  /* @__PURE__ */ jsx(Text, {
1563
1569
  color: theme.colors.model,
1564
- children: model
1570
+ children: modelLabel
1565
1571
  })
1566
1572
  ]
1567
1573
  })
@@ -1575,6 +1581,7 @@ function abbreviatePath(dir) {
1575
1581
  }
1576
1582
  function Header({ model, onLoad, theme = getTheme() }) {
1577
1583
  const directory = abbreviatePath(process.cwd());
1584
+ const modelLabel = model || "not configured";
1578
1585
  useEffect(() => {
1579
1586
  onLoad();
1580
1587
  }, []);
@@ -1606,7 +1613,7 @@ function Header({ model, onLoad, theme = getTheme() }) {
1606
1613
  dimColor: true,
1607
1614
  children: "model:".padEnd(11)
1608
1615
  }),
1609
- /* @__PURE__ */ jsx(Text, { children: model.padEnd(model.length + 3) }),
1616
+ /* @__PURE__ */ jsx(Text, { children: modelLabel.padEnd(modelLabel.length + 3) }),
1610
1617
  /* @__PURE__ */ jsx(Text, {
1611
1618
  color: theme.colors.command,
1612
1619
  children: "/model"
@@ -2008,13 +2015,16 @@ function ModelManager({ currentModel, onSelect, onClose, theme = getTheme() }) {
2008
2015
  pullRef.current?.abort();
2009
2016
  }, []);
2010
2017
  useInput((input, key) => {
2011
- if (view === View.CustomDownload && (key.escape || key.ctrl && input === "c")) {
2018
+ const isEscape = key.escape || input === "\x1B\x1B";
2019
+ const isCtrlC = key.ctrl && input === "c" || input === "";
2020
+ if (view === View.CustomDownload && (isEscape || isCtrlC)) {
2012
2021
  setNotice(null);
2013
2022
  setHighlightedSuggestion(null);
2014
2023
  setView(View.Download);
2015
2024
  return;
2016
2025
  }
2017
- if (view === View.Downloading && (key.escape || key.ctrl && input === "c")) cancelActivePull();
2026
+ // v8 ignore next
2027
+ if (view === View.Downloading && (isEscape || isCtrlC)) cancelActivePull();
2018
2028
  });
2019
2029
  const handleMenuChange = useCallback((value) => {
2020
2030
  setNotice(null);
@@ -2549,45 +2559,45 @@ function ThemeSettings({ currentTheme, onClose, onPreview, onSave }) {
2549
2559
  }
2550
2560
  //#endregion
2551
2561
  //#region src/components/App/constants.ts
2552
- var SCREEN = /* @__PURE__ */ function(SCREEN) {
2553
- SCREEN["CHAT"] = "chat";
2554
- SCREEN["MODEL_MANAGER"] = "model-manager";
2555
- SCREEN["SEARCH_SETTINGS"] = "search-settings";
2556
- SCREEN["SESSION_MANAGER"] = "session-manager";
2557
- SCREEN["THEME_SETTINGS"] = "theme-settings";
2558
- return SCREEN;
2562
+ var Screen = /* @__PURE__ */ function(Screen) {
2563
+ Screen["Chat"] = "chat";
2564
+ Screen["ModelManager"] = "model-manager";
2565
+ Screen["SearchSettings"] = "search-settings";
2566
+ Screen["SessionManager"] = "session-manager";
2567
+ Screen["ThemeSettings"] = "theme-settings";
2568
+ return Screen;
2559
2569
  }({});
2560
2570
  //#endregion
2561
2571
  //#region src/components/App/hooks/useScreenRouter.ts
2562
2572
  function useScreenRouter() {
2563
2573
  const { exit } = useApp();
2564
- const [currentScreen, setScreen] = useState(SCREEN.CHAT);
2574
+ const [currentScreen, setScreen] = useState(Screen.Chat);
2565
2575
  return {
2566
2576
  currentScreen,
2567
2577
  setScreen,
2568
2578
  handleClose: useCallback(() => {
2569
- setScreen(SCREEN.CHAT);
2579
+ setScreen(Screen.Chat);
2570
2580
  }, []),
2571
2581
  handleCommand: useCallback((command, callbacks) => {
2572
2582
  const { onCreateSession, onSetPreviewThemeId, model, theme } = callbacks;
2573
2583
  switch (command) {
2574
2584
  case "/session":
2575
- setScreen(SCREEN.SESSION_MANAGER);
2585
+ setScreen(Screen.SessionManager);
2576
2586
  break;
2577
2587
  case "/model":
2578
- setScreen(SCREEN.MODEL_MANAGER);
2588
+ setScreen(Screen.ModelManager);
2579
2589
  break;
2580
2590
  case "/search":
2581
- setScreen(SCREEN.SEARCH_SETTINGS);
2591
+ setScreen(Screen.SearchSettings);
2582
2592
  break;
2583
2593
  case "/theme":
2584
2594
  onSetPreviewThemeId(theme);
2585
- setScreen(SCREEN.THEME_SETTINGS);
2595
+ setScreen(Screen.ThemeSettings);
2586
2596
  break;
2587
2597
  case "/clear": {
2588
2598
  resetSystemMessage();
2589
2599
  const nextSession = onCreateSession(model);
2590
- setScreen(SCREEN.CHAT);
2600
+ setScreen(Screen.Chat);
2591
2601
  clear(nextSession.metadata.id);
2592
2602
  break;
2593
2603
  }
@@ -2674,7 +2684,7 @@ function useThemeSettings({ currentTheme, onUpdateConfig, setScreen }) {
2674
2684
  activeTheme,
2675
2685
  handleThemeClose: useCallback(() => {
2676
2686
  setPreviewThemeId(null);
2677
- setScreen(SCREEN.CHAT);
2687
+ setScreen(Screen.Chat);
2678
2688
  }, [setScreen]),
2679
2689
  handleThemePreview,
2680
2690
  handleThemeSave: useCallback((themeId) => {
@@ -2685,17 +2695,118 @@ function useThemeSettings({ currentTheme, onUpdateConfig, setScreen }) {
2685
2695
  };
2686
2696
  }
2687
2697
  //#endregion
2698
+ //#region src/components/App/ReadinessCheck.tsx
2699
+ var ReadinessState = /* @__PURE__ */ function(ReadinessState) {
2700
+ ReadinessState["Checking"] = "checking";
2701
+ ReadinessState["Ready"] = "ready";
2702
+ ReadinessState["MissingModelConfig"] = "missing-model-config";
2703
+ ReadinessState["NoInstalledModels"] = "no-installed-models";
2704
+ ReadinessState["ModelLoadError"] = "model-load-error";
2705
+ return ReadinessState;
2706
+ }({});
2707
+ function getTitle(setupState) {
2708
+ switch (setupState) {
2709
+ case "model-load-error": return "Connection Error";
2710
+ case "missing-model-config": return "No Model Configured";
2711
+ case "no-installed-models": return "No Model Installed";
2712
+ }
2713
+ }
2714
+ function getMessage(setupState, errorMessage) {
2715
+ const theme = getTheme();
2716
+ switch (setupState) {
2717
+ case "checking": return /* @__PURE__ */ jsx(Text, { children: "Checking model setup..." });
2718
+ case "missing-model-config": return /* @__PURE__ */ jsxs(Text, { children: [
2719
+ "Select or download a model with",
2720
+ " ",
2721
+ /* @__PURE__ */ jsx(Text, {
2722
+ color: theme.colors.command,
2723
+ children: "/model"
2724
+ })
2725
+ ] });
2726
+ case "no-installed-models": return /* @__PURE__ */ jsxs(Text, { children: ["Download a model with ", /* @__PURE__ */ jsx(Text, {
2727
+ color: theme.colors.command,
2728
+ children: "/model"
2729
+ })] });
2730
+ case "model-load-error": return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Text, { children: [
2731
+ "Error loading models",
2732
+ errorMessage ? `: ${errorMessage}` : "",
2733
+ "."
2734
+ ] }), /* @__PURE__ */ jsx(Text, { children: "Fix the connection and restart the app" })] });
2735
+ default: return null;
2736
+ }
2737
+ }
2738
+ function ReadinessCheck({ errorMessage, onCommand, setupState, theme = getTheme() }) {
2739
+ const title = getTitle(setupState);
2740
+ return /* @__PURE__ */ jsxs(Box, {
2741
+ flexDirection: "column",
2742
+ children: [/* @__PURE__ */ jsxs(Box, {
2743
+ borderStyle: "round",
2744
+ flexDirection: "column",
2745
+ marginBottom: 1,
2746
+ paddingX: 1,
2747
+ paddingY: 1,
2748
+ children: [title && /* @__PURE__ */ jsxs(Text, {
2749
+ bold: true,
2750
+ color: theme.colors.error,
2751
+ children: [
2752
+ "❗",
2753
+ " ",
2754
+ title
2755
+ ]
2756
+ }), getMessage(setupState, errorMessage)]
2757
+ }), /* @__PURE__ */ jsx(ChatInput, {
2758
+ history: [],
2759
+ onSubmit: onCommand
2760
+ })]
2761
+ });
2762
+ }
2763
+ //#endregion
2688
2764
  //#region src/components/App/App.tsx
2689
2765
  function App({ sessionId }) {
2690
2766
  const [appConfig, setConfig] = useState(() => loadConfig());
2691
2767
  const [mode, setMode] = useState(SAFE);
2692
2768
  const [isHeaderLoaded, setIsHeaderLoaded] = useState(false);
2769
+ const [setupState, setSetupState] = useState(() => appConfig.model ? ReadinessState.Ready : ReadinessState.MissingModelConfig);
2770
+ const [setupErrorMessage, setSetupErrorMessage] = useState(null);
2693
2771
  const { currentScreen, setScreen, handleClose, handleCommand } = useScreenRouter();
2694
2772
  const { activeSession, setSession, handleCreateSession, handleOpenSession, handleDeleteSession, handleMessagesChange } = useSessionManager({
2695
2773
  sessionId,
2696
- model: appConfig.model,
2774
+ model: appConfig.model ?? "",
2697
2775
  commandColor: getTheme(appConfig.theme).colors.command
2698
2776
  });
2777
+ useEffect(() => {
2778
+ let isMounted = true;
2779
+ async function refreshSetupState() {
2780
+ if (!appConfig.model) {
2781
+ // v8 ignore next
2782
+ if (isMounted) {
2783
+ setSetupErrorMessage(null);
2784
+ setSetupState(ReadinessState.MissingModelConfig);
2785
+ }
2786
+ return;
2787
+ }
2788
+ if (currentScreen !== Screen.Chat) return;
2789
+ // v8 ignore next
2790
+ if (isMounted) {
2791
+ setSetupErrorMessage(null);
2792
+ setSetupState(ReadinessState.Checking);
2793
+ }
2794
+ try {
2795
+ const installedModels = await listModels();
2796
+ if (!isMounted) return;
2797
+ setSetupState(installedModels.length > 0 ? ReadinessState.Ready : ReadinessState.NoInstalledModels);
2798
+ } catch (error) {
2799
+ // v8 ignore start
2800
+ if (!isMounted) return;
2801
+ setSetupErrorMessage(error instanceof Error ? error.message : String(error));
2802
+ setSetupState(ReadinessState.ModelLoadError);
2803
+ }
2804
+ }
2805
+ refreshSetupState();
2806
+ return () => {
2807
+ isMounted = false;
2808
+ };
2809
+ }, [appConfig.model, currentScreen]);
2699
2810
  const handleUpdateConfig = useCallback((update) => {
2700
2811
  setConfig((current) => ({
2701
2812
  ...current,
@@ -2707,7 +2818,7 @@ function App({ sessionId }) {
2707
2818
  ...current,
2708
2819
  metadata: updateSessionModel(current.metadata.id, newModel)
2709
2820
  }));
2710
- setScreen(SCREEN.CHAT);
2821
+ setScreen(Screen.Chat);
2711
2822
  }, [setScreen, setSession]);
2712
2823
  const { activeTheme, handleThemeClose, handleThemePreview, handleThemeSave, setPreviewThemeId } = useThemeSettings({
2713
2824
  currentTheme: appConfig.theme,
@@ -2729,7 +2840,7 @@ function App({ sessionId }) {
2729
2840
  }, []);
2730
2841
  const handleChatCommand = useCallback((command) => {
2731
2842
  handleCommand(command, {
2732
- model: appConfig.model,
2843
+ model: appConfig.model ?? "",
2733
2844
  theme: appConfig.theme,
2734
2845
  onCreateSession: handleCreateSession,
2735
2846
  onSetPreviewThemeId: setPreviewThemeId
@@ -2743,27 +2854,27 @@ function App({ sessionId }) {
2743
2854
  ]);
2744
2855
  const handleDeleteSessionAndStay = useCallback((sid) => {
2745
2856
  handleDeleteSession(sid);
2746
- setScreen(SCREEN.SESSION_MANAGER);
2857
+ setScreen(Screen.SessionManager);
2747
2858
  }, [handleDeleteSession, setScreen]);
2748
2859
  const handleOpenSessionAndNavigate = useCallback((sid) => {
2749
2860
  handleOpenSession(sid);
2750
- setScreen(SCREEN.CHAT);
2861
+ setScreen(Screen.Chat);
2751
2862
  }, [handleOpenSession, setScreen]);
2752
2863
  const handleCreateSessionAndNavigate = useCallback(() => {
2753
2864
  handleCreateSession();
2754
- setScreen(SCREEN.CHAT);
2865
+ setScreen(Screen.Chat);
2755
2866
  }, [handleCreateSession, setScreen]);
2756
2867
  let screenContent;
2757
2868
  switch (currentScreen) {
2758
- case SCREEN.MODEL_MANAGER:
2869
+ case Screen.ModelManager:
2759
2870
  screenContent = /* @__PURE__ */ jsx(ModelManager, {
2760
- currentModel: appConfig.model,
2871
+ currentModel: appConfig.model ?? "",
2761
2872
  onSelect: handleUpdateConfig,
2762
2873
  onClose: handleClose,
2763
2874
  theme: activeTheme
2764
2875
  });
2765
2876
  break;
2766
- case SCREEN.SEARCH_SETTINGS:
2877
+ case Screen.SearchSettings:
2767
2878
  screenContent = /* @__PURE__ */ jsx(SearchSettings, {
2768
2879
  currentUrl: appConfig.searxngBaseUrl,
2769
2880
  onSave: handleUpdateConfig,
@@ -2771,7 +2882,7 @@ function App({ sessionId }) {
2771
2882
  theme: activeTheme
2772
2883
  });
2773
2884
  break;
2774
- case SCREEN.SESSION_MANAGER:
2885
+ case Screen.SessionManager:
2775
2886
  screenContent = /* @__PURE__ */ jsx(SessionManager, {
2776
2887
  currentSessionId: activeSession.metadata.id,
2777
2888
  onClose: handleClose,
@@ -2781,7 +2892,7 @@ function App({ sessionId }) {
2781
2892
  theme: activeTheme
2782
2893
  });
2783
2894
  break;
2784
- case SCREEN.THEME_SETTINGS:
2895
+ case Screen.ThemeSettings:
2785
2896
  screenContent = /* @__PURE__ */ jsx(ThemeSettings, {
2786
2897
  currentTheme: appConfig.theme,
2787
2898
  onClose: handleThemeClose,
@@ -2789,8 +2900,8 @@ function App({ sessionId }) {
2789
2900
  onSave: handleThemeSave
2790
2901
  });
2791
2902
  break;
2792
- case SCREEN.CHAT:
2793
- screenContent = /* @__PURE__ */ jsx(Chat, {
2903
+ case Screen.Chat:
2904
+ screenContent = setupState === ReadinessState.Ready ? /* @__PURE__ */ jsx(Chat, {
2794
2905
  initialMessages: activeSession.messages,
2795
2906
  model: appConfig.model,
2796
2907
  onCommand: handleChatCommand,
@@ -2799,6 +2910,11 @@ function App({ sessionId }) {
2799
2910
  onModeChange: setMode,
2800
2911
  sessionId: activeSession.metadata.id,
2801
2912
  theme: activeTheme
2913
+ }) : /* @__PURE__ */ jsx(ReadinessCheck, {
2914
+ errorMessage: setupErrorMessage,
2915
+ onCommand: handleChatCommand,
2916
+ setupState,
2917
+ theme: activeTheme
2802
2918
  });
2803
2919
  break;
2804
2920
  }
@@ -2806,14 +2922,14 @@ function App({ sessionId }) {
2806
2922
  flexDirection: "column",
2807
2923
  children: [
2808
2924
  /* @__PURE__ */ jsx(Header, {
2809
- model: appConfig.model,
2925
+ model: appConfig.model ?? "",
2810
2926
  onLoad: handleHeaderLoad,
2811
2927
  theme: activeTheme
2812
2928
  }),
2813
2929
  isHeaderLoaded && screenContent,
2814
2930
  /* @__PURE__ */ jsx(Footer, {
2815
2931
  mode,
2816
- model: appConfig.model,
2932
+ model: appConfig.model ?? "",
2817
2933
  onToggleMode: handleToggleMode,
2818
2934
  theme: activeTheme
2819
2935
  })
package/dist/cli.js CHANGED
@@ -37,7 +37,7 @@ var LIST$1 = [
37
37
  //#endregion
38
38
  //#region package.json
39
39
  var name = "code-ollama";
40
- var version = "0.18.0";
40
+ var version = "0.18.1";
41
41
  //#endregion
42
42
  //#region src/constants/package.ts
43
43
  var NAME = name;
@@ -329,7 +329,6 @@ function withSystemMessage(messages) {
329
329
  //#region src/utils/config.ts
330
330
  var CONFIG_PATH = join(DIRECTORY, "config.json");
331
331
  var DEFAULT_HOST = "http://localhost:11434";
332
- var DEFAULT_MODEL$1 = "gemma4";
333
332
  function readFile$1() {
334
333
  if (!existsSync(CONFIG_PATH)) return {};
335
334
  try {
@@ -342,7 +341,7 @@ function loadConfig() {
342
341
  const file = readFile$1();
343
342
  return {
344
343
  host: process.env.OLLAMA_HOST ?? file.host ?? DEFAULT_HOST,
345
- model: process.env.OLLAMA_MODEL ?? file.model ?? DEFAULT_MODEL$1,
344
+ model: file.model,
346
345
  searxngBaseUrl: file.searxngBaseUrl,
347
346
  theme: file.theme ?? "github-dark"
348
347
  };
@@ -357,9 +356,9 @@ function saveConfig(patch) {
357
356
  }
358
357
  //#endregion
359
358
  //#region src/utils/ollama.ts
360
- var { host, model: DEFAULT_MODEL } = loadConfig();
359
+ var { host } = loadConfig();
361
360
  var client = new Ollama({ host });
362
- async function* streamChat(messages, model = DEFAULT_MODEL, tools, signal) {
361
+ async function* streamChat(messages, model, tools, signal) {
363
362
  const response = await client.chat({
364
363
  model,
365
364
  messages,
@@ -1124,7 +1123,7 @@ async function main(args = process.argv.slice(2)) {
1124
1123
  else await launchTui();
1125
1124
  }
1126
1125
  async function launchTui(sessionId) {
1127
- const { renderApp } = await import("./assets/tui-4cX-bKvd.js");
1126
+ const { renderApp } = await import("./assets/tui-GfzUJAWj.js");
1128
1127
  reset();
1129
1128
  renderApp(sessionId);
1130
1129
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-ollama",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Ollama coding agent that runs in your terminal",
5
5
  "author": "Mark <mark@remarkablemark.org> (https://remarkablemark.org)",
6
6
  "type": "module",