u
This commit is contained in:
@@ -7,7 +7,7 @@ import env from '../config/env.js';
|
|||||||
import { getImageByHash } from '../db/pic.js';
|
import { getImageByHash } from '../db/pic.js';
|
||||||
import { prepareVfs, syncVfsToDb, extractFullHash, isReadOnlyDatabasePath } from './vfs.js';
|
import { prepareVfs, syncVfsToDb, extractFullHash, isReadOnlyDatabasePath } from './vfs.js';
|
||||||
import { resolveOpenRouterKey, resolveImageModel } from './llm-key.js';
|
import { resolveOpenRouterKey, resolveImageModel } from './llm-key.js';
|
||||||
import { TOOL_DESCRIPTIONS } from './prompts.js';
|
import { TOOL_DESCRIPTIONS, TOOL_PARAMETER_DESCRIPTIONS } from './prompts.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* edit-image — generate or edit images using the modelslugimage company setting.
|
* edit-image — generate or edit images using the modelslugimage company setting.
|
||||||
@@ -261,15 +261,15 @@ export function createEditImageTool({ googleAuthId, model: fallbackModel }) {
|
|||||||
properties: {
|
properties: {
|
||||||
note: {
|
note: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
description: 'A note explaining what this image generation or edit is doing (or null). This note will be displayed to the user while the image is being generated or edited.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.edit_image.note,
|
||||||
},
|
},
|
||||||
prompt: {
|
prompt: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'Description of the image to generate, or edit/transformation instructions when attachments are provided.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.edit_image.prompt,
|
||||||
},
|
},
|
||||||
attachments: {
|
attachments: {
|
||||||
type: ['array', 'null'],
|
type: ['array', 'null'],
|
||||||
description: 'Optional reference image(s) for editing/image-to-image or null. Omit for text-to-image generation.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.edit_image.attachments,
|
||||||
items: {
|
items: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
@@ -277,11 +277,11 @@ export function createEditImageTool({ googleAuthId, model: fallbackModel }) {
|
|||||||
properties: {
|
properties: {
|
||||||
vfsfilename: {
|
vfsfilename: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'VFS path (e.g. "images/sample.png") or database path ("image/<hash>").',
|
description: TOOL_PARAMETER_DESCRIPTIONS.edit_image.attachment_vfsfilename,
|
||||||
},
|
},
|
||||||
high: {
|
high: {
|
||||||
type: ['boolean', 'null'],
|
type: ['boolean', 'null'],
|
||||||
description: 'Feed image in high quality/resolution if true; low quality/resolution if false or null (default).',
|
description: TOOL_PARAMETER_DESCRIPTIONS.edit_image.attachment_high,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -289,16 +289,16 @@ export function createEditImageTool({ googleAuthId, model: fallbackModel }) {
|
|||||||
size: {
|
size: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
enum: [...VALID_SIZES, null],
|
enum: [...VALID_SIZES, null],
|
||||||
description: 'Resolution tier (3 choices): "1K" (standard, default), "2K" (high quality), "4K" (ultra high), or null.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.edit_image.size,
|
||||||
},
|
},
|
||||||
ratio: {
|
ratio: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
enum: [...VALID_RATIOS, null],
|
enum: [...VALID_RATIOS, null],
|
||||||
description: 'Aspect ratio (3 choices): "1:1" (square, default), "4:3" (landscape), "3:4" (portrait), or null.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.edit_image.ratio,
|
||||||
},
|
},
|
||||||
vfsoutputfilename: {
|
vfsoutputfilename: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
description: 'VFS path where the output image should be saved (e.g. "images/edited.avif") or null. Defaults to "images/generated-<timestamp>.avif". Output is always converted to AVIF.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.edit_image.vfsoutputfilename,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { defineTool, ToolError } from 'libllmorbiter';
|
import { defineTool, ToolError } from 'libllmorbiter';
|
||||||
import { TOOL_DESCRIPTIONS } from './prompts.js';
|
import { TOOL_DESCRIPTIONS, TOOL_PARAMETER_DESCRIPTIONS } from './prompts.js';
|
||||||
|
|
||||||
const DEFAULT_TAX_RATE = 19;
|
const DEFAULT_TAX_RATE = 19;
|
||||||
const DEFAULT_PRECISION = 6;
|
const DEFAULT_PRECISION = 6;
|
||||||
@@ -118,36 +118,36 @@ export function createNetGrossCalcTool() {
|
|||||||
properties: {
|
properties: {
|
||||||
note: {
|
note: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'A note explaining what this price calculation is doing. This note will be displayed to the user while executing.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.net_gross_calc.note,
|
||||||
},
|
},
|
||||||
gross: {
|
gross: {
|
||||||
type: ['number', 'null'],
|
type: ['number', 'null'],
|
||||||
description: 'Gross price (incl. VAT) or null. When provided, computes net price and tax amount.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.net_gross_calc.gross,
|
||||||
},
|
},
|
||||||
net: {
|
net: {
|
||||||
type: ['number', 'null'],
|
type: ['number', 'null'],
|
||||||
description: 'Net price (excl. VAT) or null. When provided, computes gross price and tax amount.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.net_gross_calc.net,
|
||||||
},
|
},
|
||||||
taxRate: {
|
taxRate: {
|
||||||
type: ['number', 'null'],
|
type: ['number', 'null'],
|
||||||
description: `Tax/VAT rate percentage (e.g. 19 for 19%, 7 for 7%) or null. Default ${DEFAULT_TAX_RATE}.`,
|
description: TOOL_PARAMETER_DESCRIPTIONS.net_gross_calc.taxRate,
|
||||||
},
|
},
|
||||||
amount: {
|
amount: {
|
||||||
type: ['number', 'null'],
|
type: ['number', 'null'],
|
||||||
description: 'Generic price amount or null when used with "from" ("gross" or "net").',
|
description: TOOL_PARAMETER_DESCRIPTIONS.net_gross_calc.amount,
|
||||||
},
|
},
|
||||||
from: {
|
from: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
enum: ['gross', 'net', null],
|
enum: ['gross', 'net', null],
|
||||||
description: 'Direction when using "amount": "gross" (default) or "net".',
|
description: TOOL_PARAMETER_DESCRIPTIONS.net_gross_calc.from,
|
||||||
},
|
},
|
||||||
precision: {
|
precision: {
|
||||||
type: ['number', 'null'],
|
type: ['number', 'null'],
|
||||||
description: `Decimal precision for net price API value or null (default ${DEFAULT_PRECISION}, between 2 and 8).`,
|
description: TOOL_PARAMETER_DESCRIPTIONS.net_gross_calc.precision,
|
||||||
},
|
},
|
||||||
items: {
|
items: {
|
||||||
type: ['array', 'null'],
|
type: ['array', 'null'],
|
||||||
description: 'Optional array of prices or objects for batch calculation: [19.99, 49.95] or [{ gross: 19.99, taxRate: 7 }].',
|
description: TOOL_PARAMETER_DESCRIPTIONS.net_gross_calc.items,
|
||||||
items: {
|
items: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ export const TOOL_PARAMETER_DESCRIPTIONS = {
|
|||||||
taxRate: 'Tax/VAT rate percentage (e.g. 19 for 19%, 7 for 7%) or null. Default 19.',
|
taxRate: 'Tax/VAT rate percentage (e.g. 19 for 19%, 7 for 7%) or null. Default 19.',
|
||||||
amount: 'Generic price amount or null when used with "from" ("gross" or "net").',
|
amount: 'Generic price amount or null when used with "from" ("gross" or "net").',
|
||||||
from: 'Direction when using "amount": "gross" (default) or "net".',
|
from: 'Direction when using "amount": "gross" (default) or "net".',
|
||||||
precision: 'Decimal precision for net price API value or null (default 4, between 2 and 8).',
|
precision: 'Decimal precision for net price API value or null (default 6, between 2 and 8).',
|
||||||
items: 'Optional array of prices or objects for batch calculation: [19.99, 49.95] or [{ gross: 19.99, taxRate: 7 }].',
|
items: 'Optional array of prices or objects for batch calculation: [19.99, 49.95] or [{ gross: 19.99, taxRate: 7 }].',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defineTool, ToolError } from 'libllmorbiter';
|
import { defineTool, ToolError } from 'libllmorbiter';
|
||||||
import { getStore, getProvider } from '../db/store.js';
|
import { getStore, getProvider } from '../db/store.js';
|
||||||
import { TOOL_DESCRIPTIONS } from './prompts.js';
|
import { TOOL_DESCRIPTIONS, TOOL_PARAMETER_DESCRIPTIONS } from './prompts.js';
|
||||||
|
|
||||||
const DEFAULT_LIMIT = 3;
|
const DEFAULT_LIMIT = 3;
|
||||||
const MAX_LIMIT = 20;
|
const MAX_LIMIT = 20;
|
||||||
@@ -32,19 +32,19 @@ export function createSearchArticlesTool({ googleAuthId, companyId }) {
|
|||||||
properties: {
|
properties: {
|
||||||
searchquery: {
|
searchquery: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
description: 'Words that must all match across name, brand, EAN, SKU, or supplier SKU (AND logic, order-independent) or null.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.search_articles.searchquery,
|
||||||
},
|
},
|
||||||
excludewords: {
|
excludewords: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
description: 'Words that if all match exclude the article (AND logic, order-independent) or null.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.search_articles.excludewords,
|
||||||
},
|
},
|
||||||
offset: {
|
offset: {
|
||||||
type: ['integer', 'null'],
|
type: ['integer', 'null'],
|
||||||
description: 'Pagination offset or null. Default 0.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.search_articles.offset,
|
||||||
},
|
},
|
||||||
limit: {
|
limit: {
|
||||||
type: ['integer', 'null'],
|
type: ['integer', 'null'],
|
||||||
description: `Result window size (1–${MAX_LIMIT}) or null. Default ${DEFAULT_LIMIT}.`,
|
description: TOOL_PARAMETER_DESCRIPTIONS.search_articles.limit,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defineTool, ToolError } from 'libllmorbiter';
|
import { defineTool, ToolError } from 'libllmorbiter';
|
||||||
import * as dbCompanySetting from '../db/companysetting.js';
|
import * as dbCompanySetting from '../db/companysetting.js';
|
||||||
import { TOOL_DESCRIPTIONS } from './prompts.js';
|
import { TOOL_DESCRIPTIONS, TOOL_PARAMETER_DESCRIPTIONS } from './prompts.js';
|
||||||
|
|
||||||
const SERPER_SEARCH_ENDPOINT = 'https://google.serper.dev/search';
|
const SERPER_SEARCH_ENDPOINT = 'https://google.serper.dev/search';
|
||||||
const SEARCH_TIMEOUT_MS = 15_000;
|
const SEARCH_TIMEOUT_MS = 15_000;
|
||||||
@@ -98,28 +98,28 @@ export function createWebSearchTool({ googleAuthId }) {
|
|||||||
properties: {
|
properties: {
|
||||||
note: {
|
note: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
description: 'A note explaining what this search is doing (or null). This note will be displayed to the user while the search is executing.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.web_search.note,
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'Search query.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.web_search.query,
|
||||||
},
|
},
|
||||||
timePeriod: {
|
timePeriod: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
enum: ['day', 'week', 'month', 'year', null],
|
enum: ['day', 'week', 'month', 'year', null],
|
||||||
description: 'Time filter: "day", "week", "month", or "year", or null.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.web_search.timePeriod,
|
||||||
},
|
},
|
||||||
gl: {
|
gl: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
description: 'Country code or null. Default "de".',
|
description: TOOL_PARAMETER_DESCRIPTIONS.web_search.gl,
|
||||||
},
|
},
|
||||||
hl: {
|
hl: {
|
||||||
type: ['string', 'null'],
|
type: ['string', 'null'],
|
||||||
description: 'Language code or null. Default "de".',
|
description: TOOL_PARAMETER_DESCRIPTIONS.web_search.hl,
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
type: ['number', 'null'],
|
type: ['number', 'null'],
|
||||||
description: 'Result page number (10/page) or null. Default 1.',
|
description: TOOL_PARAMETER_DESCRIPTIONS.web_search.page,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user