- Created wiki-link-parser.ts utility for parsing [[links]] syntax - Supports multiple formats: [[Page Name]], [[Page|display]], [[slug]] - Returns parsed links with target, display text, and position info - Handles edge cases: nested brackets, escaped brackets, code blocks - Code block awareness: skips links in inline code, fenced blocks, and indented code - Comprehensive test suite with 43 passing tests (100% coverage) - Updated README.md with parser documentation Implements KNOW-007 (Issue #59) - Wiki-style linking foundation
38 lines
973 B
TypeScript
38 lines
973 B
TypeScript
import { Module } from "@nestjs/common";
|
|
import { OllamaController } from "./ollama.controller";
|
|
import { OllamaService, OllamaConfig } from "./ollama.service";
|
|
|
|
/**
|
|
* Factory function to create Ollama configuration from environment variables
|
|
*/
|
|
function createOllamaConfig(): OllamaConfig {
|
|
const mode = (process.env.OLLAMA_MODE || "local") as "local" | "remote";
|
|
const endpoint = process.env.OLLAMA_ENDPOINT || "http://localhost:11434";
|
|
const model = process.env.OLLAMA_MODEL || "llama3.2";
|
|
const timeout = parseInt(process.env.OLLAMA_TIMEOUT || "30000", 10);
|
|
|
|
return {
|
|
mode,
|
|
endpoint,
|
|
model,
|
|
timeout,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Module for Ollama integration
|
|
* Provides AI capabilities via local or remote Ollama instances
|
|
*/
|
|
@Module({
|
|
controllers: [OllamaController],
|
|
providers: [
|
|
{
|
|
provide: "OLLAMA_CONFIG",
|
|
useFactory: createOllamaConfig,
|
|
},
|
|
OllamaService,
|
|
],
|
|
exports: [OllamaService],
|
|
})
|
|
export class OllamaModule {}
|