mirror of
https://github.com/fancive/obsidian-parallel-reader.git
synced 2026-07-22 06:53:43 +00:00
refactor: remove dead code and over-broad exports
- Delete unused CacheFile interface (src/types.ts) - Demote internal-only symbols from export to module scope: PROMPT_VERSION, DEFAULT_CLI_TIMEOUT_MS, MIN_STREAMING_TIMEOUT_MS, MIN_CLI_TIMEOUT_MS (settings.ts), CliFailureReason (cli.ts), GenerationErrorContext (error-ui.ts), AnthropicMessagesBody/ OpenAiChatBody/OpenAiResponsesBody/GeminiBody (provider-bodies.ts), BackendTestDeps (backend-test.ts) Verified: tsc, esbuild prod build, biome, all 28 test files pass. Change-Id: I0fc597ee51ec67d509a7f33db39fabcbdb301797
This commit is contained in:
parent
955a86e2c5
commit
de66de5b5c
6 changed files with 11 additions and 21 deletions
|
|
@ -14,7 +14,7 @@ const CLI_TEST_TIMEOUT_MS = 60000;
|
|||
|
||||
type SpawnImpl = Parameters<typeof runCli>[5];
|
||||
|
||||
export interface BackendTestDeps {
|
||||
interface BackendTestDeps {
|
||||
requestUrlImpl?: RequestUrlFunction;
|
||||
spawnImpl?: SpawnImpl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,12 +52,7 @@ export function resolveCliPath(name: string, override: string): string {
|
|||
return name;
|
||||
}
|
||||
|
||||
export type CliFailureReason =
|
||||
| 'wall-timeout'
|
||||
| 'exit-nonzero'
|
||||
| 'streams-unavailable'
|
||||
| 'spawn-failure'
|
||||
| 'startup-error';
|
||||
type CliFailureReason = 'wall-timeout' | 'exit-nonzero' | 'streams-unavailable' | 'spawn-failure' | 'startup-error';
|
||||
|
||||
export interface CliErrorDetails {
|
||||
reason: CliFailureReason;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { translate } from './i18n';
|
|||
import type { ErrorKind, PluginSettings } from './types';
|
||||
import { copyToClipboard } from './ui-helpers';
|
||||
|
||||
export interface GenerationErrorContext {
|
||||
interface GenerationErrorContext {
|
||||
app: App;
|
||||
settings: PluginSettings;
|
||||
/** Open the plugin settings tab (best-effort; falls back to no-op if unavailable). */
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import type { PluginSettings } from './types';
|
|||
|
||||
/* ---------- Body type interfaces ---------- */
|
||||
|
||||
export interface AnthropicMessagesBody {
|
||||
interface AnthropicMessagesBody {
|
||||
model: string;
|
||||
max_tokens: number;
|
||||
system: string;
|
||||
|
|
@ -22,7 +22,7 @@ export interface AnthropicMessagesBody {
|
|||
stream?: boolean;
|
||||
}
|
||||
|
||||
export interface OpenAiChatBody {
|
||||
interface OpenAiChatBody {
|
||||
model: string;
|
||||
messages: Array<{ role: string; content: string }>;
|
||||
response_format?: unknown;
|
||||
|
|
@ -30,7 +30,7 @@ export interface OpenAiChatBody {
|
|||
[tokenField: string]: unknown;
|
||||
}
|
||||
|
||||
export interface OpenAiResponsesBody {
|
||||
interface OpenAiResponsesBody {
|
||||
model: string;
|
||||
instructions: string;
|
||||
input: string;
|
||||
|
|
@ -46,7 +46,7 @@ interface GeminiGenerationConfig {
|
|||
responseJsonSchema?: unknown;
|
||||
}
|
||||
|
||||
export interface GeminiBody {
|
||||
interface GeminiBody {
|
||||
systemInstruction: { parts: Array<{ text: string }> };
|
||||
contents: Array<{ role: string; parts: Array<{ text: string }> }>;
|
||||
generationConfig: GeminiGenerationConfig;
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ import type { ApiFormat, ApiProviderPreset, CacheEntry, PluginSettings } from '.
|
|||
export { API_PROVIDER_PRESETS } from './provider-presets';
|
||||
|
||||
export const MAX_DOC_CHARS = 100000;
|
||||
export const PROMPT_VERSION = 2;
|
||||
const PROMPT_VERSION = 2;
|
||||
export const CACHE_SCHEMA_VERSION = 2;
|
||||
export const DEFAULT_MAX_CACHE_ENTRIES = 100;
|
||||
export const DEFAULT_CLI_TIMEOUT_MS = 300000;
|
||||
export const MIN_STREAMING_TIMEOUT_MS = 1000;
|
||||
export const MIN_CLI_TIMEOUT_MS = 1000;
|
||||
const DEFAULT_CLI_TIMEOUT_MS = 300000;
|
||||
const MIN_STREAMING_TIMEOUT_MS = 1000;
|
||||
const MIN_CLI_TIMEOUT_MS = 1000;
|
||||
export const PROMPT_LANGUAGES = {
|
||||
zh: '中文',
|
||||
en: 'English',
|
||||
|
|
|
|||
|
|
@ -37,11 +37,6 @@ export interface CacheEntry {
|
|||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface CacheFile {
|
||||
version: number;
|
||||
entries: Record<string, CacheEntry>;
|
||||
}
|
||||
|
||||
/* ---------- Settings types ---------- */
|
||||
|
||||
export interface PluginSettings {
|
||||
|
|
|
|||
Loading…
Reference in a new issue