@slopmachine/svelte 0.1.19 → 0.1.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slopmachine/svelte",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "llms": "https://slopmachine-dev.github.io/slopmachine-sdk/llms.txt",
5
5
  "llmsFull": "https://slopmachine-dev.github.io/slopmachine-sdk/llms-full.txt",
6
6
  "description": "The official Svelte SDK for Slop Machine",
@@ -19,7 +19,7 @@
19
19
  "url": "git+https://github.com/slopmachine-dev/slopmachine-sdk.git"
20
20
  },
21
21
  "dependencies": {
22
- "@slopmachine/core": "^0.1.16",
22
+ "@slopmachine/core": "^0.1.20",
23
23
  "@types/marked": "^5.0.2",
24
24
  "marked": "^17.0.4"
25
25
  },
@@ -15,7 +15,7 @@
15
15
  />
16
16
  ```
17
17
 
18
- @version 0.1.19
18
+ @version 0.1.21
19
19
  -->
20
20
  <script lang="ts">
21
21
  import {
@@ -57,7 +57,6 @@
57
57
  aspectRatio = "1:1",
58
58
  version,
59
59
  resultId,
60
- model,
61
60
  quality = "fast",
62
61
  variables = {},
63
62
  baseUrl = undefined,
@@ -78,7 +77,6 @@
78
77
  resultId,
79
78
  variables,
80
79
  baseUrl,
81
- model,
82
80
  quality,
83
81
  }),
84
82
  );
@@ -110,18 +108,21 @@
110
108
  fetch(src, { method: "HEAD", signal: abortController.signal })
111
109
  .then(async (res) => {
112
110
  if (!res.ok) {
113
- // console.error(`Failed to load image from ${src}. Status: ${res.status} ${res.statusText}`);
111
+ let errorMessage = res.statusText;
114
112
  try {
115
113
  const errRes = await fetch(src, {
116
114
  signal: abortController.signal,
117
115
  });
118
- const errJson = await errRes.json();
119
- console.error("SlopImage error:", res.status, errJson.error);
116
+ const errorData = await errRes.json();
117
+ if (errorData.error) {
118
+ errorMessage = errorData.error;
119
+ }
120
120
  } catch (e: any) {
121
121
  if (e.name !== "AbortError") {
122
122
  // Failed to fetch or parse error details
123
123
  }
124
124
  }
125
+ console.error("SlopImage error:", res.status, errorMessage);
125
126
  isLoading = false;
126
127
  }
127
128
  })
@@ -23,7 +23,7 @@
23
23
  * </SlopText>
24
24
  * ```
25
25
  *
26
- * @version 0.1.19
26
+ * @version 0.1.21
27
27
  */
28
28
  interface Props {
29
29
  // SlopTextOptions
@@ -70,14 +70,22 @@
70
70
  bucketId,
71
71
  version,
72
72
  resultId,
73
- model,
74
73
  variables,
75
74
  baseUrl,
76
75
  });
77
76
 
78
77
  const response = await fetch(url);
79
78
  if (!response.ok) {
80
- throw new Error(`Failed to fetch text: ${response.statusText}`);
79
+ let errorMessage = response.statusText;
80
+ try {
81
+ const errorData = await response.json();
82
+ if (errorData.error) {
83
+ errorMessage = errorData.error;
84
+ }
85
+ } catch (e) {
86
+ // Ignore JSON parse errors if the response isn't JSON
87
+ }
88
+ throw new Error(`Failed to fetch text: ${errorMessage}`);
81
89
  }
82
90
  const content = await response.text();
83
91
  if (isMounted) {
@@ -18,7 +18,7 @@
18
18
  />
19
19
  ```
20
20
 
21
- @version 0.1.19
21
+ @version 0.1.21
22
22
  -->
23
23
  <script lang="ts">
24
24
  import {
@@ -82,7 +82,6 @@
82
82
  variables,
83
83
  duration,
84
84
  baseUrl,
85
- model,
86
85
  quality,
87
86
  }),
88
87
  );
@@ -113,17 +112,21 @@
113
112
  fetch(src, { method: "HEAD", signal: abortController.signal })
114
113
  .then(async (res) => {
115
114
  if (!res.ok) {
115
+ let errorMessage = res.statusText;
116
116
  try {
117
117
  const errRes = await fetch(src, {
118
118
  signal: abortController.signal,
119
119
  });
120
- const errJson = await errRes.json();
121
- console.error("SlopVideo error:", res.status, errJson.error);
120
+ const errorData = await errRes.json();
121
+ if (errorData.error) {
122
+ errorMessage = errorData.error;
123
+ }
122
124
  } catch (e: any) {
123
125
  if (e.name !== "AbortError") {
124
126
  // Failed to fetch or parse error details
125
127
  }
126
128
  }
129
+ console.error("SlopVideo error:", res.status, errorMessage);
127
130
  isLoading = false;
128
131
  }
129
132
  })