Skip to content

Commit

Permalink
Skip summarization for docs and use the first few characters instead (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraggle authored Nov 29, 2024
1 parent bd97432 commit 5cf37c0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions front/lib/api/files/upsert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import { SpaceResource } from "@app/lib/resources/space_resource";
import { generateRandomModelSId } from "@app/lib/resources/string_ids";
import logger from "@app/logger/logger";

const ENABLE_LLM_SNIPPETS = false;

class MemoryWritable extends Writable {
private chunks: string[];

Expand Down Expand Up @@ -83,6 +85,15 @@ async function generateSnippet(

return new Ok(snippet);
} else {
if (!ENABLE_LLM_SNIPPETS) {
// Take the first 256 characters
if (content.length > 256) {
return new Ok(content.slice(0, 242) + "... (truncated)");
} else {
return new Ok(content);
}
}

const model = getSmallWhitelistedModel(owner);
if (!model) {
return new Err(
Expand Down

0 comments on commit 5cf37c0

Please sign in to comment.