howto basics :)

This commit is contained in:
lovebird 2025-03-29 09:48:22 +01:00
parent 91fcce5d17
commit 5020f624c9
11 changed files with 137 additions and 17 deletions

View File

@ -23,7 +23,7 @@
"format": "unix-time"
}
],
"default": "2025-03-29T07:46:07.282Z"
"default": "2025-03-29T08:36:39.384Z"
},
"description": {
"type": "string",

File diff suppressed because one or more lines are too long

View File

@ -4706,5 +4706,89 @@
"https://www.youtube.com/watch?v=V-GBVacDFoU": {
"isValid": true,
"timestamp": 1743217448542
},
"https://xometry.pro/en-tr/articles/injection-moulding-overview/": {
"isValid": true,
"timestamp": 1743236440782
},
"https://www.keplers.com/book/9781466407824": {
"isValid": true,
"timestamp": 1743236441690
},
"https://www.youtube.com/watch?v=_a7usMe_K38": {
"isValid": true,
"timestamp": 1743236441850
},
"https://osda.gitlab.io/19/3.2.pdf": {
"isValid": true,
"timestamp": 1743236442476
},
"https://youtu.be/qtZv96cifIU": {
"isValid": true,
"timestamp": 1743236859416
},
"mailto:preciousplasticpasadena@gmail.com": {
"isValid": false,
"timestamp": 1743236859439
},
"https://resource.co/article/managing-waste-tourist-cities-2023": {
"isValid": true,
"timestamp": 1743237109726
},
"https://www.unwto.org/sustainable-development/unwto-international-network-of-sustainable-tourism-observatories/tools-solid-waste-management": {
"isValid": true,
"timestamp": 1743237109987
},
"https://www.igi-global.com/book/solid-waste-management-disposal-practices/356401": {
"isValid": true,
"timestamp": 1743237111393
},
"https://bookstore.gpo.gov/catalog/waste-management": {
"isValid": false,
"timestamp": 1743237111587
},
"https://www.sltda.gov.lk/storage/common_media/DestinationManagementPlan-Sigiriya-final.pdf": {
"isValid": true,
"timestamp": 1743237112658
},
"https://www.esri.com/content/dam/esrisites/en-us/newsroom/arcuser/arcuser-spring-2020.pdf": {
"isValid": true,
"timestamp": 1743237113904
},
"https://summit.stc.org/wp-content/uploads/2021/05/2021STCSummit.pdf": {
"isValid": true,
"timestamp": 1743237114540
},
"https://ccet.jp/sites/default/files/2020-10/Negombo_0917_web.pdf": {
"isValid": true,
"timestamp": 1743237115315
},
"https://www.cs.uoregon.edu/Reports/PHD-202406-Schwartz.pdf": {
"isValid": true,
"timestamp": 1743237116076
},
"https://www.youtube.com/watch?v=nUrBBBs7yzQ": {
"isValid": true,
"timestamp": 1743237116210
},
"https://github.com/ANTLab-polimi/smart-waste-bin": {
"isValid": true,
"timestamp": 1743237116823
},
"*": {
"isValid": false,
"timestamp": 1743237163317
},
"https://partners.noplasticsunday.com/NPSblog/?bmode=view\\&idx=11164797": {
"isValid": true,
"timestamp": 1743237261694
},
"https://makeityourself.org/MIY.pdf": {
"isValid": true,
"timestamp": 1743237262196
},
"https://www.youtube.com/watch?v=yODwM9c1srg": {
"isValid": true,
"timestamp": 1743237262353
}
}

View File

@ -3,7 +3,7 @@
"messages": [
{
"role": "user",
"content": "Extract the required tools, software hardware from the following tutorial. Return as Markdown chapters (H3) with very short bullet points (not bold), with links, max. 5. per category.\n\nText to process:\nProduction of two products from polypropylene plastic and fishing nets sourced from Spain's coast.\n\nLearn about making boards or panels with this material here [link].\n\n\nUser Location: Gandia, Spain\n\n### Guide Overview\n\nThis guide focuses on the creation of two products using panels made from polypropylene plastic and recovered fishing nets:\n\n- Urban Bench\n- Dumbbells\n\nFor information on creating panels with a sheet press, refer to the detailed guide titled \"Boards Made from Marine Litter.\"\n\nThis guide will primarily address the detailed process of product creation and manufacturing.\n\nWe typically use CAD and 3D modeling software such as Solidworks and Rhinoceros for 3D modeling, and AutoCAD and Illustrator for defining 2D cutting lines for CNC machining.\n\nWith a predefined design, we proceed to machine the material using a CNC cutting machine.\n\n**Tips**\n\nAim to maximize material usage and manage cutting space efficiently to minimize waste.\n\nPlastic boards are generally softer than wood, allowing for single-stroke cuts with wood-compatible drills, optimizing production time and achieving a cleaner finish. Always perform an initial test.\n\nCollected shavings can be reused as raw material in a sheet press or extrusion machine.\n\nBegin assembly of the bench and its structure once the parts are cut. \n\nFor urban furniture, a metal framework provides stability and durability. \n\n**Tips**\n\nTo connect plastic elements to the metal structure, use galvanized or stainless steel screws and nuts. Although stainless steel is more costly than galvanized, it offers superior resistance to oxidation.\n\nWhen attaching plastic parts, pre-drill holes the size of the screw to prevent breaking or deforming due to excessive pressure.\n\nTo create dumbbell weights (circular sections), the same marine litter boards used for the bench are CNC machined. Handles are crafted from a colorful mix of recycled plastic bottle caps. An extrusion machine produces plastic rods up to 9.84 feet (3 meters) in varying shapes and thicknesses, either rounded or square.\n\nTo assemble the pieces, use stainless steel screws. First, select a drill bit matching the screw size; for instance, use a 3mm (0.12 inches) drill for 4mm (0.16 inches) screws.\n\n**Tip**\n\nFor assembling various plastic parts, torx head screws are recommended for enhanced product security and difficulty in disassembly."
"content": "Extract the required tools, software hardware from the following tutorial. Return as Markdown chapters (H3) with very short bullet points (not bold), with links, max. 5. per category.\n\nText to process:\nPlastic sheets created with a sheet press need not be square.\n\nHere, we demonstrate how to make an octagonal mold for octagonal plastic sheets. These techniques can be used to create any polygonal mold, such as triangular or hexagonal.\n\nFor further guidance, feel free to contact us with any questions or suggestions regarding the mold.\n\n\nUser Location: Sukawati, Indonesia\n\n### Tools\n- Sheet press set\n- Angle grinder\n- Welding tools and materials\n- Jigsaw\n- Sander (for product finishing)\n- Safety gear: welding helmet, safety glasses, mask\n- Marker\n- Ruler\n\n- Computer with drafting/drawing software\n\n### Materials\n- Steel for mold: 0.79 x 0.79 inches (2x2 cm) galvanized steel (standard size = 19.7 ft)\n- Clean, sorted plastic, type optional\n\nDraw the polygon in your preferred drafting software to obtain precise dimensions for each side. \n\nMeasure your sheet press work area. \n\nOffset by 2 inches (5 cm) inward for space around the mold. \n\nDesign the polygon based on your machine's capacity. \n\nOffset by 0.8 inches (2 cm) inward for the steel thickness. \n\nUse the drawing to measure the mold dimensions. This will aid in calculating the plastic required for sheet production.\n\nAfter outlining and measuring, use an angle grinder to cut the 20mm (0.79 inches) hollow galvanized steel to the specified size.\n\nMark dimensions using an erasable marker for accuracy.\nEmploy an angle grinder for cutting.\nUse a whiteboard marker to draw a 1:1 template of your sheets to align angles and dimensions properly, adjusting as necessary.\n\nUsing a whiteboard marker, draw a full-scale template of your sheets to verify and adjust angles and dimensions as necessary.\n\nWeld all sides to join the ends and form your polygonal sheets.\n\nUse an angle grinder to smooth excess welding material. This is essential to ensure the mold lies flat against the sheets, preventing damage and preventing plastic from leaking if the surface is uneven.\n\n### How to Make a Polygonal Sheet\n\nCalculate the area of your polygon from the drawing to determine the required plastic amount.\n\nRefer to the sheet press tutorial for detailed instructions: [YouTube Video](https://youtu.be/TNG2f_hKc_A)\n\nFeel free to share your experience with us.\n\nSincerely, \nWedoo Team"
},
{
"role": "user",

View File

@ -68,7 +68,7 @@ const DEFAULT_TEMPLATE_OPTIONS = {
} as const;
// Load configuration from JSON file
const loadConfig = (context: TemplateContext = TemplateContext.COMMONS): LLMConfig => {
export const load = (context: TemplateContext = TemplateContext.COMMONS): LLMConfig => {
const configPath = `./src/config/templates/${context}.json`;
if (exists(configPath)) {
try {
@ -131,6 +131,10 @@ const DEFAULT_PROMPTS: PromptRegistry = {
template: "Return a list of references (only with links), as Markdown, grouped : Articles, Books, Papers, Youtube, Opensource Designs, ... Dont comment !",
format: 'markdown'
},
brief: {
template: "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.",
format: 'text'
},
toolsAndHardware: {
template: "Extract the required tools, software hardware from the following tutorial. Return as Markdown chapters (H3) with very short bullet points (not bold), with links, max. 5. per category.",
format: 'markdown'
@ -169,7 +173,7 @@ const createTemplate = (config: LLMConfig, name: string, defaults: Partial<Templ
};
export const createTemplates = (context: TemplateContext = TemplateContext.COMMONS) => {
const config = loadConfig(context);
const config = load(context);
switch (context) {
case TemplateContext.COMMONS:
@ -201,6 +205,11 @@ export const createTemplates = (context: TemplateContext = TemplateContext.COMMO
model: "gpt-4o",
...DEFAULT_TEMPLATE_OPTIONS
}, 'keywords'),
brief: createTemplate(config, 'keywords', {
router: "openai",
model: "gpt-4o",
...DEFAULT_TEMPLATE_OPTIONS
}, 'brief'),
references: createTemplate(config, 'references', {
model: "perplexity/sonar-deep-research",
...DEFAULT_TEMPLATE_OPTIONS

View File

@ -67,14 +67,18 @@ export const filter = async (content: string, tpl: string = 'howto', opts: Props
}
}
await set_cached_object({ ca_options }, 'kbot', result[0], {});
logger.debug(`Cached result for ${content.substring(0, 20)}`)
logger.debug(`caching result for "${content.substring(0, 20)}..."`)
return result[0] as string;
};
export const template_filter = async (text: string, template: string, context: TemplateContext = TemplateContext.COMMONS) => {
if(!text || text.length < 20) {
return text;
}
const environment = env()
const templates = createTemplates(context);
if (!templates[template]) {
logger.warn(`No template found for ${template}`);
return text;
}
const templateConfig = templates[template]();

View File

@ -26,9 +26,9 @@ export const HOWTO_FILTER_LLM = true
export const HOWTO_ANNOTATIONS = false
export const HOWTO_ANNOTATIONS_CACHE = false
export const HOWTO_COMPLETE_RESOURCES = true
export const HOWTO_ADD_HARDWARE = true
export const HOWTO_ADD_RESOURCES = true
export const HOWTO_ADD_REFERENCES = true
export const HOWTO_ADD_HARDWARE = false
export const HOWTO_ADD_RESOURCES = false
export const HOWTO_ADD_REFERENCES = false
export const HOWTO_COMPLETE_SKILLS = false
export const HOWTO_LOCAL_RESOURCES = false

View File

@ -7,6 +7,13 @@
"mode": "completion",
"prompt": "Return a list of max. 10 keywords that can be used for SEO purposes, separated by commas (dont comment, just the list) : "
},
"brief": {
"router": "openai",
"model": "gpt-4o",
"preferences": "none",
"mode": "completion",
"prompt": "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."
},
"references": {
"model": "perplexity/sonar-deep-research",
"preferences": "none",

View File

@ -23,12 +23,17 @@ export const blacklist: readonly string[] = [
export const urlBlacklist: readonly string[] = [
"thenounproject.com",
"preciousplastic.com"
"preciousplastic.com",
"community.preciousplastic.com",
"bazar.preciousplastic.com",
"onearmy.earth"
] as const;
export const bannedWords: readonly string[] = [
"wizard",
"magic2"
"magic2",
"precious plastic",
"onearmy"
] as const;
export const wordReplaceMap: Readonly<Record<string, string>> = {
@ -175,8 +180,6 @@ export const validateLinks = async (text: string): Promise<string> => {
// Encode the URL to handle special characters
const encodedUrl = encodeURI(url);
const isValid = await validateUrl(encodedUrl);
console.log(`Checking link: ${encodedUrl} : ${isValid}`);
// Cache the result
await linkCache.set(url, isValid);
// Add strikethrough for invalid links while preserving the link

View File

@ -130,5 +130,7 @@ export interface IHowto {
// Added content field : resources
resources?: string
// Added content field : references
references?: string
references?: string,
// Added content field : brief
brief?: string
}

View File

@ -38,11 +38,12 @@ import {
HOWTO_COMPLETE_SKILLS,
HOWTO_LOCAL_RESOURCES,
HOWTO_ADD_RESOURCES,
HOWTO_ADD_REFERENCES
HOWTO_ADD_REFERENCES,
HOWTO_SEO_LLM
} from "config/config.js"
const NB_ITEMS = 250
const NB_ITEMS = 10
import { env, logger } from '@/base/index.js'
@ -289,9 +290,14 @@ const to_astro = async (item: IHowto) => {
}
const complete = async (item: IHowto) => {
const configPath = path.join(item_path(item), 'config.json')
const config = read(configPath, 'json') as IHowto || {}
item = { ...item, ...config }
if (!HOWTO_ANNOTATIONS) {
// return item
}
// commons: language, tone, bullshit filter, and a piece of love, just a bit, at least :)
if (HOWTO_FILTER_LLM) {
item.description = await commons(item.description || '')
@ -337,8 +343,13 @@ const complete = async (item: IHowto) => {
item.references = await applyFilters(item.references, default_filters_markdown);
write(path.join(item_path(item), 'references.md'), item.references as string)
}
if(HOWTO_SEO_LLM){
item.brief = await template_filter(item.content, 'brief', TemplateContext.HOWTO);
}
await to_github(item)
await to_mdx(item)
// await to_mdx(item)
// await to_astro(item)
return item