Skip to content

Instantly share code, notes, and snippets.

View luojiyin1987's full-sized avatar
💭
I may be slow to respond.

luo jiyin luojiyin1987

💭
I may be slow to respond.
View GitHub Profile
#include "PainterEngine.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <immintrin.h>
#define ALPHABET_SIZE 256
#define MAX_PATTERN_LEN 1024

PostgreSQL 数据库增加 vector 结构并实现 RAG (Retrieval Augmented Generation) 搜索,主要依赖于 PostgreSQL 的扩展能力,特别是 pgvector 扩展。pgvector 扩展为 PostgreSQL 提供了存储和操作向量数据类型的功能,并支持向量相似度搜索。

下面是实现这一目标的详细步骤和说明:

1. 安装 pgvector 扩展

这是实现向量存储和搜索的基础。

  • 前提条件: 你需要一个运行中的 PostgreSQL 数据库实例,并且有权限安装扩展。
  • 安装步骤:
@luojiyin1987
luojiyin1987 / configuration.nix
Created May 8, 2025 05:12 — forked from hemashushu/configuration.nix
NixOS configuration reference 2025-05
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, lib, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix

powershell 需要管理员权限运行
安装几个npm 包 prebuild-install dotenv electron-notarize
系统需要安装 7z, 来执行解压下载文件
electron-builder.yml 中改为 publish: null ,更多细节问题问题要看文档
编译命令改完 pnpm package:electron --publish never

PS C:\Users\luo\dev\refly\apps\api> pnpm package:electron --publish never

> @refly/[email protected] package:electron C:\Users\luo\dev\refly\apps\api
> electron-builder build --config electron-builder.yml "--publish" "never"

先做简单的, 性能提升明显的事 ?

以下是几个简单实施但效果明显的性能优化措施,按照优先级排序:

  1. 窗口加载优化
function createBrowserWindow() {
  win = new BrowserWindow({
    // 其他配置...
@luojiyin1987
luojiyin1987 / pnpm-dev:electron-log.md
Created April 29, 2025 12:22
pnpm dev:electron add redis-server qdrant log

qdrant 需要 musl 版, 避免打包运行出现 ./qdrant: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.38' not found` 报错

api git:(fix/electron-dev) ✗ pnpm dev:electron 

> @refly/[email protected] dev:electron /home/luo/nodeWork/refly/apps/api
> nodemon --config nodemon.electron.json

[nodemon] 3.1.7
[nodemon] to restart at any time, enter `rs`
pnpm build:electron
> @refly/[email protected] build:electron /home/luo/nodeWork/refly/apps/api
> pnpm gen-sqlite-schema && prisma generate --schema=prisma/sqlite-schema.prisma && tsc --build tsconfig.electron.json && ncp src/generated dist-electron/generated
> @refly/[email protected] gen-sqlite-schema /home/luo/nodeWork/refly/apps/api
> ts-node src/scripts/gen-sqlite-schema.ts
Synchronizing Prisma schema to SQLite schema...
refly git:(main) ✗ pnpm dev:electron
 WARN  This project is configured to use v8.15.8 of pnpm. Your current pnpm is v9.1.2
> refly-monorepo@ dev:electron /home/luo/nodeWork/refly
> turbo run dev:electron --filter=@refly/api
turbo 2.1.2
• Packages in scope: @refly/api
• Running dev:electron in 1 packages
pnpm dev
> refly-monorepo@ dev /home/dev/pythonWork/refly
> turbo run dev
turbo 2.1.2
• Packages in scope: @refly/ai-workspace-common, @refly/api, @refly/common-types, @refly/errors, @refly/extension, @refly/i18n, @refly/openapi-schema, @refly/skill-template, @refly/utils, @refly/web, tsconfig, wxt
• Running dev in 12 packages
• Remote caching disabled
pnpm build:web
> refly-monorepo@ build:web /home/dev/pythonWork/refly
> turbo run build --filter=@refly/web
turbo 2.1.2
• Packages in scope: @refly/web
• Running build in 1 packages
• Remote caching disabled