Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

removed filename constraint from knowledgebase doc names, previously we had some constraints to the filename that are not hard restraints, since we store the file name as-is in the db

Type of Change

  • Bug fix

Testing

Manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Building Building Preview Comment Oct 2, 2025 3:39am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 2, 2025 3:39am

@waleedlatif1 waleedlatif1 merged commit dc60525 into staging Oct 2, 2025
3 of 5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/kb branch October 2, 2025 03:40
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR removes filename validation constraints from the knowledge base document creation tool in the Sim platform. The change eliminates restrictions on special characters (<>:"/\|?*) that were previously prevented in document names when creating knowledge base documents.

The original validation was designed around filesystem naming conventions, but since the Sim knowledge base stores document names directly in the database rather than creating actual files, these constraints were unnecessarily restrictive. The system maintains document metadata in the database, making filesystem-specific character limitations irrelevant to the application's functionality.

This change enhances user experience by providing more flexibility in document naming while maintaining essential constraints like the 255-character length limit, which likely corresponds to database field limitations. The modification is located in the knowledge base tool's document creation functionality, specifically in the parameter validation logic.

Important Files Changed

Changed Files
Filename Score Overview
apps/sim/tools/knowledge/create_document.ts 4/5 Removed special character validation regex for document names, allowing more flexible naming

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it removes unnecessary validation constraints
  • Score reflects a straightforward change that improves usability without introducing technical debt or breaking functionality
  • Pay attention to apps/sim/tools/knowledge/create_document.ts to ensure the remaining validation logic is sufficient

Sequence Diagram

sequenceDiagram
    participant User
    participant API as "Sim API"
    participant KnowledgeService as "Knowledge Service"
    participant Database as "Database"
    participant FileProcessor as "File Processor"

    User->>API: "POST /api/knowledge/{knowledgeBaseId}/documents"
    Note over User,API: Request contains: name, content, tags

    API->>API: "Validate document name length (≤255 chars)"
    API->>API: "Validate content size (≤1MB)"
    API->>API: "Encode content to base64 data URI"
    
    API->>KnowledgeService: "Create document with processing options"
    Note over API,KnowledgeService: Includes chunkSize: 1024, overlap: 200

    KnowledgeService->>Database: "Store document metadata"
    Database-->>KnowledgeService: "Return document ID"

    KnowledgeService->>FileProcessor: "Process document chunks"
    FileProcessor-->>KnowledgeService: "Return processed chunks"

    KnowledgeService-->>API: "Return creation result"
    
    API->>API: "Transform response with document details"
    API-->>User: "Return success with document ID and metadata"
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Collaborator Author

waleedlatif1 commented Oct 2, 2025

1 Job Failed:

CI / Test and Build / Test and Build failed on "Build application"
[...]
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry

   ▲ Next.js 15.4.1 (Turbopack)
   - Experiments (use with caution):
     ✓ optimizeCss
     ⨯ turbopackSourceMaps

   Creating an optimized production build ...
error: script "build" exited with code 130

 Tasks:    2 successful, 4 total
Cached:    0 cached, 4 total
  Time:    37.092s 
Failed:    docs#build

 ERROR  run failed: command  exited (1)
error: script "build" exited with code 1
Error: Process completed with exit code 1.

Summary: 1 failed workflow
  • CI (1 job failed)

Last updated: 2025-10-02 03:41:40 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants