Skip to content

Instantly share code, notes, and snippets.

@luochen1990
luochen1990 / journalctl.output
Created September 8, 2024 05:53
Open-WebUI bug report
9月 08 13:50:02 home-router open-webui[140332]: INFO [open_webui.apps.openai.main] get_all_models()
9月 08 13:50:08 home-router open-webui[140332]: ERROR [open_webui.apps.openai.main] Connection error:
9月 08 13:50:08 home-router open-webui[140332]: ERROR [open_webui.apps.openai.main] Connection error:
9月 08 13:50:08 home-router open-webui[140332]: ERROR [open_webui.apps.openai.main] Connection error:
9月 08 13:50:08 home-router open-webui[140332]: DEBUG [open_webui.apps.openai.main] get_all_models:responses() [None, None, None]
9月 08 13:50:08 home-router open-webui[140332]: DEBUG [open_webui.apps.openai.main] merge_models_lists <map object at 0x7f6cad8365c0>
9月 08 13:50:08 home-router open-webui[140332]: DEBUG [open_webui.apps.openai.main] models: {'data': []}
9月 08 13:50:08 home-router open-webui[140332]: INFO [open_webui.apps.openai.main] get_all_models()
9月 08 13:50:10 home-router open-webui[140332]: DEBUG [open_webui.main] Commit session after request
9月 08 13:50:10 home-router open-webui[140332]: INFO:
@luochen1990
luochen1990 / journalctl.log
Created September 6, 2024 04:53
open-webui error report
INFO: 10.40.10.1:0 - "POST /api/chat/completed HTTP/1.0" 500 Internal Server Error
ERROR: Exception in ASGI application
+ Exception Group Traceback (most recent call last):
| File "/nix/store/ivmgz1axqf7i0vr1pbm5r4i0hb01an0h-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/_utils.py", line 87, in collapse_excgroups
| yield
| File "/nix/store/ivmgz1axqf7i0vr1pbm5r4i0hb01an0h-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/base.py", line 190, in __call__
| async with anyio.create_task_group() as task_group:
| File "/nix/store/3vg8ys3dm90a5bi692x3f2hza11b670d-python3.12-anyio-4.3.0/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 678, in __aexit__
| raise BaseExceptionGroup(
| ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
@luochen1990
luochen1990 / Pylance_typing_issue_MRE.py
Created August 11, 2024 14:57
Pylance typing issue MRE
def f(x: int):
return x + 1
a: int = "abc"
f(a)
def g():
from collections import namedtuple
@luochen1990
luochen1990 / hello.py
Last active July 11, 2024 07:53
Demo for Nix as Shebang
#!/usr/bin/env nix-shell
#! nix-shell -p 'python3.withPackages (ps: with ps; [ msgspec ])' -i python3
import msgspec
print('hello')
@luochen1990
luochen1990 / merge_pdf.py
Created September 13, 2023 10:09
合并多个 pdf 文件
#!/usr/bin/env nix-shell
#!nix-shell -i python --packages python311 python311Packages.pypdf2
import PyPDF2
def merge_pdfs(input_path_list: list[str], output_path: str):
pdfWriter = PyPDF2.PdfWriter()
for input_path in input_path_list:
pdf1 = PyPDF2.PdfReader(open(input_path, "rb"))
@luochen1990
luochen1990 / settings.json
Created August 22, 2023 04:54
VSCode Python strict mode config
{
"files.trimTrailingWhitespace": true,
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "strict",
"python.analysis.diagnosticSeverityOverrides": {
"reportImportCycles": "warning",
"reportUnnecessaryComparison": "information",
"reportUnnecessaryIsInstance": "information",
"reportUnnecessaryContains": "information",
"reportUnusedImport": "information",
@luochen1990
luochen1990 / popo.nix
Last active October 19, 2022 05:47
(wip) netease popo
#NOTE: not working yet, need debuging
{pkgs ? import <nixpkgs> {}, ...}:
pkgs.stdenv.mkDerivation rec {
pname = "popo";
version = "3.56.1";
src = pkgs.fetchurl {
url = "https://popo.netease.com/file/popolinux/popo_${version}_amd64_ubuntu.deb";
@luochen1990
luochen1990 / flake.nix
Created July 7, 2022 14:42
An easy Haskell develop environment (useage: nix develop)
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
hpkgs = pkgs.haskell.packages.ghc923;
in rec {
@luochen1990
luochen1990 / nix-repl.expect
Last active May 30, 2022 13:49
A convient nix-repl to debug your nix flakes
#!/usr/bin/env nix-shell
#! nix-shell -p "expect" -i expect
#set timeout -1
cd ~/ws/nixos
spawn nix repl
send ":lf .\n"
@luochen1990
luochen1990 / venv-py37.nix
Last active November 4, 2024 13:35
Nix Script to simulate FHS environment with python3 & pip & venv
#!/usr/bin/env -S bash -c 'nix-shell --pure $0 -A env'
# Usage:
# 1. run directly to enter bash (inside venv): `./venv-py37.nix`
# 2. build a standalone executable: `nix bundle -f ./venv-py37.nix` #this not works yet since it cause nested `unshare -U` call
# 3. run bash with extra arguments: `nix run -f ./venv-py37.nix '' -- -c 'python --version'`
# More:
# 1. commit id of nixpkgs can be found here: https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=python3
let