mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-07 23:15:27 +02:00
feat: implement embeddings for AI chat and enhance tool retrieval
- Introduced a new embeddings system for AI chat, allowing for improved context understanding and response accuracy. - Added functionality to retrieve relevant endpoints based on user queries, enhancing the AI's ability to provide precise information. - Updated the chat panel to restore messages from local storage and persist chat history, improving user experience. - Enhanced error handling and added semantic hints for API parameters, ensuring clearer guidance for users. These changes significantly improve the AI chat capabilities and overall interaction quality within the Dokploy platform.
This commit is contained in:
@@ -206,6 +206,7 @@ export interface CatalogResult {
|
||||
export function buildEndpointCatalog(
|
||||
spec: OpenApiSpec,
|
||||
contextType: ChatContext["type"] = "general",
|
||||
relevantOperationIds?: Set<string>,
|
||||
): CatalogResult {
|
||||
const operationIds = new Set<string>();
|
||||
const allowedTags = getAllowedTags(contextType);
|
||||
@@ -216,6 +217,7 @@ export function buildEndpointCatalog(
|
||||
if (!op.operationId || op.deprecated) continue;
|
||||
if (op.tags?.some((t) => EXCLUDED_TAGS.has(t))) continue;
|
||||
if (allowedTags && !op.tags?.some((t) => allowedTags.has(t))) continue;
|
||||
if (relevantOperationIds && !relevantOperationIds.has(op.operationId)) continue;
|
||||
|
||||
operationIds.add(op.operationId);
|
||||
|
||||
@@ -381,7 +383,7 @@ export function createApiTool(
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
return `API error (${response.status}): ${errorText.slice(0, 500)}`;
|
||||
return `API error (${response.status}): ${errorText.slice(0, 500)}\n\nHint: Check the ENDPOINT CATALOG for required parameters (*). You called "${operationId}" with params: ${JSON.stringify(params ?? {})}`;
|
||||
}
|
||||
|
||||
const json = JSON.stringify(await response.json(), null, 2);
|
||||
|
||||
Reference in New Issue
Block a user