strapi-plugin-ai-sdk 0.6.3 → 0.6.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.
@@ -2044,18 +2044,18 @@ function createPublicTools(strapi, allowedContentTypes) {
2044
2044
  const allowed = new Set(allowedContentTypes);
2045
2045
  const tools = {};
2046
2046
  for (const [name, def] of registry.getPublicSafe()) {
2047
- if (CONTENT_TOOLS.has(name) && allowed.size > 0) {
2047
+ if (CONTENT_TOOLS.has(name)) {
2048
2048
  tools[name] = ai.tool({
2049
2049
  description: def.description,
2050
2050
  inputSchema: ai.zodSchema(def.schema),
2051
2051
  execute: async (args) => {
2052
- if (args.contentType && !allowed.has(args.contentType)) {
2052
+ if (!args.contentType || !allowed.has(args.contentType)) {
2053
2053
  return { error: `Content type "${args.contentType}" is not available in public chat.` };
2054
2054
  }
2055
2055
  return def.execute(args, strapi);
2056
2056
  }
2057
2057
  });
2058
- } else if (name === "listContentTypes" && allowed.size > 0) {
2058
+ } else if (name === "listContentTypes") {
2059
2059
  tools[name] = ai.tool({
2060
2060
  description: def.description,
2061
2061
  inputSchema: ai.zodSchema(def.schema),
@@ -2024,18 +2024,18 @@ function createPublicTools(strapi, allowedContentTypes) {
2024
2024
  const allowed = new Set(allowedContentTypes);
2025
2025
  const tools = {};
2026
2026
  for (const [name, def] of registry.getPublicSafe()) {
2027
- if (CONTENT_TOOLS.has(name) && allowed.size > 0) {
2027
+ if (CONTENT_TOOLS.has(name)) {
2028
2028
  tools[name] = tool({
2029
2029
  description: def.description,
2030
2030
  inputSchema: zodSchema(def.schema),
2031
2031
  execute: async (args) => {
2032
- if (args.contentType && !allowed.has(args.contentType)) {
2032
+ if (!args.contentType || !allowed.has(args.contentType)) {
2033
2033
  return { error: `Content type "${args.contentType}" is not available in public chat.` };
2034
2034
  }
2035
2035
  return def.execute(args, strapi);
2036
2036
  }
2037
2037
  });
2038
- } else if (name === "listContentTypes" && allowed.size > 0) {
2038
+ } else if (name === "listContentTypes") {
2039
2039
  tools[name] = tool({
2040
2040
  description: def.description,
2041
2041
  inputSchema: zodSchema(def.schema),
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.3",
2
+ "version": "0.6.4",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",