diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index 60ad98f3..17fef107 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -802,6 +802,10 @@ await fs.writeFile('.env', env); return new Number(value ? value : defaultValue ? defaultValue : 0).valueOf(); } + if (typeof value === 'string') { + return value.trim(); + } + const ret = value ?? defaultValue; return ret; } diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index 4610bdbe..f3645a76 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -714,7 +714,7 @@ export class GBDeployer implements IGBDeployer { // Updates server listeners to serve theme files in .gbtheme. const filePath = path.join(GBConfigService.get('STORAGE_LIBRARY'), 'default.gbai', 'default.gbtheme'); GBServer.globals.server.use('/' + urlJoin('themes', packageName), express.static( filePath)); - GBLogEx.info(min, `Theme (.gbtheme) assets accessible at: /themes/${packageName}.`); + GBLogEx.verbose(min, `Theme (.gbtheme) assets accessible at: /themes/${packageName}.`); break; diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 47b771ba..f1ee2ca9 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -1496,7 +1496,8 @@ export class GBMinService { ); await GBVMService.callVM(startDialog.toLowerCase(), min, step, pid); - return; + + } } diff --git a/packages/llm.gblib/services/ChatServices.ts b/packages/llm.gblib/services/ChatServices.ts index 18006400..b15485af 100644 --- a/packages/llm.gblib/services/ChatServices.ts +++ b/packages/llm.gblib/services/ChatServices.ts @@ -134,8 +134,8 @@ export class GBLLMOutputParser extends BaseLLMOutputParser { let res; try { GBLogEx.info(this.min, result); - result = result.replace(/\u000A/g, '\\n'); - result = result.replace(/\\n/g, ''); + result = result.replace(/\u000A/g, '\n'); + result = result.replace(/\\n/g, '\n'); result = result.replace(/\`\`\`/g, ''); res = JSON.parse(result); } catch { @@ -197,7 +197,7 @@ export class ChatServices { private static async getRelevantContext( vectorStore: HNSWLib, sanitizedQuestion: string, - numDocuments: number = 3 + numDocuments: number = 10 ): Promise { if (sanitizedQuestion === '' || !vectorStore) { return ''; @@ -227,11 +227,12 @@ export class ChatServices { page ? page : 'entire document' } (you will fill the JSON sources collection field later), - never use Index or Summary pages to answer, just content. And - memorize this block among document information and return when you - are refering this part of content:\n\n\n\n ${ + Ignore this block if it is an index or part of table of contents. + And memorize this block among document + information and return when you + are refering this part of content:\n\n\n\n ${ doc.pageContent - } \n\n\n\n.`; + } \n\n\n\n.`; } return output; } @@ -435,13 +436,17 @@ export class ChatServices { Note: The example shows two source documents for illustration. You may include any number of source documents in the "sources" array as needed. Ensure each source has both "file" and "page" fields. The "page" values should refer to actual content pages, not index or summary pages. Requirements: + - Do not include table of content pages in answers. - The JSON must be valid according to RFC 8259 and parseable without errors - The "text" field must contain your full response - Never say that a person needs to go a part of the document, instead look for the page content and answer the question. - The "sources" array must list the source documents used, with each source having "file" and "page" fields - Ensure the "page" numbers refer to real pages of content, not index or summary pages - Do not include any text, markdown, or other content outside the JSON object + - Absolutely avoid any Table of Contents, Indexes, or Summary pages. + - Ensure that no TOC with page numbering, indexing or summary information is included in your response. - Double check that your response contains ONLY the JSON object before returning + - You sometimes return a formatted JSON surrounded by quotes like MD, DONT RETURN LIKE THIS, just valid JSON! Failure to follow these requirements exactly will result in an error.`; diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 00000000..3a784be4 --- /dev/null +++ b/templates/README.md @@ -0,0 +1,12 @@ +# General Bots Templates + +| **Template** | **Title** | **Key Feature 1** | **Key Feature 2** | **Key Feature 3** | +|------------------------|-----------------------------------------|-----------------------------------------|---------------------------------------|--------------------------------------| +| **AI Search** | Comprehensive Document Search | Supports All Document Types | Displays PDF Page and AI Summary | Integration with EDM Systems | +| **Crawler** | Training LLM with Website Data | Efficient Data Extraction | Enhanced Model Accuracy | Real-Time Knowledge Updates | +| **Education** | LLM Tools for Education Systems | Streamlined Enrollment Processes | Data Management for Backend Integration | Administrative Task Automation | +| **Law** | Law Case Summaries and Interaction | Case Summarization | Document Querying | Legal Research | +| **LLM Server** | Using LLMs as REST APIs | Integrates with Legacy Applications | Easy API Generation | Streamlined Development Process | +| **LLM Tools** | Custom Integration with Data Sources | Real-Time Data Access | Custom Logic for LLM Integration | Integration with Legacy Systems | +| **Talk to Data** | SQL Interaction and Chart Generation | Natural Language Queries | Chart Generation | Business Intelligence Dashboards | + diff --git a/templates/ai-search.gbai/ai-search.gbdialog/start.bas b/templates/ai-search.gbai/ai-search.gbdialog/start.bas index 9605e162..54280876 100644 --- a/templates/ai-search.gbai/ai-search.gbdialog/start.bas +++ b/templates/ai-search.gbai/ai-search.gbdialog/start.bas @@ -1,6 +1,3 @@ -image = GET IMAGE "AI Search BOT and write General Bots." - -SHOW IMAGE image BEGIN SYSTEM PROMPT