刚了解下langchain,简单写个 AI助手的langchain版本 Code 安装依赖 pip install langchain langchain-community pyjwt python-dotenv 申请大模型帐号 到这里申请一个智谱AI的帐号,注册就
国内镜像 https://hf-mirror.com/ 具体步骤 创建conda环境,如果不记得,可以参考这里 conda create --name hfd python=3.12.5 conda activate hfd conda install huggingface_hub export HF_ENDPOINT=https://hf-mirror.com # bash $env:HF_ENDPOINT = "https://hf-mirror.com" # pwsh huggingface-cli download --resume-download gpt2 --local-dir gpt2 # 下载模型,gpt2为模型
gpt4free pip install g4f code from typing import List, Any import sys from g4f.client import Client import asyncio if sys.platform == "win32": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) def fetch_ai(client: Client, messages: List[Any]) -> str: chunks = [] print("AI: ", end="") stream = client.chat.completions.create( model="gpt-4", messages=messages, stream=True, ) for msg in stream: chunk = msg.choices[0].delta.content if chunk: chunks.append(chunk) print(chunk, end="", flush=True) else: print("") return "".join(chunks) def main(): client = Client() print
git仓库准备 下载我的博客最新版 解压后,到代码根目录执行 git init 删除 themes/LoveIt 文件夹 git submodule add https://github.com/dillonzq/LoveIt.git themes/LoveIt 删除 content/posts 中的所有子文件和子文件夹,但要保留 content/posts 文件 修改 conf
fnm env --use-on-cd | Out-String | Invoke-Expression fnm completions --shell power-shell | Out-String | Invoke-Expression $env:FNM_NODE_DIST_MIRROR="https://npmmirror.com/dist"
conda 使用指南 miniconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda 更改仓库地址: https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/ conda init conda config --set auto_activate_base false 环境管理 conda create --name myenv python=3.9 conda activate myenv conda deactivate conda env list conda remove --name myenv --all 包管理 conda install requests conda list conda update requests conda update all conda list --explicit > a.txt conda install --file a.txt
命令行切换到 system 用户 Windows上默认gitlab-runner是以 system 用户运行的,如果要更改 ci 的运行配置,那就必须要以 system 用户来完成这些设置。
Toga 是一个跨平台的Python GUI库, 支持Android和iOS,有一些简单的控件。它不像kivy那么复杂,kivy要求我们去学习 一种新的脚
下面这个代码是无法编译通过的 class A { public: A(val) : val{val} {} static constexpr A a1{0}; private: int val; }; 不过稍加修改就可以了,参考这里 7.1.5p9 The constexpr specifier [dcl.constexpr] (n3337) A constexpr specifier used in an object declaration declares the object as const. Such an object shall have literal
cargo add 确实挺好用,但是某个crate到底有多少个feature呢,经常连文档都说得不是很清楚。 幸好我们有 cargo feature 可以列出某个crate的所有fea
rust默认的release版仍然挺大的,其实还有改进空间,这里有介绍, 这里有官方文档。简单来说可以在cargo.toml中添加以下内容 strip =
Elm 之前在了解rust的ui时,碰巧了解到了Elm,yew和iced都说参考了它, 而它也标榜自己是 A delightful language for reliable web applications. 昨天终于还是没有忍住,在空闲的
编译安装 说到加密,首先想到的当然是 openssl,但是当我想用mingw64的clang++编译时,发现还需要perl,下载perl发现还是
一般的编译成release之后,找个地方一扔就可以运行了。但是有些时候,我们需要在用户机器上执行个脚本, 然后还要创建几个快捷方式。搞一个安装
说到用Python监控文件夹的变化,大家都是推荐 watchdog, 但是我发现这个工具有的时候会误报,我这里误报之后会执行编译,影响比较大。 然
Portable Python 从这里下载 embeddable package, 解压之后,第一个问题就是没有pip, 需要下载 get-pip.py 并执行。执行后,虽然pip正确安装到了Scripts文件夹中,
Qt程序cmake编译出来,运行时会弹出控制台窗口,有人说这样 add_executable(TargetName WIN32 main.cpp) 就不会有。但是好像没有什么作用。 这个方法是可以的, target_link_options(TargetName PRIVATE -mwindows)
当需要把python的脚本生成一个exe时,一般都是用pyinstaller或py2exe,但是我这个需求没有那个必要, 因为我是把pytho
调试时,简单的http服务,以前一直使用 python -m http.server 但是有些脚本需要cors头, python默认就不行了,还得自己写。不过,幸好还有rust的si
c++ std::filesystem::last_write_time 会返回文件的最后修改时,但是这个时间要怎么用呢, 不好意思,cppref 并没有给出。 有问题还得找 stackoverflow, 也不知道c++