@shenghuabi/llama 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -13,9 +13,6 @@ import { InjectionToken } from "static-injector";
13
13
  var LLamaConfigToken = new InjectionToken(
14
14
  "LLamaConfig"
15
15
  );
16
- var OLLAMA_MODEL_URL_TOKEN = new InjectionToken(
17
- "OLLAMA_MODEL_URL"
18
- );
19
16
 
20
17
  // packages/llama/llama-swap.service.ts
21
18
  import * as v7 from "valibot";
@@ -2607,45 +2604,7 @@ async function readDir2(dir, level) {
2607
2604
 
2608
2605
  // packages/llama/llama-swap.service.ts
2609
2606
  import { dirname } from "path";
2610
-
2611
- // packages/llama/download/get-ollama-gguf-file.ts
2612
- function getDownloadFileName(name) {
2613
- return name;
2614
- }
2615
- async function getOllamaGgufFile(name, options) {
2616
- name = name.includes("/") ? name : `library/${name}`;
2617
- const resultUrl = parseName(name);
2618
- const endpoint = resultUrl.endpoint ?? `https://${options.endpoint}/`;
2619
- const hff = `${resultUrl.namespace}/${resultUrl.repo}`;
2620
- const result = await getModelManifest(name, {
2621
- ...options,
2622
- endpoint
2623
- });
2624
- const rfilename = result.layers.find(
2625
- (item) => item.mediaType === `application/vnd.ollama.image.model`
2626
- ).digest;
2627
- const result2 = getDownloadFileName(rfilename);
2628
- const fileList = [`${endpoint}v2/${hff}/blobs/${result2}`];
2629
- return {
2630
- fileList,
2631
- fileName: `ollama-${name}`.replace(/\/|:/g, "-")
2632
- };
2633
- }
2634
-
2635
- // packages/llama/llama-swap.service.ts
2636
2607
  import { differenceBy } from "es-toolkit";
2637
-
2638
- // packages/llama/download/auto-check-vendor.ts
2639
- async function autoCheckVendor(repo, options) {
2640
- try {
2641
- await getModelManifest(repo, options);
2642
- return void 0;
2643
- } catch (error) {
2644
- }
2645
- return "ollama";
2646
- }
2647
-
2648
- // packages/llama/llama-swap.service.ts
2649
2608
  var SysMap2 = { win32: "win", linux: "ubuntu" };
2650
2609
  var LlamaPlatform2 = SysMap2[process.platform];
2651
2610
  var remoteArgs = ["hf-repo", "hf-file", "model-url"];
@@ -2664,7 +2623,6 @@ var LlamaSwapService = class extends ExternalCallBaseService {
2664
2623
  return fullPath;
2665
2624
  });
2666
2625
  llamaSwapDir$$ = computed(() => path3.join(this.#config().dir, "llama-swap"));
2667
- #ollamaModelUrl$$ = inject(OLLAMA_MODEL_URL_TOKEN);
2668
2626
  #hgModelUrl$$ = inject(HUGGINGFACE_URL_TOKEN);
2669
2627
  #downloadConfig$$ = inject(DownloadConfigToken);
2670
2628
  #hgtoken$$ = inject(HUGGINGFACE_TOKEN_TOKEN);
@@ -2885,18 +2843,11 @@ var LlamaSwapService = class extends ExternalCallBaseService {
2885
2843
  let directory;
2886
2844
  const dir = path3.join(this.#config().dir, "models");
2887
2845
  if (modelOptions.repo) {
2888
- if (modelOptions.vendor) {
2889
- this.log?.info("使用厂商:", modelOptions.vendor);
2890
- }
2891
- const resolveResult = await (modelOptions.vendor === "ollama" ? getOllamaGgufFile(modelOptions.repo, {
2892
- ...modelOptions,
2893
- endpoint: this.#ollamaModelUrl$$(),
2894
- token: modelOptions.token || this.#hgtoken$$()
2895
- }) : getGgufFile(modelOptions.repo, {
2846
+ const resolveResult = await getGgufFile(modelOptions.repo, {
2896
2847
  ...modelOptions,
2897
2848
  endpoint: this.#hgModelUrl$$(),
2898
2849
  token: modelOptions.token || this.#hgtoken$$()
2899
- }));
2850
+ });
2900
2851
  this.log?.info("模型文件:", resolveResult);
2901
2852
  const filePath = path3.join(dir, resolveResult.fileName);
2902
2853
  if (fs2.existsSync(filePath)) {
@@ -2950,14 +2901,9 @@ var LlamaSwapService = class extends ExternalCallBaseService {
2950
2901
  );
2951
2902
  }
2952
2903
  async createModelConfig(model, options) {
2953
- const vendor = await autoCheckVendor(model, {
2954
- endpoint: `https://${this.#hgModelUrl$$()}/`,
2955
- token: this.#hgtoken$$()
2956
- });
2957
2904
  const downloadFilePath = await this.downloadModel(
2958
2905
  {
2959
- repo: model,
2960
- vendor
2906
+ repo: model
2961
2907
  },
2962
2908
  options
2963
2909
  );
@@ -3029,7 +2975,6 @@ export {
3029
2975
  LlamaServerDefine,
3030
2976
  LlamaServerSwapItemDefine,
3031
2977
  LlamaSwapService,
3032
- OLLAMA_MODEL_URL_TOKEN,
3033
2978
  SamplingDefine
3034
2979
  };
3035
2980
  //# sourceMappingURL=index.mjs.map