feat(#59): implement wiki-link parser
- 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
This commit is contained in:
37
apps/api/src/ollama/ollama.module.ts
Normal file
37
apps/api/src/ollama/ollama.module.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
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 {}
|
||||
Reference in New Issue
Block a user