Compare commits
2 Commits
79137b7f62
...
a62ffc0089
| Author | SHA1 | Date | |
|---|---|---|---|
| a62ffc0089 | |||
| d5942d9fb0 |
@@ -1,31 +0,0 @@
|
||||
# This patch modifies the json-schema-to-grammar.cpp file to handle 'not: {}' constructs
|
||||
# specifically inside additionalProperties.
|
||||
#
|
||||
# Author: https://github.com/evanreichard
|
||||
|
||||
diff --git a/common/json-schema-to-grammar.cpp b/common/json-schema-to-grammar.cpp
|
||||
index c3b4e5d..ea24bc3 100644
|
||||
--- a/common/json-schema-to-grammar.cpp
|
||||
+++ b/common/json-schema-to-grammar.cpp
|
||||
@@ -858,10 +858,19 @@ public:
|
||||
properties.emplace_back(prop.key(), prop.value());
|
||||
}
|
||||
}
|
||||
+ json additionalProps = schema.contains("additionalProperties") ? schema["additionalProperties"] : json();
|
||||
+ if (additionalProps.is_object() && additionalProps.contains("not")) {
|
||||
+ const auto& not_val = additionalProps["not"];
|
||||
+ if (not_val.is_object() && not_val.empty()) {
|
||||
+ additionalProps.erase("not");
|
||||
+ if (additionalProps.empty()) {
|
||||
+ additionalProps = false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
return _add_rule(rule_name,
|
||||
_build_object_rule(
|
||||
- properties, required, name,
|
||||
- schema.contains("additionalProperties") ? schema["additionalProperties"] : json()));
|
||||
+ properties, required, name, additionalProps));
|
||||
} else if ((schema_type.is_null() || schema_type == "object" || schema_type == "string") && schema.contains("allOf")) {
|
||||
std::unordered_set<std::string> required;
|
||||
std::vector<std::pair<std::string, json>> properties;
|
||||
@@ -7,12 +7,12 @@
|
||||
vulkanSupport = true;
|
||||
}).overrideAttrs
|
||||
(oldAttrs: rec {
|
||||
version = "8229";
|
||||
version = "8680";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "ggml-org";
|
||||
repo = "llama.cpp";
|
||||
tag = "b${version}";
|
||||
hash = "sha256-SmCNsQfLQMmwa8PzFPaQb9yBdUZTxM8xxSqhumVGvHM=";
|
||||
hash = "sha256-tJCA19BQs0vZc0VjPnbIrh3CJFxyPL6Ne4oIG4gfozw=";
|
||||
leaveDotGit = true;
|
||||
postFetch = ''
|
||||
git -C "$out" rev-parse --short HEAD > $out/COMMIT
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# This patch modifies the json-schema-to-grammar.cpp file to handle 'not: {}' constructs.
|
||||
#
|
||||
# Author: https://github.com/simaotwx
|
||||
# Reference: https://github.com/ggml-org/llama.cpp/issues/14227#issuecomment-3547740835
|
||||
|
||||
diff --git a/common/json-schema-to-grammar.cpp b/common/json-schema-to-grammar.cpp
|
||||
index 478aa1be7..ec0b3b73e 100644
|
||||
--- a/common/json-schema-to-grammar.cpp
|
||||
+++ b/common/json-schema-to-grammar.cpp
|
||||
@@ -822,7 +822,17 @@ public:
|
||||
return _add_rule(rule_name, _resolve_ref(schema["$ref"]));
|
||||
} else if (schema.contains("oneOf") || schema.contains("anyOf")) {
|
||||
std::vector<json> alt_schemas = schema.contains("oneOf") ? schema["oneOf"].get<std::vector<json>>() : schema["anyOf"].get<std::vector<json>>();
|
||||
- return _add_rule(rule_name, _generate_union_rule(name, alt_schemas));
|
||||
+ std::vector<json> filtered_schemas;
|
||||
+ for (const auto& alt : alt_schemas) {
|
||||
+ if (alt.is_object() && alt.contains("not")) {
|
||||
+ const auto& not_val = alt["not"];
|
||||
+ if (not_val.is_object() && not_val.empty()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ filtered_schemas.push_back(alt);
|
||||
+ }
|
||||
+ return _add_rule(rule_name, _generate_union_rule(name, filtered_schemas));
|
||||
} else if (schema_type.is_array()) {
|
||||
std::vector<json> schema_types;
|
||||
for (const auto & t : schema_type) {
|
||||
@@ -5,6 +5,7 @@
|
||||
, versionCheckHook
|
||||
, callPackage
|
||||
, nixosTests
|
||||
, nix-update-script
|
||||
,
|
||||
}:
|
||||
|
||||
@@ -13,13 +14,18 @@ let
|
||||
in
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "llama-swap";
|
||||
version = "197";
|
||||
version = "199";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"wol" # wake on lan proxy
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mostlygeek";
|
||||
repo = "llama-swap";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-EXgyYmpbN/zzr6KeSpvFEB+FS7gDIZFinNMv70v5boY=";
|
||||
hash = "sha256-tAWXhfOWPLBuEgd+32CbuIkn1hN+4VI4xkyx7E2a81I=";
|
||||
# populate values that require us to use git. By doing this in postFetch we
|
||||
# can delete .git afterwards and maintain better reproducibility of the src.
|
||||
leaveDotGit = true;
|
||||
@@ -35,7 +41,6 @@ buildGoModule (finalAttrs: {
|
||||
vendorHash = "sha256-XiDYlw/byu8CWvg4KSPC7m8PGCZXtp08Y1velx4BR8U=";
|
||||
|
||||
passthru.ui = callPackage ./ui.nix { llama-swap = finalAttrs.finalPackage; };
|
||||
passthru.npmDepsHash = "sha256-Fs7+JKE8YBp2Xj8bVBlwmT+UwuD642VeUHiPx+fv94c=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
versionCheckHook
|
||||
@@ -73,8 +78,8 @@ buildGoModule (finalAttrs: {
|
||||
|
||||
checkFlags =
|
||||
let
|
||||
skippedTests = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
||||
# Fail only on x86_64-darwin intermittently
|
||||
skippedTests = lib.optionals (stdenv.isDarwin) [
|
||||
# Fail only on *-darwin intermittently
|
||||
# https://github.com/mostlygeek/llama-swap/issues/320
|
||||
"TestProcess_AutomaticallyStartsUpstream"
|
||||
"TestProcess_WaitOnMultipleStarts"
|
||||
@@ -90,6 +95,7 @@ buildGoModule (finalAttrs: {
|
||||
"TestProcess_ForceStopWithKill"
|
||||
"TestProcess_StopCmd"
|
||||
"TestProcess_EnvironmentSetCorrectly"
|
||||
"TestProcess_ReverseProxyPanicIsHandled"
|
||||
];
|
||||
in
|
||||
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
|
||||
@@ -105,14 +111,22 @@ buildGoModule (finalAttrs: {
|
||||
rm "$GOPATH/bin/simple-responder"
|
||||
'';
|
||||
|
||||
preInstall = ''
|
||||
postInstall = ''
|
||||
install -Dm444 -t "$out/share/llama-swap" config.example.yaml
|
||||
mkdir -p "$wol/bin"
|
||||
mv "$out/bin/wol-proxy" "$wol/bin/"
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
versionCheckProgramArg = "-version";
|
||||
|
||||
passthru.tests.nixos = nixosTests.llama-swap;
|
||||
passthru.updateScript = nix-update-script {
|
||||
extraArgs = [
|
||||
"--subpackage"
|
||||
"ui"
|
||||
];
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/mostlygeek/llama-swap";
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
buildNpmPackage (finalAttrs: {
|
||||
pname = "${llama-swap.pname}-ui";
|
||||
inherit (llama-swap) version src npmDepsHash;
|
||||
inherit (llama-swap) version src;
|
||||
npmDepsHash = "sha256-gTDsuWPLCWsPltioziygFmSQFdLqjkZpmmVWIWoZwoc=";
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace vite.config.ts \
|
||||
|
||||
Reference in New Issue
Block a user