add stub for file context

master
io42630 2 weeks ago
parent 78f3fc404d
commit 7e7bd03970

@ -12,9 +12,11 @@ repositories {
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.38")
implementation("io.github.amithkoujalgi:ollama4j:1.0.70") implementation("io.github.amithkoujalgi:ollama4j:1.0.70")
implementation("org.slf4j:slf4j-jdk14:2.1.0-alpha1") implementation("org.slf4j:slf4j-jdk14:2.1.0-alpha1")
implementation("com.google.guava:guava:33.4.8-jre") implementation("com.google.guava:guava:33.4.8-jre")
implementation("dev.langchain4j:langchain4j:0.36.2")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
testImplementation(kotlin("test-junit")) testImplementation(kotlin("test-junit"))
} }

@ -16,6 +16,12 @@ class L3InlineCompletionProvider : InlineCompletionProvider {
override suspend fun getSuggestion(request: InlineCompletionRequest): InlineCompletionSuggestion { override suspend fun getSuggestion(request: InlineCompletionRequest): InlineCompletionSuggestion {
val startTime = System.nanoTime() val startTime = System.nanoTime()
request.editor.project?.basePath
return InlineCompletionSuggestion.Default( return InlineCompletionSuggestion.Default(
channelFlow { channelFlow {
val (prefix, suffix) = request.document.text.splitUsingOffset(request.startOffset) val (prefix, suffix) = request.document.text.splitUsingOffset(request.startOffset)

@ -0,0 +1,25 @@
package com.plexworlds.l3.vectors;
import dev.langchain4j.data.document.Document;
import lombok.extern.slf4j.Slf4j;
import java.nio.file.Path;
import static dev.langchain4j.data.document.loader.FileSystemDocumentLoader.*;
// TODO: go figure https://github.com/langchain4j/langchain4j-examples
@Slf4j
public class DocLoader {
private static void loadSingleDocument(Path path) {
Document document = loadDocument(path);
log.info("");
}
}

@ -0,0 +1,21 @@
package com.plexworlds.l3.vectors;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Stream;
public class FileLoader {
public static List<String> getAllFileNames(String rootDir) throws IOException {
try (Stream<Path> paths = Files.walk(Paths.get(rootDir))) {
return paths
.filter(Files::isRegularFile)
.map(Path::toAbsolutePath)
.map(Path::toString)
.toList();
}
}
}
Loading…
Cancel
Save