@enslo/sd-metadata 1.6.0 → 1.6.1

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/README.ja.md CHANGED
@@ -149,7 +149,7 @@ if (result.status === 'success') {
149
149
  > 本番環境では `@latest` の代わりに特定のバージョンを指定してください:
150
150
  >
151
151
  > ```text
152
- > https://cdn.jsdelivr.net/npm/@enslo/sd-metadata@1.6.0/dist/index.js
152
+ > https://cdn.jsdelivr.net/npm/@enslo/sd-metadata@1.6.1/dist/index.js
153
153
  > ```
154
154
 
155
155
  ### 応用例
package/README.md CHANGED
@@ -148,7 +148,7 @@ if (result.status === 'success') {
148
148
  > For production use, pin to a specific version instead of `@latest`:
149
149
  >
150
150
  > ```text
151
- > https://cdn.jsdelivr.net/npm/@enslo/sd-metadata@1.6.0/dist/index.js
151
+ > https://cdn.jsdelivr.net/npm/@enslo/sd-metadata@1.6.1/dist/index.js
152
152
  > ```
153
153
 
154
154
  ### Advanced Examples
package/dist/index.js CHANGED
@@ -507,6 +507,9 @@ function detectComfyUIEntries(entryRecord) {
507
507
  if (promptText.includes(MARKERS.SWARMUI)) {
508
508
  return "swarmui";
509
509
  }
510
+ if (promptText.includes(`"${MARKERS.CIVITAI_EXTRA}"`)) {
511
+ return "civitai";
512
+ }
510
513
  if (promptText.includes(MARKERS.COMFYUI_NODE)) {
511
514
  return "comfyui";
512
515
  }
@@ -1904,7 +1907,6 @@ function convertA1111SegmentsToPng(segments) {
1904
1907
  }
1905
1908
 
1906
1909
  // src/converters/civitai.ts
1907
- var CIVITAI_SPECIAL_KEYS = ["extra", "extraMetadata", "resource-stack"];
1908
1910
  function convertCivitaiPngToSegments(chunks) {
1909
1911
  const parametersChunk = chunks.find((c) => c.keyword === "parameters");
1910
1912
  if (parametersChunk && !parametersChunk.text.trimStart().startsWith("{")) {
@@ -1938,32 +1940,7 @@ function convertCivitaiSegmentsToPng(segments) {
1938
1940
  if (!isJson) {
1939
1941
  return convertA1111SegmentsToPng(segments);
1940
1942
  }
1941
- const parsed = parseJson(userComment.data);
1942
- if (!parsed.ok) {
1943
- return convertA1111SegmentsToPng(segments);
1944
- }
1945
- const data = parsed.value;
1946
- const promptData = {};
1947
- const chunks = [];
1948
- for (const [key, value] of Object.entries(data)) {
1949
- if (CIVITAI_SPECIAL_KEYS.includes(key)) {
1950
- chunks.push(
1951
- ...createEncodedChunk(key, stringify(value), "text-utf8-raw")
1952
- );
1953
- } else {
1954
- promptData[key] = value;
1955
- }
1956
- }
1957
- if (Object.keys(promptData).length > 0) {
1958
- chunks.unshift(
1959
- ...createEncodedChunk(
1960
- "prompt",
1961
- JSON.stringify(promptData),
1962
- "text-utf8-raw"
1963
- )
1964
- );
1965
- }
1966
- return chunks;
1943
+ return createEncodedChunk("prompt", userComment.data, "text-utf8-raw");
1967
1944
  }
1968
1945
 
1969
1946
  // src/converters/base-json.ts