tests:each image to Markdown
23
packages/kbot/.vscode/launch.json
vendored
@ -741,6 +741,29 @@
|
||||
"!**/node_modules/**"
|
||||
],
|
||||
"outputCapture": "std"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "each:image",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}/dist-in/main.js",
|
||||
"args": [
|
||||
"--router2=openai",
|
||||
"--model=meta-llama/llama-3.2-90b-vision-instruct",
|
||||
"--prompt=./tests/pdf/prompt_manual.md",
|
||||
"--each=./tests/pdf/780/*.jpg", // Note: Glob pattern passed directly
|
||||
"--mode=completion",
|
||||
"--preferences=none",
|
||||
"--dst=./tests/pdf/sako_manual.md",
|
||||
"--filters=code",
|
||||
"--append=concat"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "integratedTerminal",
|
||||
"outputCapture": "std"
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/kbot/dist-in/commands/run.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
import { ChatCompletionToolRunnerParams } from 'openai/lib/ChatCompletionRunner';
|
||||
import { ChatCompletionMessageParam } from 'openai/resources/index.mjs';
|
||||
import { IKBotTask } from '@polymech/ai-tools';
|
||||
export declare const default_sort: (files: string[]) => string[];
|
||||
type ProcessRunResult = string | boolean | Record<string, unknown> | null;
|
||||
/**
|
||||
* Complete options by setting up defaults, validating inputs, and initializing required components
|
||||
|
||||
28
packages/kbot/dist-in/utils/merge.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Appends new content to existing content.
|
||||
*
|
||||
* @param existingContent - The original content string.
|
||||
* @param newContent - The content string to append.
|
||||
* @returns The combined string with new content appended.
|
||||
*/
|
||||
export declare function concat(existingContent: string, newContent: string): string;
|
||||
/**
|
||||
* Merges new content into existing content.
|
||||
* For now, this simply concatenates with a newline separator.
|
||||
* TODO: Implement more sophisticated merging logic if needed (e.g., JSON merge).
|
||||
*
|
||||
* @param existingContent - The original content string.
|
||||
* @param newContent - The content string to merge/append.
|
||||
* @returns The combined string.
|
||||
*/
|
||||
export declare function merge(existingContent: string, newContent: string): string;
|
||||
/**
|
||||
* Writes content to a destination file, handling append/merge logic if the file exists.
|
||||
*
|
||||
* @param dstPath - The absolute path to the destination file.
|
||||
* @param content - The content to write.
|
||||
* @param appendMode - Optional mode ('concat' or 'merge') to handle existing files.
|
||||
* @param logger - Optional logger instance conforming to SimpleLogger.
|
||||
* @returns The final content written to the file or the original content if read fails.
|
||||
*/
|
||||
export declare function writeOrAppend(dstPath: string, content: string, appendMode?: 'concat' | 'merge'): string;
|
||||
54
packages/kbot/dist-in/utils/merge.js
Normal file
@ -0,0 +1,54 @@
|
||||
import { sync as exists } from '@polymech/fs/exists';
|
||||
import { sync as read } from '@polymech/fs/read';
|
||||
import { sync as write } from '@polymech/fs/write';
|
||||
/**
|
||||
* Appends new content to existing content.
|
||||
*
|
||||
* @param existingContent - The original content string.
|
||||
* @param newContent - The content string to append.
|
||||
* @returns The combined string with new content appended.
|
||||
*/
|
||||
export function concat(existingContent, newContent) {
|
||||
return existingContent + '\n\n' + newContent + '\n';
|
||||
}
|
||||
/**
|
||||
* Merges new content into existing content.
|
||||
* For now, this simply concatenates with a newline separator.
|
||||
* TODO: Implement more sophisticated merging logic if needed (e.g., JSON merge).
|
||||
*
|
||||
* @param existingContent - The original content string.
|
||||
* @param newContent - The content string to merge/append.
|
||||
* @returns The combined string.
|
||||
*/
|
||||
export function merge(existingContent, newContent) {
|
||||
// Placeholder: Simple concatenation
|
||||
// Potential future implementation: Detect JSON/YAML and perform structured merge
|
||||
return existingContent + '\n' + newContent;
|
||||
}
|
||||
/**
|
||||
* Writes content to a destination file, handling append/merge logic if the file exists.
|
||||
*
|
||||
* @param dstPath - The absolute path to the destination file.
|
||||
* @param content - The content to write.
|
||||
* @param appendMode - Optional mode ('concat' or 'merge') to handle existing files.
|
||||
* @param logger - Optional logger instance conforming to SimpleLogger.
|
||||
* @returns The final content written to the file or the original content if read fails.
|
||||
*/
|
||||
export function writeOrAppend(dstPath, content, appendMode) {
|
||||
let finalContent = content;
|
||||
if (exists(dstPath) && appendMode) {
|
||||
const existingContentBuffer = read(dstPath); // Read returns Buffer | undefined
|
||||
if (existingContentBuffer) { // Check if read was successful
|
||||
const existingContent = existingContentBuffer.toString();
|
||||
if (appendMode === 'concat') {
|
||||
finalContent = concat(existingContent, content);
|
||||
}
|
||||
else if (appendMode === 'merge') {
|
||||
finalContent = merge(existingContent, content); // Using placeholder merge for now
|
||||
}
|
||||
}
|
||||
}
|
||||
write(dstPath, finalContent);
|
||||
return finalContent;
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVyZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvbWVyZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLElBQUksSUFBSSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQTtBQUNwRCxPQUFPLEVBQUUsSUFBSSxJQUFJLElBQUksRUFBRSxNQUFNLG1CQUFtQixDQUFBO0FBQ2hELE9BQU8sRUFBRSxJQUFJLElBQUksS0FBSyxFQUFFLE1BQU0sb0JBQW9CLENBQUE7QUFFbEQ7Ozs7OztHQU1HO0FBQ0gsTUFBTSxVQUFVLE1BQU0sQ0FBQyxlQUF1QixFQUFFLFVBQWtCO0lBQ2hFLE9BQU8sZUFBZSxHQUFHLE1BQU0sR0FBRyxVQUFVLEdBQUcsSUFBSSxDQUFBO0FBQ3JELENBQUM7QUFFRDs7Ozs7Ozs7R0FRRztBQUNILE1BQU0sVUFBVSxLQUFLLENBQUMsZUFBdUIsRUFBRSxVQUFrQjtJQUMvRCxvQ0FBb0M7SUFDcEMsaUZBQWlGO0lBQ2pGLE9BQU8sZUFBZSxHQUFHLElBQUksR0FBRyxVQUFVLENBQUM7QUFDN0MsQ0FBQztBQUVEOzs7Ozs7OztHQVFHO0FBQ0gsTUFBTSxVQUFVLGFBQWEsQ0FDM0IsT0FBZSxFQUNmLE9BQWUsRUFDZixVQUErQjtJQUUvQixJQUFJLFlBQVksR0FBRyxPQUFPLENBQUM7SUFDM0IsSUFBSSxNQUFNLENBQUMsT0FBTyxDQUFDLElBQUksVUFBVSxFQUFFLENBQUM7UUFDbEMsTUFBTSxxQkFBcUIsR0FBRyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxrQ0FBa0M7UUFDL0UsSUFBSSxxQkFBcUIsRUFBRSxDQUFDLENBQUMsK0JBQStCO1lBQzFELE1BQU0sZUFBZSxHQUFHLHFCQUFxQixDQUFDLFFBQVEsRUFBRSxDQUFDO1lBQ3pELElBQUksVUFBVSxLQUFLLFFBQVEsRUFBRSxDQUFDO2dCQUM1QixZQUFZLEdBQUcsTUFBTSxDQUFDLGVBQWUsRUFBRSxPQUFPLENBQUMsQ0FBQztZQUNsRCxDQUFDO2lCQUFNLElBQUksVUFBVSxLQUFLLE9BQU8sRUFBRSxDQUFDO2dCQUNsQyxZQUFZLEdBQUcsS0FBSyxDQUFDLGVBQWUsRUFBRSxPQUFPLENBQUMsQ0FBQyxDQUFDLDBDQUEwQztZQUM1RixDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7SUFDRCxLQUFLLENBQUMsT0FBTyxFQUFFLFlBQVksQ0FBQyxDQUFBO0lBQzVCLE9BQU8sWUFBWSxDQUFBO0FBQ3JCLENBQUMifQ==
|
||||
@ -28,6 +28,24 @@ import { runAssistant } from './run-assistant.js'
|
||||
import { all } from '../models/index.js'
|
||||
import { getLogger } from '../index.js'
|
||||
|
||||
export const default_sort = (files: string[]): string[] => {
|
||||
const getSortableParts = (filename: string) => {
|
||||
const baseName = path.parse(filename).name;
|
||||
const match = baseName.match(/^(\d+)_?(.*)$/); // Match leading numbers
|
||||
const numPart = match ? parseInt(match[1], 10) : NaN;
|
||||
const textPart = match ? match[2] : baseName; // Extract text part
|
||||
|
||||
return { numPart, textPart };
|
||||
}
|
||||
return files.sort((a, b) => {
|
||||
const { numPart: aNum, textPart: aText } = getSortableParts(a)
|
||||
const { numPart: bNum, textPart: bText } = getSortableParts(b)
|
||||
if (!isNaN(aNum) && !isNaN(bNum)) {
|
||||
return aNum - bNum || aText.localeCompare(bText, undefined, { numeric: true, sensitivity: 'base' })
|
||||
}
|
||||
return aText.localeCompare(bText, undefined, { numeric: true, sensitivity: 'base' })
|
||||
})
|
||||
}
|
||||
|
||||
type ProcessRunResult = string | boolean | Record<string, unknown> | null;
|
||||
|
||||
@ -293,8 +311,10 @@ export const run = async (opts: IKBotTask): Promise<ProcessRunResult[]> => {
|
||||
} else if (exists(opts.each) && isFile(opts.each) && path.parse(opts.each).ext === '.json') {
|
||||
items = read(opts.each, 'json') as [] || []
|
||||
} else if (hasMagic(opts.each)) {
|
||||
const info = pathInfoEx(forward_slash(path.resolve(resolve(opts.each))))
|
||||
items = info.FILES
|
||||
const info = pathInfoEx(forward_slash(path.resolve(resolve(opts.each))),false,{
|
||||
absolute: true,
|
||||
})
|
||||
items = default_sort(info.FILES)
|
||||
} else if (isFile(opts.each) && exists(opts.each)) {
|
||||
items = [opts.each]
|
||||
} else if (isString(opts.each)) {
|
||||
|
||||
59
packages/kbot/src/utils/merge.ts
Normal file
@ -0,0 +1,59 @@
|
||||
import { sync as exists } from '@polymech/fs/exists'
|
||||
import { sync as read } from '@polymech/fs/read'
|
||||
import { sync as write } from '@polymech/fs/write'
|
||||
|
||||
/**
|
||||
* Appends new content to existing content.
|
||||
*
|
||||
* @param existingContent - The original content string.
|
||||
* @param newContent - The content string to append.
|
||||
* @returns The combined string with new content appended.
|
||||
*/
|
||||
export function concat(existingContent: string, newContent: string): string {
|
||||
return existingContent + '\n\n' + newContent + '\n'
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges new content into existing content.
|
||||
* For now, this simply concatenates with a newline separator.
|
||||
* TODO: Implement more sophisticated merging logic if needed (e.g., JSON merge).
|
||||
*
|
||||
* @param existingContent - The original content string.
|
||||
* @param newContent - The content string to merge/append.
|
||||
* @returns The combined string.
|
||||
*/
|
||||
export function merge(existingContent: string, newContent: string): string {
|
||||
// Placeholder: Simple concatenation
|
||||
// Potential future implementation: Detect JSON/YAML and perform structured merge
|
||||
return existingContent + '\n' + newContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes content to a destination file, handling append/merge logic if the file exists.
|
||||
*
|
||||
* @param dstPath - The absolute path to the destination file.
|
||||
* @param content - The content to write.
|
||||
* @param appendMode - Optional mode ('concat' or 'merge') to handle existing files.
|
||||
* @param logger - Optional logger instance conforming to SimpleLogger.
|
||||
* @returns The final content written to the file or the original content if read fails.
|
||||
*/
|
||||
export function writeOrAppend(
|
||||
dstPath: string,
|
||||
content: string,
|
||||
appendMode?: 'concat' | 'merge'
|
||||
): string {
|
||||
let finalContent = content;
|
||||
if (exists(dstPath) && appendMode) {
|
||||
const existingContentBuffer = read(dstPath); // Read returns Buffer | undefined
|
||||
if (existingContentBuffer) { // Check if read was successful
|
||||
const existingContent = existingContentBuffer.toString();
|
||||
if (appendMode === 'concat') {
|
||||
finalContent = concat(existingContent, content);
|
||||
} else if (appendMode === 'merge') {
|
||||
finalContent = merge(existingContent, content); // Using placeholder merge for now
|
||||
}
|
||||
}
|
||||
}
|
||||
write(dstPath, finalContent)
|
||||
return finalContent
|
||||
}
|
||||
BIN
packages/kbot/tests/pdf/780/manual.pdf
Normal file
BIN
packages/kbot/tests/pdf/780/manual_19.jpg
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
packages/kbot/tests/pdf/780/manual_20.jpg
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
packages/kbot/tests/pdf/780/manual_21.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
packages/kbot/tests/pdf/780/manual_22.jpg
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
packages/kbot/tests/pdf/780/manual_23.jpg
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
packages/kbot/tests/pdf/780/manual_24.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
packages/kbot/tests/pdf/780/manual_25.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
packages/kbot/tests/pdf/780/manual_26.jpg
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
packages/kbot/tests/pdf/780/manual_27.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
packages/kbot/tests/pdf/780/manual_28.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
packages/kbot/tests/pdf/780/manual_29.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
packages/kbot/tests/pdf/780/manual_30.jpg
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
packages/kbot/tests/pdf/780/manual_31.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
packages/kbot/tests/pdf/780/manual_32.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
packages/kbot/tests/pdf/780/manual_33.jpg
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
packages/kbot/tests/pdf/780/manual_34.jpg
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
packages/kbot/tests/pdf/780/manual_35.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
packages/kbot/tests/pdf/780/manual_36.jpg
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
packages/kbot/tests/pdf/780/manual_37.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
packages/kbot/tests/pdf/780/manual_38.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
packages/kbot/tests/pdf/780/manual_39.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
packages/kbot/tests/pdf/780/manual_40.jpg
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
packages/kbot/tests/pdf/780/manual_41.jpg
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
packages/kbot/tests/pdf/780/manual_42.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
packages/kbot/tests/pdf/780/manual_43.jpg
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
packages/kbot/tests/pdf/780/manual_44.jpg
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
packages/kbot/tests/pdf/780/manual_45.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
packages/kbot/tests/pdf/780/manual_46.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
packages/kbot/tests/pdf/780/manual_47.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
packages/kbot/tests/pdf/780/manual_48.jpg
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
packages/kbot/tests/pdf/780/manual_49.jpg
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
packages/kbot/tests/pdf/780/manual_50.jpg
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
packages/kbot/tests/pdf/780/manual_51.jpg
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
packages/kbot/tests/pdf/780/manual_52.jpg
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
packages/kbot/tests/pdf/780/manual_53.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
packages/kbot/tests/pdf/780/manual_54.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
packages/kbot/tests/pdf/780/manual_55.jpg
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
packages/kbot/tests/pdf/780/manual_56.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
packages/kbot/tests/pdf/780/manual_57.jpg
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
packages/kbot/tests/pdf/780/manual_58.jpg
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
packages/kbot/tests/pdf/780/manual_59.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
packages/kbot/tests/pdf/780/manual_60.jpg
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
packages/kbot/tests/pdf/780/manual_61.jpg
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
packages/kbot/tests/pdf/780/manual_62.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
packages/kbot/tests/pdf/780/manual_63.jpg
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
packages/kbot/tests/pdf/780/manual_64.jpg
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
packages/kbot/tests/pdf/780/manual_65.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
packages/kbot/tests/pdf/780/manual_66.jpg
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
packages/kbot/tests/pdf/780/manual_67.jpg
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
packages/kbot/tests/pdf/780/manual_68.jpg
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
packages/kbot/tests/pdf/780/manual_69.jpg
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
packages/kbot/tests/pdf/780/manual_70.jpg
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
packages/kbot/tests/pdf/780/manual_71.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
packages/kbot/tests/pdf/780/manual_72.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-1.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-10.jpg
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-11.jpg
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-12.jpg
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-13.jpg
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-14.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-15.jpg
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-16.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-17.jpg
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-18.jpg
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-19.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-2.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-20.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-21.jpg
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-22.jpg
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-23.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-24.jpg
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-25.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-26.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-27.jpg
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-28.jpg
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-29.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-3.jpg
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-4.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-5.jpg
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-6.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-7.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-8.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
packages/kbot/tests/pdf/RS485-780/RS485-780-9.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
6
packages/kbot/tests/pdf/extract.sh
Normal file
@ -0,0 +1,6 @@
|
||||
kbot-d --router2=openai --model=google/gemini-2.5-pro-preview-03-25 \
|
||||
--prompt=./tests/pdf/prompt.md \
|
||||
--each=./tests/pdf/RS485-780/RS485-780-*.jpg \
|
||||
--mode=completion --preferences=none \
|
||||
--dst=./tests/pdf/sako.md \
|
||||
--filters=code --append=concat
|
||||
6
packages/kbot/tests/pdf/extract_manual.sh
Normal file
@ -0,0 +1,6 @@
|
||||
kbot-d --router2=openai --model=meta-llama/llama-3.2-90b-vision-instruct \
|
||||
--prompt=./tests/pdf/prompt_manual.md \
|
||||
--each=./tests/pdf/780/*.jpg \
|
||||
--mode=completion --preferences=none \
|
||||
--dst=./tests/pdf/sako_manual.md \
|
||||
--filters=code --append=concat
|
||||
14
packages/kbot/tests/pdf/prompt.md
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
Extract all Modbus read & write registers, as Markdown table. If none can be identified, abort and return message "No registers found" !!
|
||||
|
||||
|
||||
## Columns
|
||||
- type (read/write holding register/coil) as function code
|
||||
- description
|
||||
- address in Hex
|
||||
- address in decimal
|
||||
- if provided, parameter group
|
||||
|
||||
- Dont comment or explain, just return Markdown
|
||||
- insert new lines before and after headers
|
||||
- insert a descriptive chapter name, header level 3 with the page number
|
||||
28
packages/kbot/tests/pdf/prompt_manual.md
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
Extract all parameters, as Markdown tables, return "Skipping Number Page : Nothing found" if nothing has been found, otherwise use this layout and structure (only valid Markdown!!)
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
### Columns
|
||||
|
||||
- parameter
|
||||
- description
|
||||
- if provided, parameter group
|
||||
- range
|
||||
- default
|
||||
- Dont comment or explain, just return Markdown
|
||||
- insert new lines before and after headers
|
||||
- insert a descriptive chapter name, header level 3 with the page number
|
||||
|
||||
## Error Codes
|
||||
|
||||
### Columns
|
||||
|
||||
- code
|
||||
- description
|
||||
- if provided, parameter group
|
||||
- Dont comment or explain, just return Markdown
|
||||
- insert new lines before and after headers
|
||||
- insert a descriptive chapter name, header level 3 with the page number
|
||||
|
||||
15
packages/kbot/tests/pdf/sako.md
Normal file
@ -0,0 +1,15 @@
|
||||
No registers found
|
||||
|
||||
|
||||
### Modbus Registers
|
||||
|
||||
| type | description | address (Hex) | address (dec) | parameter group |
|
||||
| :--------------------- | :------------------------- | :------------ | :------------ | :-------------- |
|
||||
| write holding register | P0-16 functional parameters | F010H | 61456 | P0 |
|
||||
| write holding register | AC-08 functional parameters | AC08H | 44040 | AC |
|
||||
|
||||
|
||||
No registers found
|
||||
|
||||
|
||||
No registers found
|
||||