@windrun-huaiin/third-ui 5.6.1 → 5.7.0

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.
@@ -3080,22 +3080,28 @@ function LLMCopyButton({ llmApiUrl } = {}) {
3080
3080
  const locale = params.locale;
3081
3081
  const slug = params.slug;
3082
3082
  const [checked, onClick] = useCopyButton(() => __async(null, null, function* () {
3083
- var _a;
3084
3083
  setLoading(true);
3085
3084
  const path = slug && Array.isArray(slug) ? slug.join("/") : "";
3086
3085
  const apiPrefix = llmApiUrl || "/api/llm-content";
3087
3086
  const apiUrl = `${apiPrefix}?locale=${encodeURIComponent(locale)}&path=${encodeURIComponent(path)}`;
3088
3087
  console.log("Fetching LLM content from:", apiUrl);
3088
+ let content;
3089
3089
  try {
3090
- const content = (_a = cache.get(apiUrl)) != null ? _a : yield fetch(apiUrl).then((res) => {
3090
+ if (cache.has(apiUrl)) {
3091
+ content = cache.get(apiUrl);
3092
+ } else {
3093
+ const res = yield fetch(apiUrl);
3091
3094
  if (!res.ok) {
3092
- throw new Error(`Failed to fetch LLM content: ${res.status} ${res.statusText}`);
3095
+ content = `Error: Failed to fetch LLM content: ${res.status} ${res.statusText}`;
3096
+ } else {
3097
+ content = yield res.text();
3098
+ cache.set(apiUrl, content);
3093
3099
  }
3094
- return res.text();
3095
- });
3096
- cache.set(apiUrl, content);
3100
+ }
3097
3101
  yield navigator.clipboard.writeText(content);
3098
3102
  } catch (error) {
3103
+ const errMsg = `Error: ${error instanceof Error ? error.message : String(error)}`;
3104
+ yield navigator.clipboard.writeText(errMsg);
3099
3105
  console.error("Error fetching or copying LLM content:", error);
3100
3106
  } finally {
3101
3107
  setLoading(false);
@@ -3408,11 +3414,11 @@ function ZiaFolder(_a) {
3408
3414
 
3409
3415
  // src/fuma/mdx/toc-footer-wrapper.tsx
3410
3416
  import { jsx as jsx46, jsxs as jsxs18 } from "react/jsx-runtime";
3411
- function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, showCopy }) {
3417
+ function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }) {
3412
3418
  const showEdit = githubBaseUrl && editPath;
3413
3419
  return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-y-2 items-start m-4", children: [
3414
3420
  /* @__PURE__ */ jsx46(LastUpdatedDate, { date: lastModified }),
3415
- showCopy && /* @__PURE__ */ jsx46(LLMCopyButton, {}),
3421
+ copyButtonComponent,
3416
3422
  showEdit && /* @__PURE__ */ jsx46(EditOnGitHub, { url: `${githubBaseUrl}${editPath}` })
3417
3423
  ] });
3418
3424
  }