latest | library begin :)

This commit is contained in:
lovebird 2025-04-06 11:24:23 +02:00
parent 4c7abd5832
commit a29bae4136
8 changed files with 27 additions and 63 deletions

View File

@ -23,7 +23,7 @@
"format": "unix-time"
}
],
"default": "2025-04-03T18:32:26.199Z"
"default": "2025-04-06T09:23:22.935Z"
},
"description": {
"type": "string",

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"_variables": {
"lastUpdateCheck": 1742758032817
"lastUpdateCheck": 1743928603587
}
}

View File

@ -1,9 +1,9 @@
{
"model": "gpt-4o",
"model": "perplexity/sonar-deep-research",
"messages": [
{
"role": "user",
"content": "Create a concise description for SEO meta (around 150-160 characters) from the text below. \n Disregard any links or image references. \n Return only the final meta description, no extra commentary.\n\nText to process:\nThis guide outlines the process for cutting HDPE sheets using an X-Carve CNC. For a detailed demonstration, refer to the video available in Spanish with subtitles: [Watch Video](https://www.youtube.com/watch?v=4LrrFz802To).\n\n\nUser Location: Mexico City, Mexico\n\nTo proceed, measure the plastic sheet's height, width, and thickness. The X-Carve machine operates with the CAM software Easel, which is user-friendly for CNC milling.\n\nEasel allows simulation of your material, and includes HDPE 2-Colors in its list of cutting materials.\n\nUsing the clamps from the X-Carve, secure the sheet to the table.\n\n### Instructions\n\nProceed by using software like Inkscape to create a vector file, or download one from a source such as [thenounproject.com](https://thenounproject.com).\n\nDownload the SVG file, which is a standard vector format, and import it into Easel.\n\nWith the file ready, choose the desired width for carving or cutting. Proceed with the following steps:\n\n- Ensure the sheet is securely fixed.\n- Specify the cutting bit: use a 1/8-inch (3.175 mm) flat flute bit.\n- Set the coordinate origin at the lower-left corner (0, 0).\n- Raise the bit and activate the CNC router.\n\n### Instructions for Post-Processing\n\nTake your glasses or object, complete the post-processing, and share the results with others.\n\nThis project can be attempted with various CNC machines, including manual routers or saws. The essential aspect is sharing your work to contribute to community growth.\n\nFeel free to share your ideas and comments."
"content": "Return a list of useful references, as Markdown, grouped : Articles, Books, Papers, Youtube, Software, Opensource Designs, ... Dont comment!\n\nText to process:\nThis tutorial demonstrates the process of cutting HDPE sheets with an X-Carve CNC. You can watch the complete video in Spanish with subtitles [here](https://www.youtube.com/watch?v=4LrrFz802To).\n\n\nUser Location: Mexico City, Mexico\n\nFor this step, measure the plastic sheet's height, width, and thickness. Our X-Carve machine uses the CAM software Easel for CNC milling. Easel allows you to simulate your material, and it includes HDPE 2-Colors in the cutting material list.\n\nUsing CNC clamps from the X-Carve, secure the sheet to the table.\n\nProceed to a vector graphics editor, like Inkscape, to create a design, or download an open-source vector file from [The Noun Project](https://thenounproject.com).\n\nDownload the SVG file and import it into Easel.\n\n### Instructions for CNC Router Setup\n\n1. Select the desired cutting width in the file.\n2. Ensure the sheet is securely fixed.\n3. Choose the cutting bit: 1/8 inch (3.175 mm) flat flute.\n4. Set the machine's origin to the bottom left corner.\n5. Raise the bit and activate the CNC router.\n\nTake your glasses or object, complete the post-processing, and share the results with others.\n\nYou can attempt this project using various CNC machines, including manual routers or saws, as demonstrated in this video: [youtu.be](https://youtu.be/gxkcffQD3eQ). It is important to share your work to support community growth.\n\nContributions and feedback are welcome."
},
{
"role": "user",

View File

@ -1,49 +0,0 @@
export const HOWTO_ROOT = () => '/howto';
export const DIRECTORY_ROOT = () => '/directory';
export const HOWTO_FILES_WEB = () => '/howto';
export const DIRECTORY_FILES_WEB = () => '/directory';
export const HOWTO_FILES_ABS = () => '/howto';
export const DIRECTORY_FILES_ABS = () => '/directory';
export const HOWTO_FILTER_LLM = () => true;
export const DIRECTORY_FILTER_LLM = () => true;
export const HOWTO_GLOB = () => '**/*.md';
export const DIRECTORY_GLOB = () => '**/*.md';
export const HOWTO_MIGRATION = () => 'data/migration.json';
export const DIRECTORY_MIGRATION = () => 'data/migration.json';
export const HOWTO_ANNOTATIONS = () => true;
export const DIRECTORY_ANNOTATIONS = () => true;
export const HOWTO_COMPLETE_RESOURCES = () => true;
export const DIRECTORY_COMPLETE_RESOURCES = () => true;
export const HOWTO_ADD_HARDWARE = () => true;
export const DIRECTORY_ADD_HARDWARE = () => true;
export const HOWTO_COMPLETE_SKILLS = () => true;
export const DIRECTORY_COMPLETE_SKILLS = () => true;
export const HOWTO_LOCAL_RESOURCES = () => true;
export const DIRECTORY_LOCAL_RESOURCES = () => true;
export const HOWTO_ADD_RESOURCES = () => true;
export const DIRECTORY_ADD_RESOURCES = () => true;
export const HOWTO_ADD_REFERENCES = () => true;
export const DIRECTORY_ADD_REFERENCES = () => true;
export const HOWTO_SEO_LLM = () => true;
export const DIRECTORY_SEO_LLM = () => true;
export const HOWTO_MAX_ITEMS = () => 1000;
export const DIRECTORY_MAX_ITEMS = () => 1000;
export const default_image = () => ({
src: '/images/default.png',
alt: 'Default image'
});

View File

@ -1,4 +1,4 @@
import { get_cached_object, set_cached_object } from "@polymech/cache"
import { get_cached_object, set_cached_object, rm_cached_object } from "@polymech/cache"
import { run, OptionsSchema } from "@polymech/kbot-d";
import { resolveVariables } from "@polymech/commons/variables"
import { } from "@polymech/core/objects"
@ -36,15 +36,20 @@ export const filter = async (content: string, tpl: string = 'howto', opts: Props
tools: []
};
const ca_options = JSON.parse(JSON.stringify(removeEmptyObjects(cache_key_obj)));
let cached = null
let cached
try {
cached = await get_cached_object({ ca_options }, 'kbot');
cached = await get_cached_object({ ca_options }, 'kbot') as { content: string }
} catch (e) {
logger.error(`Failed to get cached object for ${content.substring(0, 20)}`, e);
}
if (cached && LLM_CACHE) {
return cached;
if (cached) {
if (LLM_CACHE) {
return cached.content;
} else {
rm_cached_object({ ca_options }, 'kbot')
}
}
logger.info(`kbot: template:${tpl} : context:${context} @ ${options.model}`)
const result = await run(options);
if (!result || !result[0]) {
@ -54,14 +59,14 @@ export const filter = async (content: string, tpl: string = 'howto', opts: Props
if (template.format === 'json') {
try {
const jsonResult = JSON.parse(result[0] as string);
await set_cached_object(content, ca_options, jsonResult, 'kbot');
await set_cached_object(content, ca_options, { content: jsonResult }, 'kbot');
return jsonResult;
} catch (e) {
logger.error('Failed to parse JSON response:', e);
return result[0];
}
}
await set_cached_object({ ca_options }, 'kbot', result[0], {});
await set_cached_object({ ca_options }, 'kbot', { content: result[0] }, {})
logger.info(`kbot-result: template:${tpl} : context:${context} @ ${options.model} : ${result[0]}`)
return result[0] as string;
};

View File

@ -5,7 +5,8 @@ import { sync as read } from '@polymech/fs/read'
import { sanitizeUri } from 'micromark-util-sanitize-uri'
// LLM
export const LLM_CACHE = true
export const LLM_CACHE = false
export const LLM_CACHE_DIR = './.cache/kbot'
export const OSR_ROOT = () => path.resolve(resolve("${OSR_ROOT}"))
@ -68,13 +69,19 @@ export const DIRECTORY_FILES_ABS = (id) => `${DIRECTORY_ROOT()}/${id}`
export const DIRECTORY_FILES_WEB = (id: string) => `${DIRECTORY_FILES_BASE}/${id}`
export const DIRECTORY_EDIT_URL = (id: string, lang: string) => `${DIRECTORY_EDIT_ROOT}/${id}`
// Products
// Library Products
export const PRODUCT_ROOT = () => path.resolve(resolve("${OSR_ROOT}/products"))
export const PRODUCT_BRANCHES = read(path.join(PRODUCT_ROOT(), 'config/machines.json'), 'json')
export const PRODUCT_GLOB = '**/config.json'
export const ENABLED_PRODUCTS = "${OSR_ROOT}/products/config/machines.json"
export const PRODUCT_SPECS = (rel) => `${PRODUCT_ROOT()}/${rel}/specs.xlsx`
// Library Components
export const COMPONENT_ROOT = () => path.resolve(resolve("${OSR_ROOT}/osr-machines"))
export const COMPONENT_GLOB = '**/config.json'
export const ENABLED_COMPONENTS = "${OSR_ROOT}/components/config/machines.json"
export const COMPONENT_SPECS = (rel) => `${COMPONENT_ROOT()}/${rel}/specs.xlsx`
// Product compiler
export const PRODUCT_CONFIG = (product) =>
path.resolve(resolve(`${PRODUCT_ROOT()}/${product}/config.json`, false,

View File

@ -4,6 +4,7 @@ import { loader } from './model/component/component.js'
import { loader as howtoLoader } from './model/howto/howto.js'
import { loader as directorLoader } from './model/directory/item.js'
import { RETAIL_PRODUCT_BRANCH, PROJECTS_BRANCH } from 'config/config.js'
import { glob } from 'astro/loaders'
const store = defineCollection({