helloadhavan/github_issues huggingface dataset:
Repository: denoland/deno
Pull request: fix: don't ever set 1005 outbound close code

1005 should never be sent on the wire. Next.js errors when receiving this.

Changed files:
filename: ext/websocket/lib.rs
patch: @@ -721,7 +721,10 @@ pub async fn op_ws_close(
   const EMPTY_PAYLOAD: &[u8] = &[];
 
   let frame = reason
-    .map(|reason| Frame::close(code.unwrap_or(1005), reason.as_bytes()))
+    .map(|reason| match code {
+      Some(code) => Frame::close(code, &reason.into_bytes()),
+      _ => Frame::close_raw(reason.into_bytes().into()),
+    })
     .unwrap_or_else(|| match code {
       Some(code) => Frame::close(code, EMPTY_PAYLOAD),
       _ => Frame::close_raw(EMPTY_PAYLOAD.into()),

filename: tests/unit/websocket_test.ts
patch: @@ -1093,3 +1093,52 @@ Deno.test("WebSocket custom host header", async () => {
   ac.abort();
   await server.finished;
 });
+
+Deno.test("WebSocket close with reason but no code doesn't send 1005", async () => {
+  const ac = new AbortController();
+  const listeningDeferred = Promise.withResolvers<void>();
+
+  const server = Deno.serve({
+    handler: (request) => {
+      const { response, socket } = Deno.upgradeWebSocket(request);
+      socket.onerror = () => fail();
+      socket.onopen = () => {
+        socket.close(undefined, "A");
+      };
+      socket.onclose = () => ac.abort();
+      return response;
+    },
+    port: servePort,
+    signal: ac.signal,
+    onListen: () => listeningDeferred.resolve(),
+    hostname: "localhost",
+    onError: createOnErrorCb(ac),
+  });
+
+  await listeningDeferred.promise;
+
+  const conn = await Deno.connect({ port: servePort, hostname: "localhost" });
+  await conn.write(
+    new TextEncoder().encode(
+      "GET / HTTP/1.1\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n",
+    ),
+  );
+
+  const response = new Uint8Array(2048);
+  const n = await conn.read(response);
+  assert(n !== null && n > 0);
+  const headerEnd = new TextDecoder().decode(response).indexOf("\r\n\r\n");
+  assert(headerEnd > 0);
+
+  const frameStart = headerEnd + 4;
+  // [FIN+opcode][length][payload]
+  assertEquals(response[frameStart], 0x88);
+  const payloadLength = response[frameStart + 1] & 0x7F;
+
+  // Payload should just be "A" (1 byte), NOT 1005 code (2 bytes) + "A"
+  assertEquals(payloadLength, 1);
+  assertEquals(response[frameStart + 2], "A".charCodeAt(0));
+
+  conn.close();
+  await server.finished;
+});
Repository: ggml-org/llama.cpp
Pull request: server: explicitly set the function name in lambda

As [1] explained, the real debug message will be like:
	"res    operator(): operator() : queue result stop"

Set the name explicitly, the message is easy for debugging:
	"res    operator(): recv : queue result stop"

The left "operator()" is generated by 'RES_DBG() ... __func__'

[1]: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/lambda-function-name.html

*Make sure to read the [contributing guidelines](https://github.com/ggml-org/llama.cpp/blob/master/CONTRIBUTING.md) before submitting a PR*


Changed files:
filename: tools/server/server-queue.cpp
patch: @@ -199,7 +199,7 @@ server_task_result_ptr server_response::recv(const std::unordered_set<int> & id_
         std::unique_lock<std::mutex> lock(mutex_results);
         condition_results.wait(lock, [&]{
             if (!running) {
-                RES_DBG("%s : queue result stop\n", __func__);
+                RES_DBG("%s : queue result stop\n", "recv");
                 std::terminate(); // we cannot return here since the caller is HTTP code
             }
             return !queue_results.empty();
Repository: ollama/ollama
Pull request: Accomodate split cuda lib dir

Makes it a little easier to compile when cuda lib dir is split up as in nixos.

Changed files:
filename: llm/generate/gen_linux.sh
patch: @@ -128,6 +128,11 @@ if [ -z "${CUDA_LIB_DIR}" ] && [ -d /opt/cuda/targets/x86_64-linux/lib ]; then
     CUDA_LIB_DIR=/opt/cuda/targets/x86_64-linux/lib
 fi
 
+# Allow override in case libcudart is in the wrong place
+if [ -z "${CUDART_LIB_DIR}" ]; then
+    CUDART_LIB_DIR="${CUDA_LIB_DIR}"
+fi
+
 if [ -d "${CUDA_LIB_DIR}" ]; then
     echo "CUDA libraries detected - building dynamic CUDA library"
     init_vars
@@ -151,6 +156,8 @@ if [ -d "${CUDA_LIB_DIR}" ]; then
             cp "${CUDA_LIB_DIR}/${DEP}" "${BUILD_DIR}/lib/"
         elif [ -e "${CUDA_LIB_DIR}/${lib}.${CUDA_MAJOR}" ]; then
             cp "${CUDA_LIB_DIR}/${lib}.${CUDA_MAJOR}" "${BUILD_DIR}/lib/"
+        elif [ -e "${CUDART_LIB_DIR}/${lib}" ]; then
+            cp -d ${CUDART_LIB_DIR}/${lib}* "${BUILD_DIR}/lib/"
         else
             cp -d "${CUDA_LIB_DIR}/${lib}*" "${BUILD_DIR}/lib/"
         fi
Repository: nodejs/node
Pull request: domain: remove deprecated API call

<!--
Before submitting a pull request, please read:

- the CONTRIBUTING guide at https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md
- the commit message formatting guidelines at
  https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#commit-message-guidelines

For code changes:
1. Include tests for any bug fixes or new features.
2. Update documentation if relevant.
3. Ensure that `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes.

If you believe this PR should be highlighted in the Node.js CHANGELOG
please add the `notable-change` label.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
-->

https://github.com/nodejs/node/blob/eabb75cea8d46fcfb185ac0f0c2af18f434ee0d2/lib/events.js#L816-L824


Changed files:
filename: lib/domain.js
patch: @@ -270,7 +270,7 @@ Domain.prototype._errorHandler = function(er) {
     // as this would throw an error, make the process exit, and thus
     // prevent the process 'uncaughtException' event from being emitted
     // if a listener is set.
-    if (EventEmitter.listenerCount(this, 'error') > 0) {
+    if (this.listenerCount('error') > 0) {
       // Clear the uncaughtExceptionCaptureCallback so that we know that, since
       // the top-level domain is not active anymore, it would be ok to abort on
       // an uncaught exception at this point
Repository: ollama/ollama
Pull request: Get paths right for first run, and deps

Tested inside a Win 10 home hyperV VM with nothing extra added.  This gets all the deps right and loads the CPU runner.

![Screenshot 2024-02-04 at 8 50 15 PM](https://github.com/ollama/ollama/assets/4033016/5ad64dd7-0203-4510-a672-0b31189439c5)


Changed files:
filename: app/lifecycle/paths.go
patch: @@ -1,9 +1,12 @@
 package lifecycle
 
 import (
+	"fmt"
+	"log/slog"
 	"os"
 	"path/filepath"
 	"runtime"
+	"strings"
 )
 
 var (
@@ -30,6 +33,30 @@ func init() {
 		// Executables are stored in APPDATA
 		AppDir = filepath.Join(localAppData, "Programs", "Ollama")
 
+		// Make sure we have PATH set correctly for any spawned children
+		paths := strings.Split(os.Getenv("PATH"), ";")
+		// Start with whatever we find in the PATH/LD_LIBRARY_PATH
+		found := false
+		for _, path := range paths {
+			d, err := filepath.Abs(path)
+			if err != nil {
+				continue
+			}
+			if strings.EqualFold(AppDir, d) {
+				found = true
+			}
+		}
+		if !found {
+			paths = append(paths, AppDir)
+
+			pathVal := strings.Join(paths, ";")
+			slog.Debug("setting PATH=" + pathVal)
+			err := os.Setenv("PATH", pathVal)
+			if err != nil {
+				slog.Error(fmt.Sprintf("failed to update PATH: %s", err))
+			}
+		}
+
 	} else if runtime.GOOS == "darwin" {
 		// TODO
 		AppName += ".app"

filename: app/ollama.iss
patch: @@ -86,7 +86,7 @@ Name: "{userstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilen
 
 [Run]
 ; TODO consider starting a powershell window with a wall of text showing how to run ollama
-Filename: "{app}\{#MyAppExeName}"; Flags: postinstall nowait runhidden
+Filename: "{cmd}"; Parameters: "/C set PATH={app};%PATH% & ""{app}\{#MyAppExeName}"""; Flags: postinstall nowait runhidden
 
 [UninstallRun]
 ; Filename: "{cmd}"; Parameters: "/C ""taskkill /im ''{#MyAppExeName}'' /f /t"; Flags: runhidden

filename: scripts/build_windows.ps1
patch: @@ -40,12 +40,15 @@ function gatherDependencies() {
     rm -ea 0 -recurse -force -path "${script:DEPS_DIR}"
     md "${script:DEPS_DIR}" -ea 0 > $null
 
+    # TODO - this varies based on host build system and MSVC version - drive from dumpbin output
+    # currently works for Win11 + MSVC 2022 + Cuda V12
     cp "${env:VCToolsRedistDir}\x64\Microsoft.VC*.CRT\msvcp140.dll" "${script:DEPS_DIR}\"
     cp "${env:VCToolsRedistDir}\x64\Microsoft.VC*.CRT\vcruntime140.dll" "${script:DEPS_DIR}\"
-    cp "${env:VCToolsRedistDir}\x64\Microsoft.VC*.CRT\vcruntime140.dll" "${script:DEPS_DIR}\"
+    cp "${env:VCToolsRedistDir}\x64\Microsoft.VC*.CRT\vcruntime140_1.dll" "${script:DEPS_DIR}\"
 
     cp "${script:NVIDIA_DIR}\cudart64_*.dll" "${script:DEPS_DIR}\"
     cp "${script:NVIDIA_DIR}\cublas64_*.dll" "${script:DEPS_DIR}\"
+    # cp "${script:NVIDIA_DIR}\nvcuda.dll" "${script:DEPS_DIR}\"
 }
 
 function buildInstaller() {
Repository: vercel/next.js
Pull request: Fix output comparison when checking conclusion of required jobs

Follow-up to https://github.com/vercel/next.js/pull/83953

Seems like outputs are always strings so an actual string gets additional quotes:

```
##[debug]....=> '"success"'
##[debug]....Evaluating String:
##[debug]....=> 'success'
```
-- https://github.com/vercel/next.js/actions/runs/17844906912/job/50766317187#step:3:28

Changed files:
filename: .github/workflows/retry_test.yml
patch: @@ -71,7 +71,7 @@ jobs:
 
             return await rerunIfRequiredNotSuccessful()
       - name: send retry request to GitHub API
-        if: ${{ steps.required_job_conclusion.outputs.result != 'success' }}
+        if: ${{ steps.required_job_conclusion.outputs.result != '"success"' }}
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
@@ -137,7 +137,7 @@ jobs:
 
             return await rerunIfRequiredNotSuccessful()
       - name: send webhook
-        if: ${{ steps.required_job_conclusion.outputs.result != 'success' }}
+        if: ${{ steps.required_job_conclusion.outputs.result != '"success"' }}
         uses: slackapi/slack-github-action@v1.25.0
         with:
           # These urls are intentionally missing the protocol,
Repository: facebook/react
Pull request: fix[react-devtools/extensions]: propagate globals from env

Somehow missed this while working on https://github.com/facebook/react/pull/29869.

With these changes, manual inspection of the `react_devtools_backend_compact.js` doesn't have any occurences of `__IS_FIREFOX__` flag.

Changed files:
filename: packages/react-devtools-extensions/webpack.backend.js
patch: @@ -74,6 +74,9 @@ module.exports = {
       'process.env.IS_CHROME': IS_CHROME,
       'process.env.IS_FIREFOX': IS_FIREFOX,
       'process.env.IS_EDGE': IS_EDGE,
+      __IS_CHROME__: IS_CHROME,
+      __IS_FIREFOX__: IS_FIREFOX,
+      __IS_EDGE__: IS_EDGE,
     }),
     new Webpack.SourceMapDevToolPlugin({
       filename: '[file].map',
Repository: denoland/deno
Pull request: fix(ci): rename `trusted-signing-action` to `artifact-signing-action`

The GitHub action `Azure/trusted-signing-action` has been renamed to `Azure/artifact-signing-action`.

Ref: https://github.com/Azure/artifact-signing-action/issues/107

<!--
Before submitting a PR, please read https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label.
-->


Changed files:
filename: .github/workflows/ci.generate.ts
patch: @@ -850,7 +850,7 @@ const ci = {
             "github.repository == 'denoland/deno' &&",
             "(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))",
           ].join("\n"),
-          uses: "azure/trusted-signing-action@v0",
+          uses: "Azure/artifact-signing-action@v0",
           with: {
             "endpoint": "https://eus.codesigning.azure.net/",
             "trusted-signing-account-name": "deno-cli-code-signing",

filename: .github/workflows/ci.yml
patch: @@ -491,7 +491,7 @@ jobs:
           matrix.profile == 'release' &&
           github.repository == 'denoland/deno' &&
           (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')))
-        uses: azure/trusted-signing-action@v0
+        uses: Azure/artifact-signing-action@v0
         with:
           endpoint: 'https://eus.codesigning.azure.net/'
           trusted-signing-account-name: deno-cli-code-signing

filename: .github/workflows/promote_to_release.yml
patch: @@ -58,7 +58,7 @@ jobs:
           enable-AzPSSession: true
 
       - name: Code sign deno.exe
-        uses: azure/trusted-signing-action@v0
+        uses: Azure/artifact-signing-action@v0
         with:
           cache-dependencies: false
           trace: true
Repository: huggingface/transformers
Pull request: Patch more `unittest.case.TestCase.assertXXX` methods

# What does this PR do?

Extend #40727

will merge directly

Changed files:
filename: src/transformers/testing_utils.py
patch: @@ -3732,6 +3732,18 @@ def patch_testing_methods_to_collect_info():
         _patch_with_call_info(torch.testing, "assert_close", _parse_call_info, target_args=("actual", "expected"))
 
     _patch_with_call_info(unittest.case.TestCase, "assertEqual", _parse_call_info, target_args=("first", "second"))
+    _patch_with_call_info(unittest.case.TestCase, "assertListEqual", _parse_call_info, target_args=("list1", "list2"))
+    _patch_with_call_info(
+        unittest.case.TestCase, "assertTupleEqual", _parse_call_info, target_args=("tuple1", "tuple2")
+    )
+    _patch_with_call_info(unittest.case.TestCase, "assertSetEqual", _parse_call_info, target_args=("set1", "set1"))
+    _patch_with_call_info(unittest.case.TestCase, "assertDictEqual", _parse_call_info, target_args=("d1", "d2"))
+    _patch_with_call_info(unittest.case.TestCase, "assertIn", _parse_call_info, target_args=("member", "container"))
+    _patch_with_call_info(unittest.case.TestCase, "assertNotIn", _parse_call_info, target_args=("member", "container"))
+    _patch_with_call_info(unittest.case.TestCase, "assertLess", _parse_call_info, target_args=("a", "b"))
+    _patch_with_call_info(unittest.case.TestCase, "assertLessEqual", _parse_call_info, target_args=("a", "b"))
+    _patch_with_call_info(unittest.case.TestCase, "assertGreater", _parse_call_info, target_args=("a", "b"))
+    _patch_with_call_info(unittest.case.TestCase, "assertGreaterEqual", _parse_call_info, target_args=("a", "b"))
 
 
 def torchrun(script: str, nproc_per_node: int, is_torchrun: bool = True, env: Optional[dict] = None):
Repository: vercel/next.js
Pull request: fix: error overlay not closing when backdrop clicked

The ref object wasn't passed to the hook; instead, ref.current (the value) was passed. This caused `useOnClickOutside` to be noop on initial render when ref.current was null, and only worked later because the component re-rendered with a different value. The fix ensures the hook always has access to the current DOM element whenever the effect runs.

### Before

https://github.com/user-attachments/assets/baa7ea6c-9506-4f14-8950-b4e7e7abbe61

### After

https://github.com/user-attachments/assets/18c3c569-ca30-41c3-ae92-f2d3e8fcee4c

Changed files:
filename: packages/next/src/next-devtools/dev-overlay/components/dialog/dialog.tsx
patch: @@ -37,8 +37,7 @@ const Dialog: React.FC<DialogProps> = function Dialog({
   )
 
   useOnClickOutside(
-    // eslint-disable-next-line react-hooks/refs -- TODO
-    dialogRef.current,
+    dialogRef,
     CSS_SELECTORS_TO_EXCLUDE_ON_CLICK_OUTSIDE,
     (e) => {
       e.preventDefault()

filename: packages/next/src/next-devtools/dev-overlay/hooks/use-on-click-outside.ts
patch: @@ -1,18 +1,20 @@
 import * as React from 'react'
 
 export function useOnClickOutside(
-  el: Node | null,
+  el: Node | React.RefObject<Node | null> | null,
   cssSelectorsToExclude: string[],
   handler: ((e: MouseEvent | TouchEvent) => void) | undefined
 ) {
   React.useEffect(() => {
-    if (el == null || handler == null) {
+    // Support both direct nodes and ref objects
+    const element = el && 'current' in el ? el.current : el
+    if (element == null || handler == null) {
       return
     }
 
     const listener = (e: MouseEvent | TouchEvent) => {
       // Do nothing if clicking ref's element or descendent elements
-      if (!el || el.contains(e.target as Element)) {
+      if (!element || element.contains(e.target as Element)) {
         return
       }
 
@@ -28,7 +30,7 @@ export function useOnClickOutside(
       handler(e)
     }
 
-    const root = el.getRootNode()
+    const root = element.getRootNode()
     root.addEventListener('mouseup', listener as EventListener)
     root.addEventListener('touchend', listener as EventListener, {
       passive: false,
Repository: ollama/ollama
Pull request: Add llm-ollama plugin for Datasette's LLM CLI to README

The Datasette project's LLM cli provides a common interface to a variety of LLM APIs and local LLMs. This PR adds a link to an Ollama plugin for that tool.

Changed files:
filename: README.md
patch: @@ -282,6 +282,7 @@ See the [API documentation](./docs/api.md) for all endpoints.
 - [gptel Emacs client](https://github.com/karthink/gptel)
 - [Oatmeal](https://github.com/dustinblackman/oatmeal)
 - [cmdh](https://github.com/pgibler/cmdh)
+- [llm-ollama](https://github.com/taketwo/llm-ollama) for [Datasette's LLM CLI](https://llm.datasette.io/en/stable/).
 
 ### Database
Repository: electron/electron
Pull request: test: fix desktopCapturer mocha syntax

Backport of #47088

See that PR for details.


Notes: none.

Changed files:
filename: spec/api-desktop-capturer-spec.ts
patch: @@ -99,7 +99,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
     expect(isEmpties.every(e => e === true)).to.be.true();
   });
 
-  it('getMediaSourceId should match DesktopCapturerSource.id', async () => {
+  it('getMediaSourceId should match DesktopCapturerSource.id', async function () {
     const w = new BrowserWindow({ show: false, width: 100, height: 100, webPreferences: { contextIsolation: false } });
     const wShown = once(w, 'show');
     const wFocused = once(w, 'focus');
@@ -119,7 +119,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
     // bots while it is not on my workstation, as expected, with and without
     // the --ci parameter.
     if (process.platform === 'linux' && sources.length === 0) {
-      it.skip('desktopCapturer.getSources returned an empty source list');
+      this.skip();
       return;
     }
 
@@ -130,7 +130,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
     expect(mediaSourceId).to.equal(foundSource!.id);
   });
 
-  it('getSources should not incorrectly duplicate window_id', async () => {
+  it('getSources should not incorrectly duplicate window_id', async function () {
     const w = new BrowserWindow({ show: false, width: 100, height: 100, webPreferences: { contextIsolation: false } });
     const wShown = once(w, 'show');
     const wFocused = once(w, 'focus');
@@ -155,7 +155,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
     // bots while it is not on my workstation, as expected, with and without
     // the --ci parameter.
     if (process.platform === 'linux' && sources.length === 0) {
-      it.skip('desktopCapturer.getSources returned an empty source list');
+      this.skip();
       return;
     }
 
@@ -180,7 +180,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
     expect(w.resizable).to.be.false();
   });
 
-  it('moveAbove should move the window at the requested place', async () => {
+  it('moveAbove should move the window at the requested place', async function () {
     // DesktopCapturer.getSources() is guaranteed to return in the correct
     // z-order from foreground to background.
     const MAX_WIN = 4;
@@ -225,7 +225,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
       // the --ci parameter.
       if (process.platform === 'linux' && sources.length === 0) {
         destroyWindows();
-        it.skip('desktopCapturer.getSources returned an empty source list');
+        this.skip();
         return;
       }
Repository: denoland/deno
Pull request: fix(io): ignore `BrokenPipe` error in `op_print`


Changed files:
filename: ext/io/lib.rs
patch: @@ -1199,9 +1199,11 @@ pub fn op_print(
 ) -> Result<(), JsErrorBox> {
   let rid = if is_err { 2 } else { 1 };
   FileResource::with_file(state, rid, move |file| {
-    file
-      .write_all_sync(msg.as_bytes())
-      .map_err(JsErrorBox::from_err)
+    match file.write_all_sync(msg.as_bytes()) {
+      Err(FsError::Io(io)) if io.kind() == ErrorKind::BrokenPipe => Ok(()),
+      other => other,
+    }
+    .map_err(JsErrorBox::from_err)
   })
 }
 

filename: tests/integration/run_tests.rs
patch: @@ -2481,7 +2481,7 @@ console.log("finish");
 }
 
 #[test]
-fn broken_stdout() {
+fn stdout_early_read_drop() {
   let (reader, writer) = os_pipe::pipe().unwrap();
   // drop the reader to create a broken pipe
   drop(reader);
@@ -2497,10 +2497,9 @@ fn broken_stdout() {
     .wait_with_output()
     .unwrap();
 
-  assert!(!output.status.success());
+  assert!(output.status.success());
   let stderr = std::str::from_utf8(output.stderr.as_ref()).unwrap().trim();
-  assert!(stderr.contains("Uncaught (in promise) BrokenPipe"));
-  assert!(!stderr.contains("panic"));
+  assert_eq!(stderr, "", "{:?}", stderr);
 }
 
 #[test]
Repository: ollama/ollama
Pull request: Clear previous images when submitting a new image to `ollama run`


Changed files:
filename: cmd/interactive.go
patch: @@ -496,6 +496,14 @@ func generateInteractive(cmd *cobra.Command, opts runOptions) error {
 				if err != nil {
 					return err
 				}
+
+				// clear all previous images for better responses
+				if len(images) > 0 {
+					for i := range opts.Messages {
+						opts.Messages[i].Images = nil
+					}
+				}
+
 				newMessage.Content = msg
 				newMessage.Images = images
 			}