Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SDK Update -> 0.9.1#964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
SilasMarvin merged 4 commits intomasterfromsilas-0.9.1
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Updated to work with webpack
  • Loading branch information
@SilasMarvin
SilasMarvin committedAug 30, 2023
commitfde5cdec4b3b3e84513ea6c830069c22eea3aa9c
5 changes: 1 addition & 4 deletions.github/workflows/javascript-sdk.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,14 +34,11 @@ jobs:
run: |
npm i
npm run build-release
mv index.node ${{ matrix.neon-out-name }}
- name: Display output files
run: ls -R
- name: Upload built .node file
uses: actions/upload-artifact@v3
with:
name: node-artifacts
path: pgml-sdks/rust/pgml/javascript/${{ matrix.neon-out-name }}
path: pgml-sdks/rust/pgml/javascript/dist/${{ matrix.neon-out-name }}
retention-days: 1
# publish-javascript-sdk:
# needs: build-javascript-sdk
Expand Down
2 changes: 1 addition & 1 deletionpgml-sdks/pgml/Cargo.lock
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

48 changes: 48 additions & 0 deletionspgml-sdks/pgml/javascript/build.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
const os = require("os");
const { exec } = require("node:child_process");

const type = os.type();
const arch = os.arch();

const set_name = (type, arch) => {
if (type == "Darwin" && arch == "x64") {
return "x86_64-apple-darwin-index.node";
} else if (type == "Darwin" && arch == "arm64") {
return "aarch64-apple-darwin-index.node";
} else if ((type == "Windows" || type == "Windows_NT") && arch == "x64") {
return "x86_64-pc-windows-gnu-index.node";
} else if (type == "Linux" && arch == "x64") {
return "x86_64-unknown-linux-gnu-index.node";
} else if (type == "Linux" && arch == "arm64") {
return "aarch64-unknown-linux-gnu-index.node";
} else {
console.log("UNSUPPORTED TYPE OR ARCH:", type, arch);
process.exit(1);
}
};

let name = set_name(type, arch);

let args = process.argv.slice(2);
let release = args.includes("--release");

let shell_args =
type == "Windows" || type == "Windows_NT" ? { shell: "powershell.exe" } : {};

exec(
`
rm -r dist;
mkdir dist;
npx cargo-cp-artifact -nc "${name}" -- cargo build --message-format=json-render-diagnostics -F javascript ${release ? "--release" : ""};
mv ${name} dist;
`,
shell_args,
(err, stdout, stderr) => {
if (err) {
console.log("ERR:", err);
} else {
console.log("STDOUT:", stdout);
console.log("STDERR:", stderr);
}
},
);
38 changes: 17 additions & 21 deletionspgml-sdks/pgml/javascript/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,26 +3,22 @@ const os = require("os")
const type = os.type()
const arch = os.arch()

try {
const pgml = require("./index.node")
if (type == "Darwin" && arch == "x64") {
const pgml = require("./dist/x86_64-apple-darwin-index.node")
module.exports = pgml
} catch (e) {
if (type == "Darwin" && arch == "x64") {
const pgml = require("./dist/x86_64-apple-darwin-index.node")
module.exports = pgml
} else if (type == "Darwin" && arch == "arm64") {
const pgml = require("./dist/aarch64-apple-darwin-index.node")
module.exports = pgml
} else if (type == "Windows" && arch == "x64") {
const pgml = require("./dist/x86_64-pc-windows-gnu-index.node")
module.exports = pgml
} else if (type == "Linux" && arch == "x64") {
const pgml = require("./dist/x86_64-unknown-linux-gnu-index.node")
module.exports = pgml
} else if (type == "Linux" && arch == "arm64") {
const pgml = require("./dist/aarch64-unknown-linux-gnu-index.node")
module.exports = pgml
} else {
console.log("UNSUPPORTED TYPE OR ARCH:", type, arch)
}
} else if (type == "Darwin" && arch == "arm64") {
const pgml = require("./dist/aarch64-apple-darwin-index.node")
module.exports = pgml
} else if ((type == "Windows" || type == "Windows_NT") && arch == "x64") {
const pgml = require("./dist/x86_64-pc-windows-gnu-index.node")
module.exports = pgml
} else if (type == "Linux" && arch == "x64") {
const pgml = require("./dist/x86_64-unknown-linux-gnu-index.node")
module.exports = pgml
} else if (type == "Linux" && arch == "arm64") {
const pgml = require("./dist/aarch64-unknown-linux-gnu-index.node")
module.exports = pgml
} else {
console.log("UNSUPPORTED TYPE OR ARCH:", type, arch)
process.exit(1);
}
12 changes: 8 additions & 4 deletionspgml-sdks/pgml/javascript/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,12 +2,16 @@
"name": "pgml",
"version": "0.9.1",
"description": "Open Source Alternative for Building End-to-End Vector Search Applications without OpenAI & Pinecone",
"keywords": ["postgres", "machine learning", "vector databases", "embeddings"],
"keywords": [
"postgres",
"machine learning",
"vector databases",
"embeddings"
],
"main": "index.js",
"scripts": {
"build": "cargo-cp-artifact -nc index.node -- cargo build --message-format=json-render-diagnostics -F javascript",
"build-debug": "npm run build --",
"build-release": "npm run build -- --release"
"build": "node build.js",
"build-release": "node build.js --release"
},
"author": {
"name": "PostgresML",
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp