@lebiraja/plugintool 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1258 -0
- package/dist/App.d.ts +2 -0
- package/dist/api/chat.d.ts +17 -0
- package/dist/api/client.d.ts +2 -0
- package/dist/api/files.d.ts +10 -0
- package/dist/api/models.d.ts +4 -0
- package/dist/api/sessions.d.ts +75 -0
- package/dist/api/tools.d.ts +3 -0
- package/dist/components/ChatInterface.d.ts +6 -0
- package/dist/components/FileCard.d.ts +10 -0
- package/dist/components/LeftSidebar.d.ts +5 -0
- package/dist/components/MessageList.d.ts +7 -0
- package/dist/components/RightSidebar.d.ts +7 -0
- package/dist/components/SessionSidebar.d.ts +10 -0
- package/dist/components/SettingsModal.d.ts +6 -0
- package/dist/components/UnifiedChatInterface.d.ts +9 -0
- package/dist/components/common/BackendStatusBanner.d.ts +1 -0
- package/dist/components/common/ErrorBoundary.d.ts +18 -0
- package/dist/components/common/MarkdownRenderer.d.ts +7 -0
- package/dist/components/research/DeepResearchPanel.d.ts +2 -0
- package/dist/components/research/ResearchResultsView.d.ts +7 -0
- package/dist/hooks/useBackendStatus.d.ts +11 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +22703 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/services/deepResearchService.d.ts +36 -0
- package/dist/store/chatStore.d.ts +17 -0
- package/dist/store/deepResearchStore.d.ts +18 -0
- package/dist/store/fileStore.d.ts +12 -0
- package/dist/store/sessionStore.d.ts +32 -0
- package/dist/store/settingsStore.d.ts +24 -0
- package/dist/types/index.d.ts +170 -0
- package/package.json +90 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DeepResearchRequest, ResearchResult } from '../types';
|
|
2
|
+
export declare const deepResearchService: {
|
|
3
|
+
/**
|
|
4
|
+
* Conduct comprehensive deep research
|
|
5
|
+
*/
|
|
6
|
+
conductResearch(request: DeepResearchRequest): Promise<ResearchResult>;
|
|
7
|
+
/**
|
|
8
|
+
* Get research status by ID
|
|
9
|
+
*/
|
|
10
|
+
getResearchStatus(researchId: string): Promise<{
|
|
11
|
+
research_id: string;
|
|
12
|
+
status: string;
|
|
13
|
+
progress?: string;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Get cache statistics
|
|
17
|
+
*/
|
|
18
|
+
getCacheStats(): Promise<{
|
|
19
|
+
cache_size: number;
|
|
20
|
+
cached_research: Array<{
|
|
21
|
+
research_id: string;
|
|
22
|
+
query: string;
|
|
23
|
+
created_at: string;
|
|
24
|
+
sources: number;
|
|
25
|
+
cache_hits: number;
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Clear research cache
|
|
30
|
+
*/
|
|
31
|
+
clearCache(): Promise<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
cleared_count: number;
|
|
34
|
+
message: string;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Message, ChatStats, RAGResult, SearchResult } from '../types';
|
|
2
|
+
interface ChatStore {
|
|
3
|
+
messages: Message[];
|
|
4
|
+
isStreaming: boolean;
|
|
5
|
+
stats: ChatStats;
|
|
6
|
+
currentContext: RAGResult[];
|
|
7
|
+
currentSearchResults: SearchResult[];
|
|
8
|
+
addMessage: (message: Message) => void;
|
|
9
|
+
updateMessage: (id: string, content: Partial<Message>) => void;
|
|
10
|
+
clearMessages: () => void;
|
|
11
|
+
setStreaming: (streaming: boolean) => void;
|
|
12
|
+
updateStats: (tokens: number, latency: number) => void;
|
|
13
|
+
setCurrentContext: (context: RAGResult[]) => void;
|
|
14
|
+
setCurrentSearchResults: (results: SearchResult[]) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const useChatStore: import('zustand').UseBoundStore<import('zustand').StoreApi<ChatStore>>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ResearchResult, ResearchProgress, ResearchStage } from '../types';
|
|
2
|
+
interface DeepResearchState {
|
|
3
|
+
currentResearch: ResearchResult | null;
|
|
4
|
+
progress: ResearchProgress;
|
|
5
|
+
isResearching: boolean;
|
|
6
|
+
error: string | null;
|
|
7
|
+
researchHistory: ResearchResult[];
|
|
8
|
+
setProgress: (progress: ResearchProgress) => void;
|
|
9
|
+
setCurrentResearch: (research: ResearchResult | null) => void;
|
|
10
|
+
setIsResearching: (isResearching: boolean) => void;
|
|
11
|
+
setError: (error: string | null) => void;
|
|
12
|
+
addToHistory: (research: ResearchResult) => void;
|
|
13
|
+
clearCurrentResearch: () => void;
|
|
14
|
+
clearHistory: () => void;
|
|
15
|
+
updateStage: (stage: ResearchStage, message: string, progress?: number) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const useDeepResearchStore: import('zustand').UseBoundStore<import('zustand').StoreApi<DeepResearchState>>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UploadedFile } from '../types';
|
|
2
|
+
interface FileStore {
|
|
3
|
+
files: UploadedFile[];
|
|
4
|
+
selectedFiles: string[];
|
|
5
|
+
addFile: (file: UploadedFile) => void;
|
|
6
|
+
removeFile: (fileId: string) => void;
|
|
7
|
+
toggleFileSelection: (fileId: string) => void;
|
|
8
|
+
clearSelection: () => void;
|
|
9
|
+
updateFileProcessing: (fileId: string, processed: boolean, chunks?: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const useFileStore: import('zustand').UseBoundStore<import('zustand').StoreApi<FileStore>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Session, SessionDetail } from '../api/sessions';
|
|
2
|
+
interface SessionStore {
|
|
3
|
+
sessions: Session[];
|
|
4
|
+
currentSessionId: string | null;
|
|
5
|
+
currentSession: SessionDetail | null;
|
|
6
|
+
isLoadingSession: boolean;
|
|
7
|
+
isLoadingSessions: boolean;
|
|
8
|
+
error: string | null;
|
|
9
|
+
fetchSessions: () => Promise<void>;
|
|
10
|
+
createSession: (backend: string, model: string, config?: any) => Promise<string>;
|
|
11
|
+
loadSession: (sessionId: string) => Promise<void>;
|
|
12
|
+
deleteSession: (sessionId: string) => Promise<void>;
|
|
13
|
+
renameSession: (sessionId: string, title: string) => Promise<void>;
|
|
14
|
+
setCurrentSessionId: (sessionId: string | null) => void;
|
|
15
|
+
clearCurrentSession: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const useSessionStore: import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<SessionStore>, "persist"> & {
|
|
18
|
+
persist: {
|
|
19
|
+
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<SessionStore, {
|
|
20
|
+
currentSessionId: string | null;
|
|
21
|
+
}>>) => void;
|
|
22
|
+
clearStorage: () => void;
|
|
23
|
+
rehydrate: () => Promise<void> | void;
|
|
24
|
+
hasHydrated: () => boolean;
|
|
25
|
+
onHydrate: (fn: (state: SessionStore) => void) => () => void;
|
|
26
|
+
onFinishHydration: (fn: (state: SessionStore) => void) => () => void;
|
|
27
|
+
getOptions: () => Partial<import('zustand/middleware').PersistOptions<SessionStore, {
|
|
28
|
+
currentSessionId: string | null;
|
|
29
|
+
}>>;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AppSettings, LLMBackend, ModelConfig, ToolsConfig } from '../types';
|
|
2
|
+
interface SettingsStore {
|
|
3
|
+
settings: AppSettings;
|
|
4
|
+
updateBackend: (backend: LLMBackend) => void;
|
|
5
|
+
setActiveBackend: (backendId: string) => void;
|
|
6
|
+
setActiveModel: (model: string) => void;
|
|
7
|
+
updateModelConfig: (config: Partial<ModelConfig>) => void;
|
|
8
|
+
updateToolsConfig: (config: Partial<ToolsConfig>) => void;
|
|
9
|
+
setConversationMode: (mode: string) => void;
|
|
10
|
+
addBackend: (backend: LLMBackend) => void;
|
|
11
|
+
removeBackend: (backendId: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const useSettingsStore: import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<SettingsStore>, "persist"> & {
|
|
14
|
+
persist: {
|
|
15
|
+
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<SettingsStore, SettingsStore>>) => void;
|
|
16
|
+
clearStorage: () => void;
|
|
17
|
+
rehydrate: () => Promise<void> | void;
|
|
18
|
+
hasHydrated: () => boolean;
|
|
19
|
+
onHydrate: (fn: (state: SettingsStore) => void) => () => void;
|
|
20
|
+
onFinishHydration: (fn: (state: SettingsStore) => void) => () => void;
|
|
21
|
+
getOptions: () => Partial<import('zustand/middleware').PersistOptions<SettingsStore, SettingsStore>>;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
export interface Message {
|
|
2
|
+
id: string;
|
|
3
|
+
role: "user" | "assistant" | "system";
|
|
4
|
+
content: string;
|
|
5
|
+
timestamp: Date;
|
|
6
|
+
tokens?: {
|
|
7
|
+
prompt: number;
|
|
8
|
+
completion: number;
|
|
9
|
+
total: number;
|
|
10
|
+
};
|
|
11
|
+
latency?: number;
|
|
12
|
+
model?: string;
|
|
13
|
+
backend?: string;
|
|
14
|
+
citations?: Citation[];
|
|
15
|
+
retrievedContext?: RetrievedChunk[];
|
|
16
|
+
reasoning?: ReasoningStep[];
|
|
17
|
+
}
|
|
18
|
+
export interface Citation {
|
|
19
|
+
text: string;
|
|
20
|
+
url: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface RetrievedChunk {
|
|
24
|
+
id: string;
|
|
25
|
+
content: string;
|
|
26
|
+
similarity: number;
|
|
27
|
+
source: string;
|
|
28
|
+
metadata?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export interface ReasoningStep {
|
|
31
|
+
step: number;
|
|
32
|
+
action: string;
|
|
33
|
+
observation: string;
|
|
34
|
+
thought: string;
|
|
35
|
+
}
|
|
36
|
+
export interface LLMBackend {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
type: "ollama" | "lmstudio" | "huggingface" | "custom";
|
|
40
|
+
url: string;
|
|
41
|
+
apiKey?: string;
|
|
42
|
+
models: string[];
|
|
43
|
+
isActive: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface ModelConfig {
|
|
46
|
+
temperature: number;
|
|
47
|
+
topP: number;
|
|
48
|
+
maxTokens: number;
|
|
49
|
+
frequencyPenalty: number;
|
|
50
|
+
presencePenalty: number;
|
|
51
|
+
}
|
|
52
|
+
export interface ToolsConfig {
|
|
53
|
+
webSearch: boolean;
|
|
54
|
+
rag: boolean;
|
|
55
|
+
deepResearch: boolean;
|
|
56
|
+
fileUpload: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface ConversationMode {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
enabledTools: string[];
|
|
63
|
+
}
|
|
64
|
+
export interface UploadedFile {
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
type: string;
|
|
68
|
+
size: number;
|
|
69
|
+
uploadedAt: Date;
|
|
70
|
+
processed: boolean;
|
|
71
|
+
chunks?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface AppSettings {
|
|
74
|
+
backends: LLMBackend[];
|
|
75
|
+
activeBackend: string;
|
|
76
|
+
activeModel: string;
|
|
77
|
+
modelConfig: ModelConfig;
|
|
78
|
+
toolsConfig: ToolsConfig;
|
|
79
|
+
conversationMode: string;
|
|
80
|
+
theme: "dark" | "light";
|
|
81
|
+
}
|
|
82
|
+
export interface ChatStats {
|
|
83
|
+
totalTokens: number;
|
|
84
|
+
totalMessages: number;
|
|
85
|
+
averageLatency: number;
|
|
86
|
+
estimatedCost: number;
|
|
87
|
+
sessionStart: Date;
|
|
88
|
+
}
|
|
89
|
+
export interface SearchResult {
|
|
90
|
+
title: string;
|
|
91
|
+
url: string;
|
|
92
|
+
snippet: string;
|
|
93
|
+
content?: string;
|
|
94
|
+
relevance_score?: number;
|
|
95
|
+
word_count?: number;
|
|
96
|
+
}
|
|
97
|
+
export interface RAGResult {
|
|
98
|
+
id: string;
|
|
99
|
+
content: string;
|
|
100
|
+
similarity: number;
|
|
101
|
+
source: string;
|
|
102
|
+
metadata?: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
export interface ResearchPlan {
|
|
105
|
+
main_question: string;
|
|
106
|
+
sub_questions: string[];
|
|
107
|
+
search_queries: string[];
|
|
108
|
+
focus_areas: string[];
|
|
109
|
+
required_depth: number;
|
|
110
|
+
}
|
|
111
|
+
export interface Evidence {
|
|
112
|
+
source_url: string;
|
|
113
|
+
title: string;
|
|
114
|
+
snippet: string;
|
|
115
|
+
relevance_score: number;
|
|
116
|
+
quality_score: number;
|
|
117
|
+
word_count: number;
|
|
118
|
+
}
|
|
119
|
+
export interface ResearchReasoningStep {
|
|
120
|
+
step: number;
|
|
121
|
+
question: string;
|
|
122
|
+
finding: string;
|
|
123
|
+
confidence: number;
|
|
124
|
+
contradictions: string[];
|
|
125
|
+
}
|
|
126
|
+
export interface ResearchReport {
|
|
127
|
+
executive_summary: string;
|
|
128
|
+
insights: string[];
|
|
129
|
+
recommendations: string[];
|
|
130
|
+
caveats: string[];
|
|
131
|
+
}
|
|
132
|
+
export interface ResearchMetadata {
|
|
133
|
+
time_taken: number;
|
|
134
|
+
tokens_used: number;
|
|
135
|
+
searches_performed: number;
|
|
136
|
+
sources_scraped: number;
|
|
137
|
+
llm_calls: number;
|
|
138
|
+
cache_hits: number;
|
|
139
|
+
}
|
|
140
|
+
export interface ResearchResult {
|
|
141
|
+
research_id: string;
|
|
142
|
+
query: string;
|
|
143
|
+
plan: ResearchPlan;
|
|
144
|
+
evidence_count: number;
|
|
145
|
+
top_evidence: Evidence[];
|
|
146
|
+
reasoning_trace: ResearchReasoningStep[];
|
|
147
|
+
final_report: ResearchReport;
|
|
148
|
+
citations: Array<{
|
|
149
|
+
id: string;
|
|
150
|
+
title: string;
|
|
151
|
+
url: string;
|
|
152
|
+
accessed: string;
|
|
153
|
+
}>;
|
|
154
|
+
metadata: ResearchMetadata;
|
|
155
|
+
created_at: string;
|
|
156
|
+
}
|
|
157
|
+
export interface DeepResearchRequest {
|
|
158
|
+
query: string;
|
|
159
|
+
backend: string;
|
|
160
|
+
model: string;
|
|
161
|
+
max_depth?: number;
|
|
162
|
+
max_sources?: number;
|
|
163
|
+
}
|
|
164
|
+
export type ResearchStage = "idle" | "planning" | "searching" | "reasoning" | "synthesizing" | "complete" | "error";
|
|
165
|
+
export interface ResearchProgress {
|
|
166
|
+
stage: ResearchStage;
|
|
167
|
+
progress: number;
|
|
168
|
+
message: string;
|
|
169
|
+
current_step?: string;
|
|
170
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lebiraja/plugintool",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Modern local LLM chat interface with Apple-inspired UI - React components for building AI chat applications",
|
|
6
|
+
"private": false,
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./styles.css": "./dist/styles.css"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/lebiraja/plugin.git"
|
|
25
|
+
},
|
|
26
|
+
"author": "lebiraja",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/lebiraja/plugin/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/lebiraja/plugin#readme",
|
|
32
|
+
"keywords": [
|
|
33
|
+
"llm",
|
|
34
|
+
"chat",
|
|
35
|
+
"react",
|
|
36
|
+
"ai",
|
|
37
|
+
"ollama",
|
|
38
|
+
"lmstudio",
|
|
39
|
+
"chatbot",
|
|
40
|
+
"local-llm",
|
|
41
|
+
"ui-components"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"dev": "vite",
|
|
45
|
+
"build": "tsc && vite build",
|
|
46
|
+
"build:lib": "vite build --mode lib",
|
|
47
|
+
"preview": "vite preview",
|
|
48
|
+
"backend": "cd backend && uvicorn main:app --reload --host 0.0.0.0 --port 8000",
|
|
49
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
50
|
+
"prepublishOnly": "npm run build:lib"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"react": "^18.0.0",
|
|
54
|
+
"react-dom": "^18.0.0"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
58
|
+
"@types/react-window": "^1.8.8",
|
|
59
|
+
"axios": "^1.7.0",
|
|
60
|
+
"clsx": "^2.1.0",
|
|
61
|
+
"date-fns": "^3.6.0",
|
|
62
|
+
"framer-motion": "^11.5.0",
|
|
63
|
+
"lucide-react": "^0.400.0",
|
|
64
|
+
"react": "^18.0.0",
|
|
65
|
+
"react-dom": "^18.0.0",
|
|
66
|
+
"react-dropzone": "^14.2.3",
|
|
67
|
+
"react-markdown": "^9.1.0",
|
|
68
|
+
"react-router-dom": "^6.30.2",
|
|
69
|
+
"react-window": "^2.2.3",
|
|
70
|
+
"remark-gfm": "^4.0.0",
|
|
71
|
+
"tailwind-merge": "^2.4.0",
|
|
72
|
+
"zustand": "^4.5.0"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@types/react": "^18.3.0",
|
|
76
|
+
"@types/react-dom": "^18.3.0",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
78
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
79
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
80
|
+
"autoprefixer": "^10.4.19",
|
|
81
|
+
"eslint": "^8.57.0",
|
|
82
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
83
|
+
"eslint-plugin-react-refresh": "^0.4.9",
|
|
84
|
+
"postcss": "^8.4.38",
|
|
85
|
+
"tailwindcss": "^3.4.0",
|
|
86
|
+
"typescript": "^5.5.0",
|
|
87
|
+
"vite": "^5.4.0",
|
|
88
|
+
"vite-plugin-dts": "^4.5.4"
|
|
89
|
+
}
|
|
90
|
+
}
|