```
Update coverage reports and add new validation utilities Add comprehensive validation utilities for Ollama URL and model name Add new API response types and client configuration interfaces Add Logger utility for consistent logging Add validation function for plugin settings Add unit tests for validation functions Update TypeScript configuration Update coverage reports to reflect new code additions ```
This commit is contained in:
+122
@@ -132,3 +132,125 @@ export interface ChatMessage {
|
||||
isStreaming?: boolean;
|
||||
tool_calls?: ToolCall[];
|
||||
}
|
||||
|
||||
/**
|
||||
* API Response Types
|
||||
*/
|
||||
|
||||
export interface OllamaChatResponse {
|
||||
model: string;
|
||||
created_at: string;
|
||||
message: {
|
||||
role: 'assistant';
|
||||
content: string;
|
||||
tool_calls?: ToolCall[];
|
||||
};
|
||||
done: boolean;
|
||||
total_duration?: number;
|
||||
load_duration?: number;
|
||||
prompt_eval_count?: number;
|
||||
eval_count?: number;
|
||||
}
|
||||
|
||||
export interface OllamaStreamResponse {
|
||||
model: string;
|
||||
created_at: string;
|
||||
message: {
|
||||
role: 'assistant';
|
||||
content: string;
|
||||
tool_calls?: ToolCall[];
|
||||
};
|
||||
done: boolean;
|
||||
}
|
||||
|
||||
export interface OllamaErrorResponse {
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface OllamaModelList {
|
||||
models: Array<{
|
||||
name: string;
|
||||
id: string;
|
||||
modified_at: string;
|
||||
size: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface OllamaGenerateResponse {
|
||||
model: string;
|
||||
created_at: string;
|
||||
response: string;
|
||||
done: boolean;
|
||||
context?: number[];
|
||||
total_duration?: number;
|
||||
load_duration?: number;
|
||||
prompt_eval_count?: number;
|
||||
eval_count?: number;
|
||||
}
|
||||
|
||||
export interface OllamaPullStatus {
|
||||
status: string;
|
||||
digest: string;
|
||||
total_size: number;
|
||||
completed_size: number;
|
||||
}
|
||||
|
||||
export interface OllamaEmbeddingResponse {
|
||||
embeddings: number[];
|
||||
model: string;
|
||||
total_duration?: number;
|
||||
load_duration?: number;
|
||||
prompt_eval_count?: number;
|
||||
eval_count?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Client Configuration Types
|
||||
*/
|
||||
|
||||
export interface OllamaClientConfig {
|
||||
url: string;
|
||||
model: string;
|
||||
timeout?: number;
|
||||
maxRetries?: number;
|
||||
}
|
||||
|
||||
export interface OllamaRequestOptions {
|
||||
timeout?: number;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Streaming Types
|
||||
*/
|
||||
|
||||
export interface StreamChunk {
|
||||
content: string;
|
||||
tool_calls?: ToolCall[];
|
||||
done?: boolean;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface StreamMetadata {
|
||||
model: string;
|
||||
created_at: string;
|
||||
done: boolean;
|
||||
total_duration?: number;
|
||||
load_duration?: number;
|
||||
}
|
||||
|
||||
export interface ChatSession {
|
||||
id: string;
|
||||
messages: OllamaMessage[];
|
||||
createdAt: number;
|
||||
model: string;
|
||||
}
|
||||
|
||||
export interface ToolDefinition {
|
||||
type: 'function';
|
||||
function: {
|
||||
name: string;
|
||||
description: string;
|
||||
parameters: Record<string, any>;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user