@contractspec/module.ai-chat 1.44.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 +169 -0
- package/dist/ai-chat.feature.d.ts +12 -0
- package/dist/ai-chat.feature.d.ts.map +1 -0
- package/dist/ai-chat.feature.js +95 -0
- package/dist/ai-chat.feature.js.map +1 -0
- package/dist/ai-chat.operations.d.ts +243 -0
- package/dist/ai-chat.operations.d.ts.map +1 -0
- package/dist/ai-chat.operations.js +174 -0
- package/dist/ai-chat.operations.js.map +1 -0
- package/dist/context/context-builder.d.ts +57 -0
- package/dist/context/context-builder.d.ts.map +1 -0
- package/dist/context/context-builder.js +148 -0
- package/dist/context/context-builder.js.map +1 -0
- package/dist/context/file-operations.d.ts +100 -0
- package/dist/context/file-operations.d.ts.map +1 -0
- package/dist/context/file-operations.js +175 -0
- package/dist/context/file-operations.js.map +1 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/index.js +5 -0
- package/dist/context/workspace-context.d.ts +117 -0
- package/dist/context/workspace-context.d.ts.map +1 -0
- package/dist/context/workspace-context.js +124 -0
- package/dist/context/workspace-context.js.map +1 -0
- package/dist/core/chat-service.d.ts +73 -0
- package/dist/core/chat-service.d.ts.map +1 -0
- package/dist/core/chat-service.js +227 -0
- package/dist/core/chat-service.js.map +1 -0
- package/dist/core/conversation-store.d.ts +74 -0
- package/dist/core/conversation-store.d.ts.map +1 -0
- package/dist/core/conversation-store.js +109 -0
- package/dist/core/conversation-store.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +4 -0
- package/dist/core/message-types.d.ts +150 -0
- package/dist/core/message-types.d.ts.map +1 -0
- package/dist/events.d.ts +115 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +100 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +23 -0
- package/dist/libs/schema/dist/EnumType.js +2 -0
- package/dist/libs/schema/dist/FieldType.js +50 -0
- package/dist/libs/schema/dist/FieldType.js.map +1 -0
- package/dist/libs/schema/dist/GraphQLSchemaType.js +1 -0
- package/dist/libs/schema/dist/JsonSchemaType.js +1 -0
- package/dist/libs/schema/dist/ScalarTypeEnum.js +237 -0
- package/dist/libs/schema/dist/ScalarTypeEnum.js.map +1 -0
- package/dist/libs/schema/dist/SchemaModel.js +40 -0
- package/dist/libs/schema/dist/SchemaModel.js.map +1 -0
- package/dist/libs/schema/dist/ZodSchemaType.js +1 -0
- package/dist/libs/schema/dist/entity/defineEntity.js +1 -0
- package/dist/libs/schema/dist/entity/index.js +2 -0
- package/dist/libs/schema/dist/entity/types.js +1 -0
- package/dist/libs/schema/dist/index.js +9 -0
- package/dist/presentation/components/ChatContainer.d.ts +21 -0
- package/dist/presentation/components/ChatContainer.d.ts.map +1 -0
- package/dist/presentation/components/ChatContainer.js +63 -0
- package/dist/presentation/components/ChatContainer.js.map +1 -0
- package/dist/presentation/components/ChatInput.d.ts +35 -0
- package/dist/presentation/components/ChatInput.d.ts.map +1 -0
- package/dist/presentation/components/ChatInput.js +149 -0
- package/dist/presentation/components/ChatInput.js.map +1 -0
- package/dist/presentation/components/ChatMessage.d.ts +24 -0
- package/dist/presentation/components/ChatMessage.d.ts.map +1 -0
- package/dist/presentation/components/ChatMessage.js +136 -0
- package/dist/presentation/components/ChatMessage.js.map +1 -0
- package/dist/presentation/components/CodePreview.d.ts +40 -0
- package/dist/presentation/components/CodePreview.d.ts.map +1 -0
- package/dist/presentation/components/CodePreview.js +127 -0
- package/dist/presentation/components/CodePreview.js.map +1 -0
- package/dist/presentation/components/ContextIndicator.d.ts +26 -0
- package/dist/presentation/components/ContextIndicator.d.ts.map +1 -0
- package/dist/presentation/components/ContextIndicator.js +97 -0
- package/dist/presentation/components/ContextIndicator.js.map +1 -0
- package/dist/presentation/components/ModelPicker.d.ts +39 -0
- package/dist/presentation/components/ModelPicker.d.ts.map +1 -0
- package/dist/presentation/components/ModelPicker.js +202 -0
- package/dist/presentation/components/ModelPicker.js.map +1 -0
- package/dist/presentation/components/index.d.ts +7 -0
- package/dist/presentation/components/index.js +8 -0
- package/dist/presentation/hooks/index.d.ts +3 -0
- package/dist/presentation/hooks/index.js +4 -0
- package/dist/presentation/hooks/useChat.d.ts +67 -0
- package/dist/presentation/hooks/useChat.d.ts.map +1 -0
- package/dist/presentation/hooks/useChat.js +172 -0
- package/dist/presentation/hooks/useChat.js.map +1 -0
- package/dist/presentation/hooks/useProviders.d.ts +38 -0
- package/dist/presentation/hooks/useProviders.d.ts.map +1 -0
- package/dist/presentation/hooks/useProviders.js +41 -0
- package/dist/presentation/hooks/useProviders.js.map +1 -0
- package/dist/presentation/index.d.ts +11 -0
- package/dist/presentation/index.js +12 -0
- package/dist/providers/chat-utilities.d.ts +15 -0
- package/dist/providers/chat-utilities.d.ts.map +1 -0
- package/dist/providers/chat-utilities.js +17 -0
- package/dist/providers/chat-utilities.js.map +1 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +4 -0
- package/dist/schema.d.ts +222 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +102 -0
- package/dist/schema.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChat.d.ts","names":[],"sources":["../../../src/presentation/hooks/useChat.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkBA;AAEa,UAFI,cAAA,CAEJ;EAEJ;EAcY,QAAA,CAAA,EAhBR,YAgBQ;EAEI;EAEL,IAAA,CAAA,EAlBX,YAkBW;EAAK;EAQR,KAAA,CAAA,EAAA,MAAA;EAEL;EAEI,MAAA,CAAA,EAAA,MAAA;EAIP;EAIS,QAAA,CAAA,EAAA,MAAA;EACX;EAMa,cAAA,CAAA,EAAA,MAAA;EAAO;EAQX,YAAO,CAAA,EAAA,MAAA;;;;qBAvCF;;yBAEI;;oBAEL;;;;;;;;;;UAQH,aAAA;;YAEL;;gBAEI;;;;SAIP;;+CAIS,qBACX;;;;;;oBAMa;;;;;;;iBAQJ,OAAA,WAAiB,iBAAsB"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ChatService } from "../../core/chat-service.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { createProvider } from "@contractspec/lib.ai-providers";
|
|
6
|
+
|
|
7
|
+
//#region src/presentation/hooks/useChat.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Hook for managing AI chat state
|
|
10
|
+
*/
|
|
11
|
+
function useChat(options = {}) {
|
|
12
|
+
const { provider = "openai", mode = "byok", model, apiKey, proxyUrl, conversationId: initialConversationId, systemPrompt, streaming = true, onSend, onResponse, onError, onUsage } = options;
|
|
13
|
+
const [messages, setMessages] = React.useState([]);
|
|
14
|
+
const [conversation, setConversation] = React.useState(null);
|
|
15
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
16
|
+
const [error, setError] = React.useState(null);
|
|
17
|
+
const [conversationId, setConversationId] = React.useState(initialConversationId ?? null);
|
|
18
|
+
const abortControllerRef = React.useRef(null);
|
|
19
|
+
const chatServiceRef = React.useRef(null);
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
chatServiceRef.current = new ChatService({
|
|
22
|
+
provider: createProvider({
|
|
23
|
+
provider,
|
|
24
|
+
model,
|
|
25
|
+
apiKey,
|
|
26
|
+
proxyUrl
|
|
27
|
+
}),
|
|
28
|
+
systemPrompt,
|
|
29
|
+
onUsage
|
|
30
|
+
});
|
|
31
|
+
}, [
|
|
32
|
+
provider,
|
|
33
|
+
mode,
|
|
34
|
+
model,
|
|
35
|
+
apiKey,
|
|
36
|
+
proxyUrl,
|
|
37
|
+
systemPrompt,
|
|
38
|
+
onUsage
|
|
39
|
+
]);
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
if (!conversationId || !chatServiceRef.current) return;
|
|
42
|
+
const loadConversation = async () => {
|
|
43
|
+
if (!chatServiceRef.current) return;
|
|
44
|
+
const conv = await chatServiceRef.current.getConversation(conversationId);
|
|
45
|
+
if (conv) {
|
|
46
|
+
setConversation(conv);
|
|
47
|
+
setMessages(conv.messages);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
loadConversation().catch(console.error);
|
|
51
|
+
}, [conversationId]);
|
|
52
|
+
const sendMessage = React.useCallback(async (content, attachments) => {
|
|
53
|
+
if (!chatServiceRef.current) throw new Error("Chat service not initialized");
|
|
54
|
+
setIsLoading(true);
|
|
55
|
+
setError(null);
|
|
56
|
+
abortControllerRef.current = new AbortController();
|
|
57
|
+
try {
|
|
58
|
+
const userMessage = {
|
|
59
|
+
id: `msg_${Date.now()}`,
|
|
60
|
+
conversationId: conversationId ?? "",
|
|
61
|
+
role: "user",
|
|
62
|
+
content,
|
|
63
|
+
status: "completed",
|
|
64
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
65
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
66
|
+
attachments
|
|
67
|
+
};
|
|
68
|
+
setMessages((prev) => [...prev, userMessage]);
|
|
69
|
+
onSend?.(userMessage);
|
|
70
|
+
if (streaming) {
|
|
71
|
+
const result = await chatServiceRef.current.stream({
|
|
72
|
+
conversationId: conversationId ?? void 0,
|
|
73
|
+
content,
|
|
74
|
+
attachments
|
|
75
|
+
});
|
|
76
|
+
if (!conversationId) setConversationId(result.conversationId);
|
|
77
|
+
const assistantMessage = {
|
|
78
|
+
id: result.messageId,
|
|
79
|
+
conversationId: result.conversationId,
|
|
80
|
+
role: "assistant",
|
|
81
|
+
content: "",
|
|
82
|
+
status: "streaming",
|
|
83
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
84
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
85
|
+
};
|
|
86
|
+
setMessages((prev) => [...prev, assistantMessage]);
|
|
87
|
+
let fullContent = "";
|
|
88
|
+
for await (const chunk of result.stream) if (chunk.type === "text" && chunk.content) {
|
|
89
|
+
fullContent += chunk.content;
|
|
90
|
+
setMessages((prev) => prev.map((m) => m.id === result.messageId ? {
|
|
91
|
+
...m,
|
|
92
|
+
content: fullContent
|
|
93
|
+
} : m));
|
|
94
|
+
} else if (chunk.type === "done") {
|
|
95
|
+
setMessages((prev) => prev.map((m) => m.id === result.messageId ? {
|
|
96
|
+
...m,
|
|
97
|
+
status: "completed",
|
|
98
|
+
usage: chunk.usage,
|
|
99
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
100
|
+
} : m));
|
|
101
|
+
onResponse?.(messages.find((m) => m.id === result.messageId) ?? assistantMessage);
|
|
102
|
+
} else if (chunk.type === "error") {
|
|
103
|
+
setMessages((prev) => prev.map((m) => m.id === result.messageId ? {
|
|
104
|
+
...m,
|
|
105
|
+
status: "error",
|
|
106
|
+
error: chunk.error,
|
|
107
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
108
|
+
} : m));
|
|
109
|
+
if (chunk.error) {
|
|
110
|
+
const err = new Error(chunk.error.message);
|
|
111
|
+
setError(err);
|
|
112
|
+
onError?.(err);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
const result = await chatServiceRef.current.send({
|
|
117
|
+
conversationId: conversationId ?? void 0,
|
|
118
|
+
content,
|
|
119
|
+
attachments
|
|
120
|
+
});
|
|
121
|
+
setConversation(result.conversation);
|
|
122
|
+
setMessages(result.conversation.messages);
|
|
123
|
+
if (!conversationId) setConversationId(result.conversation.id);
|
|
124
|
+
onResponse?.(result.message);
|
|
125
|
+
}
|
|
126
|
+
} catch (err) {
|
|
127
|
+
const error$1 = err instanceof Error ? err : new Error(String(err));
|
|
128
|
+
setError(error$1);
|
|
129
|
+
onError?.(error$1);
|
|
130
|
+
} finally {
|
|
131
|
+
setIsLoading(false);
|
|
132
|
+
abortControllerRef.current = null;
|
|
133
|
+
}
|
|
134
|
+
}, [
|
|
135
|
+
conversationId,
|
|
136
|
+
streaming,
|
|
137
|
+
onSend,
|
|
138
|
+
onResponse,
|
|
139
|
+
onError,
|
|
140
|
+
messages
|
|
141
|
+
]);
|
|
142
|
+
return {
|
|
143
|
+
messages,
|
|
144
|
+
conversation,
|
|
145
|
+
isLoading,
|
|
146
|
+
error,
|
|
147
|
+
sendMessage,
|
|
148
|
+
clearConversation: React.useCallback(() => {
|
|
149
|
+
setMessages([]);
|
|
150
|
+
setConversation(null);
|
|
151
|
+
setConversationId(null);
|
|
152
|
+
setError(null);
|
|
153
|
+
}, []),
|
|
154
|
+
setConversationId,
|
|
155
|
+
regenerate: React.useCallback(async () => {
|
|
156
|
+
const lastUserMessageIndex = messages.findLastIndex((m) => m.role === "user");
|
|
157
|
+
if (lastUserMessageIndex === -1) return;
|
|
158
|
+
const lastUserMessage = messages[lastUserMessageIndex];
|
|
159
|
+
if (!lastUserMessage) return;
|
|
160
|
+
setMessages((prev) => prev.slice(0, lastUserMessageIndex + 1));
|
|
161
|
+
await sendMessage(lastUserMessage.content, lastUserMessage.attachments);
|
|
162
|
+
}, [messages, sendMessage]),
|
|
163
|
+
stop: React.useCallback(() => {
|
|
164
|
+
abortControllerRef.current?.abort();
|
|
165
|
+
setIsLoading(false);
|
|
166
|
+
}, [])
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
export { useChat };
|
|
172
|
+
//# sourceMappingURL=useChat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChat.js","names":["userMessage: ChatMessage","assistantMessage: ChatMessage","error"],"sources":["../../../src/presentation/hooks/useChat.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type {\n ChatAttachment,\n ChatConversation,\n ChatMessage,\n} from '../../core/message-types';\nimport { ChatService } from '../../core/chat-service';\nimport {\n createProvider,\n type ProviderMode,\n type ProviderName,\n} from '@contractspec/lib.ai-providers';\n\n/**\n * Options for useChat hook\n */\nexport interface UseChatOptions {\n /** Provider to use */\n provider?: ProviderName;\n /** Provider mode */\n mode?: ProviderMode;\n /** Model to use */\n model?: string;\n /** API key for BYOK mode */\n apiKey?: string;\n /** API proxy URL for managed mode */\n proxyUrl?: string;\n /** Initial conversation ID to resume */\n conversationId?: string;\n /** System prompt override */\n systemPrompt?: string;\n /** Enable streaming */\n streaming?: boolean;\n /** Called when a message is sent */\n onSend?: (message: ChatMessage) => void;\n /** Called when a response is received */\n onResponse?: (message: ChatMessage) => void;\n /** Called on error */\n onError?: (error: Error) => void;\n /** Called when usage is recorded */\n onUsage?: (usage: { inputTokens: number; outputTokens: number }) => void;\n}\n\n/**\n * Return type for useChat hook\n */\nexport interface UseChatReturn {\n /** Current messages */\n messages: ChatMessage[];\n /** Current conversation */\n conversation: ChatConversation | null;\n /** Whether currently loading/streaming */\n isLoading: boolean;\n /** Current error */\n error: Error | null;\n /** Send a message */\n sendMessage: (\n content: string,\n attachments?: ChatAttachment[]\n ) => Promise<void>;\n /** Clear conversation and start fresh */\n clearConversation: () => void;\n /** Set conversation ID to resume */\n setConversationId: (id: string | null) => void;\n /** Regenerate last response */\n regenerate: () => Promise<void>;\n /** Stop current generation */\n stop: () => void;\n}\n\n/**\n * Hook for managing AI chat state\n */\nexport function useChat(options: UseChatOptions = {}): UseChatReturn {\n const {\n provider = 'openai',\n mode = 'byok',\n model,\n apiKey,\n proxyUrl,\n conversationId: initialConversationId,\n systemPrompt,\n streaming = true,\n onSend,\n onResponse,\n onError,\n onUsage,\n } = options;\n\n const [messages, setMessages] = React.useState<ChatMessage[]>([]);\n const [conversation, setConversation] =\n React.useState<ChatConversation | null>(null);\n const [isLoading, setIsLoading] = React.useState(false);\n const [error, setError] = React.useState<Error | null>(null);\n const [conversationId, setConversationId] = React.useState<string | null>(\n initialConversationId ?? null\n );\n\n const abortControllerRef = React.useRef<AbortController | null>(null);\n const chatServiceRef = React.useRef<ChatService | null>(null);\n\n // Initialize chat service\n React.useEffect(() => {\n const chatProvider = createProvider({\n provider,\n model,\n apiKey,\n proxyUrl,\n });\n\n chatServiceRef.current = new ChatService({\n provider: chatProvider,\n systemPrompt,\n onUsage,\n });\n }, [provider, mode, model, apiKey, proxyUrl, systemPrompt, onUsage]);\n\n // Load existing conversation\n React.useEffect(() => {\n if (!conversationId || !chatServiceRef.current) return;\n\n const loadConversation = async () => {\n if (!chatServiceRef.current) return;\n\n const conv = await chatServiceRef.current.getConversation(conversationId);\n if (conv) {\n setConversation(conv);\n setMessages(conv.messages);\n }\n };\n\n loadConversation().catch(console.error);\n }, [conversationId]);\n\n const sendMessage = React.useCallback(\n async (content: string, attachments?: ChatAttachment[]) => {\n if (!chatServiceRef.current) {\n throw new Error('Chat service not initialized');\n }\n\n setIsLoading(true);\n setError(null);\n\n // Create abort controller\n abortControllerRef.current = new AbortController();\n\n try {\n // Add user message immediately\n const userMessage: ChatMessage = {\n id: `msg_${Date.now()}`,\n conversationId: conversationId ?? '',\n role: 'user',\n content,\n status: 'completed',\n createdAt: new Date(),\n updatedAt: new Date(),\n attachments,\n };\n setMessages((prev) => [...prev, userMessage]);\n onSend?.(userMessage);\n\n if (streaming) {\n // Streaming mode\n const result = await chatServiceRef.current.stream({\n conversationId: conversationId ?? undefined,\n content,\n attachments,\n });\n\n // Update conversation ID if new\n if (!conversationId) {\n setConversationId(result.conversationId);\n }\n\n // Add placeholder for assistant message\n const assistantMessage: ChatMessage = {\n id: result.messageId,\n conversationId: result.conversationId,\n role: 'assistant',\n content: '',\n status: 'streaming',\n createdAt: new Date(),\n updatedAt: new Date(),\n };\n setMessages((prev) => [...prev, assistantMessage]);\n\n // Process stream\n let fullContent = '';\n for await (const chunk of result.stream) {\n if (chunk.type === 'text' && chunk.content) {\n fullContent += chunk.content;\n setMessages((prev) =>\n prev.map((m) =>\n m.id === result.messageId ? { ...m, content: fullContent } : m\n )\n );\n } else if (chunk.type === 'done') {\n setMessages((prev) =>\n prev.map((m) =>\n m.id === result.messageId\n ? {\n ...m,\n status: 'completed',\n usage: chunk.usage,\n updatedAt: new Date(),\n }\n : m\n )\n );\n onResponse?.(\n messages.find((m) => m.id === result.messageId) ??\n assistantMessage\n );\n } else if (chunk.type === 'error') {\n setMessages((prev) =>\n prev.map((m) =>\n m.id === result.messageId\n ? {\n ...m,\n status: 'error',\n error: chunk.error,\n updatedAt: new Date(),\n }\n : m\n )\n );\n if (chunk.error) {\n const err = new Error(chunk.error.message);\n setError(err);\n onError?.(err);\n }\n }\n }\n } else {\n // Non-streaming mode\n const result = await chatServiceRef.current.send({\n conversationId: conversationId ?? undefined,\n content,\n attachments,\n });\n\n setConversation(result.conversation);\n setMessages(result.conversation.messages);\n\n if (!conversationId) {\n setConversationId(result.conversation.id);\n }\n\n onResponse?.(result.message);\n }\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n setError(error);\n onError?.(error);\n } finally {\n setIsLoading(false);\n abortControllerRef.current = null;\n }\n },\n [conversationId, streaming, onSend, onResponse, onError, messages]\n );\n\n const clearConversation = React.useCallback(() => {\n setMessages([]);\n setConversation(null);\n setConversationId(null);\n setError(null);\n }, []);\n\n const regenerate = React.useCallback(async () => {\n // Find the last user message\n const lastUserMessageIndex = messages.findLastIndex(\n (m) => m.role === 'user'\n );\n if (lastUserMessageIndex === -1) return;\n\n const lastUserMessage = messages[lastUserMessageIndex];\n if (!lastUserMessage) return;\n\n // Remove the last assistant message\n setMessages((prev) => prev.slice(0, lastUserMessageIndex + 1));\n\n // Resend\n await sendMessage(lastUserMessage.content, lastUserMessage.attachments);\n }, [messages, sendMessage]);\n\n const stop = React.useCallback(() => {\n abortControllerRef.current?.abort();\n setIsLoading(false);\n }, []);\n\n return {\n messages,\n conversation,\n isLoading,\n error,\n sendMessage,\n clearConversation,\n setConversationId,\n regenerate,\n stop,\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ModelInfo, ProviderMode, ProviderName } from "@contractspec/lib.ai-providers";
|
|
2
|
+
|
|
3
|
+
//#region src/presentation/hooks/useProviders.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Provider availability info
|
|
7
|
+
*/
|
|
8
|
+
interface ProviderInfo {
|
|
9
|
+
provider: ProviderName;
|
|
10
|
+
available: boolean;
|
|
11
|
+
mode: ProviderMode;
|
|
12
|
+
reason?: string;
|
|
13
|
+
models: ModelInfo[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Return type for useProviders hook
|
|
17
|
+
*/
|
|
18
|
+
interface UseProvidersReturn {
|
|
19
|
+
/** All providers with availability info */
|
|
20
|
+
providers: ProviderInfo[];
|
|
21
|
+
/** Available providers only */
|
|
22
|
+
availableProviders: ProviderInfo[];
|
|
23
|
+
/** Check if a provider is available */
|
|
24
|
+
isAvailable: (provider: ProviderName) => boolean;
|
|
25
|
+
/** Get models for a provider */
|
|
26
|
+
getModels: (provider: ProviderName) => ModelInfo[];
|
|
27
|
+
/** Loading state */
|
|
28
|
+
isLoading: boolean;
|
|
29
|
+
/** Refresh provider availability */
|
|
30
|
+
refresh: () => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Hook for managing AI provider information
|
|
34
|
+
*/
|
|
35
|
+
declare function useProviders(): UseProvidersReturn;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { UseProvidersReturn, useProviders };
|
|
38
|
+
//# sourceMappingURL=useProviders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProviders.d.ts","names":[],"sources":["../../../src/presentation/hooks/useProviders.tsx"],"sourcesContent":[],"mappings":";;;;;;AAcA;AACY,UADK,YAAA,CACL;EAEJ,QAAA,EAFI,YAEJ;EAEE,SAAA,EAAA,OAAA;EAAS,IAAA,EAFX,YAEW;EAMF,MAAA,CAAA,EAAA,MAAA;EAEJ,MAAA,EARH,SAQG,EAAA;;;;;AAUI,UAZA,kBAAA,CAYA;EAAO;EAMR,SAAA,EAhBH,YAgBe,EAAA;;sBAdN;;0BAEI;;wBAEF,iBAAiB;;;;iBAIxB;;;;;iBAMD,YAAA,CAAA,GAAgB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { getAvailableProviders, getModelsForProvider } from "@contractspec/lib.ai-providers";
|
|
5
|
+
|
|
6
|
+
//#region src/presentation/hooks/useProviders.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Hook for managing AI provider information
|
|
9
|
+
*/
|
|
10
|
+
function useProviders() {
|
|
11
|
+
const [providers, setProviders] = React.useState([]);
|
|
12
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
13
|
+
const loadProviders = React.useCallback(async () => {
|
|
14
|
+
setIsLoading(true);
|
|
15
|
+
try {
|
|
16
|
+
setProviders(getAvailableProviders().map((p) => ({
|
|
17
|
+
...p,
|
|
18
|
+
models: getModelsForProvider(p.provider)
|
|
19
|
+
})));
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error("Failed to load providers:", error);
|
|
22
|
+
} finally {
|
|
23
|
+
setIsLoading(false);
|
|
24
|
+
}
|
|
25
|
+
}, []);
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
loadProviders();
|
|
28
|
+
}, [loadProviders]);
|
|
29
|
+
return {
|
|
30
|
+
providers,
|
|
31
|
+
availableProviders: React.useMemo(() => providers.filter((p) => p.available), [providers]),
|
|
32
|
+
isAvailable: React.useCallback((provider) => providers.some((p) => p.provider === provider && p.available), [providers]),
|
|
33
|
+
getModels: React.useCallback((provider) => providers.find((p) => p.provider === provider)?.models ?? [], [providers]),
|
|
34
|
+
isLoading,
|
|
35
|
+
refresh: loadProviders
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { useProviders };
|
|
41
|
+
//# sourceMappingURL=useProviders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProviders.js","names":[],"sources":["../../../src/presentation/hooks/useProviders.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n type ProviderName,\n type ProviderMode,\n type ModelInfo,\n getAvailableProviders,\n getModelsForProvider,\n} from '@contractspec/lib.ai-providers';\n\n/**\n * Provider availability info\n */\nexport interface ProviderInfo {\n provider: ProviderName;\n available: boolean;\n mode: ProviderMode;\n reason?: string;\n models: ModelInfo[];\n}\n\n/**\n * Return type for useProviders hook\n */\nexport interface UseProvidersReturn {\n /** All providers with availability info */\n providers: ProviderInfo[];\n /** Available providers only */\n availableProviders: ProviderInfo[];\n /** Check if a provider is available */\n isAvailable: (provider: ProviderName) => boolean;\n /** Get models for a provider */\n getModels: (provider: ProviderName) => ModelInfo[];\n /** Loading state */\n isLoading: boolean;\n /** Refresh provider availability */\n refresh: () => Promise<void>;\n}\n\n/**\n * Hook for managing AI provider information\n */\nexport function useProviders(): UseProvidersReturn {\n const [providers, setProviders] = React.useState<ProviderInfo[]>([]);\n const [isLoading, setIsLoading] = React.useState(true);\n\n const loadProviders = React.useCallback(async () => {\n setIsLoading(true);\n try {\n const available = getAvailableProviders();\n const providersWithModels: ProviderInfo[] = available.map((p) => ({\n ...p,\n models: getModelsForProvider(p.provider),\n }));\n setProviders(providersWithModels);\n } catch (error) {\n console.error('Failed to load providers:', error);\n } finally {\n setIsLoading(false);\n }\n }, []);\n\n React.useEffect(() => {\n loadProviders();\n }, [loadProviders]);\n\n const availableProviders = React.useMemo(\n () => providers.filter((p) => p.available),\n [providers]\n );\n\n const isAvailable = React.useCallback(\n (provider: ProviderName) =>\n providers.some((p) => p.provider === provider && p.available),\n [providers]\n );\n\n const getModelsCallback = React.useCallback(\n (provider: ProviderName) =>\n providers.find((p) => p.provider === provider)?.models ?? [],\n [providers]\n );\n\n return {\n providers,\n availableProviders,\n isAvailable,\n getModels: getModelsCallback,\n isLoading,\n refresh: loadProviders,\n };\n}\n"],"mappings":";;;;;;;;;AA2CA,SAAgB,eAAmC;CACjD,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAAyB,EAAE,CAAC;CACpE,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAAS,KAAK;CAEtD,MAAM,gBAAgB,MAAM,YAAY,YAAY;AAClD,eAAa,KAAK;AAClB,MAAI;AAMF,gBALkB,uBAAuB,CACa,KAAK,OAAO;IAChE,GAAG;IACH,QAAQ,qBAAqB,EAAE,SAAS;IACzC,EAAE,CAC8B;WAC1B,OAAO;AACd,WAAQ,MAAM,6BAA6B,MAAM;YACzC;AACR,gBAAa,MAAM;;IAEpB,EAAE,CAAC;AAEN,OAAM,gBAAgB;AACpB,iBAAe;IACd,CAAC,cAAc,CAAC;AAmBnB,QAAO;EACL;EACA,oBAnByB,MAAM,cACzB,UAAU,QAAQ,MAAM,EAAE,UAAU,EAC1C,CAAC,UAAU,CACZ;EAiBC,aAfkB,MAAM,aACvB,aACC,UAAU,MAAM,MAAM,EAAE,aAAa,YAAY,EAAE,UAAU,EAC/D,CAAC,UAAU,CACZ;EAYC,WAVwB,MAAM,aAC7B,aACC,UAAU,MAAM,MAAM,EAAE,aAAa,SAAS,EAAE,UAAU,EAAE,EAC9D,CAAC,UAAU,CACZ;EAOC;EACA,SAAS;EACV"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChatContainer } from "./components/ChatContainer.js";
|
|
2
|
+
import { ChatMessage } from "./components/ChatMessage.js";
|
|
3
|
+
import { ChatInput } from "./components/ChatInput.js";
|
|
4
|
+
import { ModelPicker } from "./components/ModelPicker.js";
|
|
5
|
+
import { ContextIndicator } from "./components/ContextIndicator.js";
|
|
6
|
+
import { CodePreview } from "./components/CodePreview.js";
|
|
7
|
+
import "./components/index.js";
|
|
8
|
+
import { UseChatOptions, UseChatReturn, useChat } from "./hooks/useChat.js";
|
|
9
|
+
import { UseProvidersReturn, useProviders } from "./hooks/useProviders.js";
|
|
10
|
+
import "./hooks/index.js";
|
|
11
|
+
export { ChatContainer, ChatInput, ChatMessage, CodePreview, ContextIndicator, ModelPicker, UseChatOptions, UseChatReturn, UseProvidersReturn, useChat, useProviders };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChatContainer } from "./components/ChatContainer.js";
|
|
2
|
+
import { CodePreview } from "./components/CodePreview.js";
|
|
3
|
+
import { ChatMessage } from "./components/ChatMessage.js";
|
|
4
|
+
import { ChatInput } from "./components/ChatInput.js";
|
|
5
|
+
import { ModelPicker } from "./components/ModelPicker.js";
|
|
6
|
+
import { ContextIndicator } from "./components/ContextIndicator.js";
|
|
7
|
+
import "./components/index.js";
|
|
8
|
+
import { useChat } from "./hooks/useChat.js";
|
|
9
|
+
import { useProviders } from "./hooks/useProviders.js";
|
|
10
|
+
import "./hooks/index.js";
|
|
11
|
+
|
|
12
|
+
export { ChatContainer, ChatInput, ChatMessage, CodePreview, ContextIndicator, ModelPicker, useChat, useProviders };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProviderName } from "@contractspec/lib.ai-providers";
|
|
2
|
+
|
|
3
|
+
//#region src/providers/chat-utilities.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Check if a provider supports local mode
|
|
7
|
+
*/
|
|
8
|
+
declare function supportsLocalMode(provider: ProviderName): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Check if a provider is available in Studio (cloud only)
|
|
11
|
+
*/
|
|
12
|
+
declare function isStudioAvailable(provider: ProviderName): boolean;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isStudioAvailable, supportsLocalMode };
|
|
15
|
+
//# sourceMappingURL=chat-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-utilities.d.ts","names":[],"sources":["../../src/providers/chat-utilities.ts"],"sourcesContent":[],"mappings":";;;;AAeA;;;iBAPgB,iBAAA,WAA4B;;;;iBAO5B,iBAAA,WAA4B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/providers/chat-utilities.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if a provider supports local mode
|
|
4
|
+
*/
|
|
5
|
+
function supportsLocalMode(provider) {
|
|
6
|
+
return provider === "ollama";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Check if a provider is available in Studio (cloud only)
|
|
10
|
+
*/
|
|
11
|
+
function isStudioAvailable(provider) {
|
|
12
|
+
return provider !== "ollama";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { isStudioAvailable, supportsLocalMode };
|
|
17
|
+
//# sourceMappingURL=chat-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-utilities.js","names":[],"sources":["../../src/providers/chat-utilities.ts"],"sourcesContent":["/**\n * Chat-specific provider utilities\n */\nimport type { ProviderName } from '@contractspec/lib.ai-providers';\n\n/**\n * Check if a provider supports local mode\n */\nexport function supportsLocalMode(provider: ProviderName): boolean {\n return provider === 'ollama';\n}\n\n/**\n * Check if a provider is available in Studio (cloud only)\n */\nexport function isStudioAvailable(provider: ProviderName): boolean {\n return provider !== 'ollama';\n}\n\n/**\n * Get a human-readable provider name\n */\nexport function getProviderDisplayName(provider: ProviderName): string {\n switch (provider) {\n case 'ollama':\n return 'Ollama (Local)';\n case 'openai':\n return 'OpenAI';\n case 'anthropic':\n return 'Anthropic Claude';\n case 'mistral':\n return 'Mistral AI';\n case 'gemini':\n return 'Google Gemini';\n default:\n return provider;\n }\n}\n\n/**\n * Get provider icon name (for Lucide icons)\n */\nexport function getProviderIcon(\n provider: ProviderName\n): 'bot' | 'brain' | 'sparkles' | 'zap' | 'cpu' {\n switch (provider) {\n case 'ollama':\n return 'cpu';\n case 'openai':\n return 'brain';\n case 'anthropic':\n return 'sparkles';\n case 'mistral':\n return 'zap';\n case 'gemini':\n return 'bot';\n default:\n return 'bot';\n }\n}\n\n/**\n * Get provider color class for styling\n */\nexport function getProviderColor(provider: ProviderName): string {\n switch (provider) {\n case 'ollama':\n return 'text-neutral-500';\n case 'openai':\n return 'text-emerald-500';\n case 'anthropic':\n return 'text-orange-500';\n case 'mistral':\n return 'text-blue-500';\n case 'gemini':\n return 'text-purple-500';\n default:\n return 'text-neutral-400';\n }\n}\n"],"mappings":";;;;AAQA,SAAgB,kBAAkB,UAAiC;AACjE,QAAO,aAAa;;;;;AAMtB,SAAgB,kBAAkB,UAAiC;AACjE,QAAO,aAAa"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { isStudioAvailable, supportsLocalMode } from "./chat-utilities.js";
|
|
2
|
+
import { DEFAULT_MODELS, MODELS, ModelCapabilities, ModelInfo as ChatModelInfo, Provider as ChatProvider, ProviderAvailability, ProviderConfig as ChatProviderConfig, ProviderMode as ChatProviderMode, ProviderName as ChatProviderName, createProvider, createProviderFromEnv, getAvailableProviders, getDefaultModel, getEnvVarName, getModelInfo, getModelsForProvider, getRecommendedModels, hasCredentials, isOllamaRunning, listOllamaModels, validateProvider } from "@contractspec/lib.ai-providers";
|
|
3
|
+
export { type ChatModelInfo, type ChatProvider, type ChatProviderConfig, type ChatProviderMode, type ChatProviderName, DEFAULT_MODELS, MODELS, type ModelCapabilities, type ProviderAvailability, createProvider, createProviderFromEnv, getAvailableProviders, getDefaultModel, getEnvVarName, getModelInfo, getModelsForProvider, getRecommendedModels, hasCredentials, isOllamaRunning, isStudioAvailable, listOllamaModels, supportsLocalMode, validateProvider };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { isStudioAvailable, supportsLocalMode } from "./chat-utilities.js";
|
|
2
|
+
import { DEFAULT_MODELS, MODELS, createProvider, createProviderFromEnv, getAvailableProviders, getDefaultModel, getEnvVarName, getModelInfo, getModelsForProvider, getRecommendedModels, hasCredentials, isOllamaRunning, listOllamaModels, validateProvider } from "@contractspec/lib.ai-providers";
|
|
3
|
+
|
|
4
|
+
export { DEFAULT_MODELS, MODELS, createProvider, createProviderFromEnv, getAvailableProviders, getDefaultModel, getEnvVarName, getModelInfo, getModelsForProvider, getRecommendedModels, hasCredentials, isOllamaRunning, isStudioAvailable, listOllamaModels, supportsLocalMode, validateProvider };
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import * as _contractspec_lib_schema28 from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/schema.d.ts
|
|
4
|
+
declare const ChatMessageModel: _contractspec_lib_schema28.SchemaModel<{
|
|
5
|
+
id: {
|
|
6
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
7
|
+
isOptional: false;
|
|
8
|
+
};
|
|
9
|
+
role: {
|
|
10
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
11
|
+
isOptional: false;
|
|
12
|
+
};
|
|
13
|
+
content: {
|
|
14
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
15
|
+
isOptional: false;
|
|
16
|
+
};
|
|
17
|
+
status: {
|
|
18
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
19
|
+
isOptional: false;
|
|
20
|
+
};
|
|
21
|
+
createdAt: {
|
|
22
|
+
type: _contractspec_lib_schema28.FieldType<Date, string>;
|
|
23
|
+
isOptional: false;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
declare const ChatConversationModel: _contractspec_lib_schema28.SchemaModel<{
|
|
27
|
+
id: {
|
|
28
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
29
|
+
isOptional: false;
|
|
30
|
+
};
|
|
31
|
+
title: {
|
|
32
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
33
|
+
isOptional: true;
|
|
34
|
+
};
|
|
35
|
+
status: {
|
|
36
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
37
|
+
isOptional: false;
|
|
38
|
+
};
|
|
39
|
+
messages: {
|
|
40
|
+
type: _contractspec_lib_schema28.SchemaModel<{
|
|
41
|
+
id: {
|
|
42
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
43
|
+
isOptional: false;
|
|
44
|
+
};
|
|
45
|
+
role: {
|
|
46
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
47
|
+
isOptional: false;
|
|
48
|
+
};
|
|
49
|
+
content: {
|
|
50
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
51
|
+
isOptional: false;
|
|
52
|
+
};
|
|
53
|
+
status: {
|
|
54
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
55
|
+
isOptional: false;
|
|
56
|
+
};
|
|
57
|
+
createdAt: {
|
|
58
|
+
type: _contractspec_lib_schema28.FieldType<Date, string>;
|
|
59
|
+
isOptional: false;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
isArray: true;
|
|
63
|
+
isOptional: false;
|
|
64
|
+
};
|
|
65
|
+
provider: {
|
|
66
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
67
|
+
isOptional: false;
|
|
68
|
+
};
|
|
69
|
+
model: {
|
|
70
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
71
|
+
isOptional: false;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
declare const SendMessageInputModel: _contractspec_lib_schema28.SchemaModel<{
|
|
75
|
+
conversationId: {
|
|
76
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
77
|
+
isOptional: true;
|
|
78
|
+
};
|
|
79
|
+
content: {
|
|
80
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
81
|
+
isOptional: false;
|
|
82
|
+
};
|
|
83
|
+
stream: {
|
|
84
|
+
type: _contractspec_lib_schema28.FieldType<boolean, boolean>;
|
|
85
|
+
isOptional: true;
|
|
86
|
+
};
|
|
87
|
+
}>;
|
|
88
|
+
declare const SendMessageOutputModel: _contractspec_lib_schema28.SchemaModel<{
|
|
89
|
+
message: {
|
|
90
|
+
type: _contractspec_lib_schema28.SchemaModel<{
|
|
91
|
+
id: {
|
|
92
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
93
|
+
isOptional: false;
|
|
94
|
+
};
|
|
95
|
+
role: {
|
|
96
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
97
|
+
isOptional: false;
|
|
98
|
+
};
|
|
99
|
+
content: {
|
|
100
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
101
|
+
isOptional: false;
|
|
102
|
+
};
|
|
103
|
+
status: {
|
|
104
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
105
|
+
isOptional: false;
|
|
106
|
+
};
|
|
107
|
+
createdAt: {
|
|
108
|
+
type: _contractspec_lib_schema28.FieldType<Date, string>;
|
|
109
|
+
isOptional: false;
|
|
110
|
+
};
|
|
111
|
+
}>;
|
|
112
|
+
isOptional: false;
|
|
113
|
+
};
|
|
114
|
+
conversation: {
|
|
115
|
+
type: _contractspec_lib_schema28.SchemaModel<{
|
|
116
|
+
id: {
|
|
117
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
118
|
+
isOptional: false;
|
|
119
|
+
};
|
|
120
|
+
title: {
|
|
121
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
122
|
+
isOptional: true;
|
|
123
|
+
};
|
|
124
|
+
status: {
|
|
125
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
126
|
+
isOptional: false;
|
|
127
|
+
};
|
|
128
|
+
messages: {
|
|
129
|
+
type: _contractspec_lib_schema28.SchemaModel<{
|
|
130
|
+
id: {
|
|
131
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
132
|
+
isOptional: false;
|
|
133
|
+
};
|
|
134
|
+
role: {
|
|
135
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
136
|
+
isOptional: false;
|
|
137
|
+
};
|
|
138
|
+
content: {
|
|
139
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
140
|
+
isOptional: false;
|
|
141
|
+
};
|
|
142
|
+
status: {
|
|
143
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
144
|
+
isOptional: false;
|
|
145
|
+
};
|
|
146
|
+
createdAt: {
|
|
147
|
+
type: _contractspec_lib_schema28.FieldType<Date, string>;
|
|
148
|
+
isOptional: false;
|
|
149
|
+
};
|
|
150
|
+
}>;
|
|
151
|
+
isArray: true;
|
|
152
|
+
isOptional: false;
|
|
153
|
+
};
|
|
154
|
+
provider: {
|
|
155
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
156
|
+
isOptional: false;
|
|
157
|
+
};
|
|
158
|
+
model: {
|
|
159
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
160
|
+
isOptional: false;
|
|
161
|
+
};
|
|
162
|
+
}>;
|
|
163
|
+
isOptional: false;
|
|
164
|
+
};
|
|
165
|
+
}>;
|
|
166
|
+
declare const ListConversationsOutputModel: _contractspec_lib_schema28.SchemaModel<{
|
|
167
|
+
conversations: {
|
|
168
|
+
type: _contractspec_lib_schema28.SchemaModel<{
|
|
169
|
+
id: {
|
|
170
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
171
|
+
isOptional: false;
|
|
172
|
+
};
|
|
173
|
+
title: {
|
|
174
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
175
|
+
isOptional: true;
|
|
176
|
+
};
|
|
177
|
+
status: {
|
|
178
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
179
|
+
isOptional: false;
|
|
180
|
+
};
|
|
181
|
+
messages: {
|
|
182
|
+
type: _contractspec_lib_schema28.SchemaModel<{
|
|
183
|
+
id: {
|
|
184
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
185
|
+
isOptional: false;
|
|
186
|
+
};
|
|
187
|
+
role: {
|
|
188
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
189
|
+
isOptional: false;
|
|
190
|
+
};
|
|
191
|
+
content: {
|
|
192
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
193
|
+
isOptional: false;
|
|
194
|
+
};
|
|
195
|
+
status: {
|
|
196
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
197
|
+
isOptional: false;
|
|
198
|
+
};
|
|
199
|
+
createdAt: {
|
|
200
|
+
type: _contractspec_lib_schema28.FieldType<Date, string>;
|
|
201
|
+
isOptional: false;
|
|
202
|
+
};
|
|
203
|
+
}>;
|
|
204
|
+
isArray: true;
|
|
205
|
+
isOptional: false;
|
|
206
|
+
};
|
|
207
|
+
provider: {
|
|
208
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
209
|
+
isOptional: false;
|
|
210
|
+
};
|
|
211
|
+
model: {
|
|
212
|
+
type: _contractspec_lib_schema28.FieldType<string, string>;
|
|
213
|
+
isOptional: false;
|
|
214
|
+
};
|
|
215
|
+
}>;
|
|
216
|
+
isArray: true;
|
|
217
|
+
isOptional: false;
|
|
218
|
+
};
|
|
219
|
+
}>;
|
|
220
|
+
//#endregion
|
|
221
|
+
export { ChatConversationModel, ChatMessageModel, ListConversationsOutputModel, SendMessageInputModel, SendMessageOutputModel };
|
|
222
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.ts"],"sourcesContent":[],"mappings":";;;cAEa,6CAAgB;;UAS3B,0BAAA,CAAA;IATW,UAAA,EAAA,KASX;EAAA,CAAA;;;;;;8CAT2B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAWhB,CAAA;EAUX,MAAA,EAAA;;;;;;;;;cAVW,kDAAqB;;UAUhC,0BAAA,CAAA;;EAVgC,CAAA;EAYrB,KAAA,EAAA;IAUX,IAAA,sCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;IAVgC,IAAA,sCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAYrB,UAAA,EAAA,KAAA;EAMX,CAAA;;;;;;;;;;;;;;;;;;;;kDANiC,KAAA,EAAA,MAAA,CAAA;QAAA,UAAA,EAAA,KAAA;MAQtB,CAAA;IASX,CAAA,CAAA;;;;;;;;;;;;;cA7BW,qBAoB4B,6BApBP,WAoBO,CAAA;EAAA,cAAA,EAAA;UAVvC,0BAAA,CAAA;;;;;;;;;;;;cAEW,mDAAsB;;;;cAMjC,0BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,yDAA4B;;;;cASvC,0BAAA,CAAA"}
|