@aituber-onair/chat 0.1.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/README.ja.md +318 -0
- package/README.md +318 -0
- package/dist/cjs/constants/chat.d.ts +26 -0
- package/dist/cjs/constants/chat.d.ts.map +1 -0
- package/dist/cjs/constants/chat.js +34 -0
- package/dist/cjs/constants/chat.js.map +1 -0
- package/dist/cjs/constants/claude.d.ts +9 -0
- package/dist/cjs/constants/claude.d.ts.map +1 -0
- package/dist/cjs/constants/claude.js +20 -0
- package/dist/cjs/constants/claude.js.map +1 -0
- package/dist/cjs/constants/gemini.d.ts +11 -0
- package/dist/cjs/constants/gemini.d.ts.map +1 -0
- package/dist/cjs/constants/gemini.js +26 -0
- package/dist/cjs/constants/gemini.js.map +1 -0
- package/dist/cjs/constants/index.d.ts +9 -0
- package/dist/cjs/constants/index.d.ts.map +1 -0
- package/dist/cjs/constants/index.js +25 -0
- package/dist/cjs/constants/index.js.map +1 -0
- package/dist/cjs/constants/openai.d.ts +13 -0
- package/dist/cjs/constants/openai.d.ts.map +1 -0
- package/dist/cjs/constants/openai.js +28 -0
- package/dist/cjs/constants/openai.js.map +1 -0
- package/dist/cjs/constants/prompts.d.ts +3 -0
- package/dist/cjs/constants/prompts.d.ts.map +1 -0
- package/dist/cjs/constants/prompts.js +16 -0
- package/dist/cjs/constants/prompts.js.map +1 -0
- package/dist/cjs/index.d.ts +17 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +45 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/services/ChatService.d.ts +51 -0
- package/dist/cjs/services/ChatService.d.ts.map +1 -0
- package/dist/cjs/services/ChatService.js +3 -0
- package/dist/cjs/services/ChatService.js.map +1 -0
- package/dist/cjs/services/ChatServiceFactory.d.ts +39 -0
- package/dist/cjs/services/ChatServiceFactory.d.ts.map +1 -0
- package/dist/cjs/services/ChatServiceFactory.js +65 -0
- package/dist/cjs/services/ChatServiceFactory.js.map +1 -0
- package/dist/cjs/services/providers/ChatServiceProvider.d.ts +52 -0
- package/dist/cjs/services/providers/ChatServiceProvider.d.ts.map +1 -0
- package/dist/cjs/services/providers/ChatServiceProvider.js +3 -0
- package/dist/cjs/services/providers/ChatServiceProvider.js.map +1 -0
- package/dist/cjs/services/providers/claude/ClaudeChatService.d.ts +142 -0
- package/dist/cjs/services/providers/claude/ClaudeChatService.d.ts.map +1 -0
- package/dist/cjs/services/providers/claude/ClaudeChatService.js +501 -0
- package/dist/cjs/services/providers/claude/ClaudeChatService.js.map +1 -0
- package/dist/cjs/services/providers/claude/ClaudeChatServiceProvider.d.ts +40 -0
- package/dist/cjs/services/providers/claude/ClaudeChatServiceProvider.d.ts.map +1 -0
- package/dist/cjs/services/providers/claude/ClaudeChatServiceProvider.js +68 -0
- package/dist/cjs/services/providers/claude/ClaudeChatServiceProvider.js.map +1 -0
- package/dist/cjs/services/providers/gemini/GeminiChatService.d.ts +104 -0
- package/dist/cjs/services/providers/gemini/GeminiChatService.d.ts.map +1 -0
- package/dist/cjs/services/providers/gemini/GeminiChatService.js +653 -0
- package/dist/cjs/services/providers/gemini/GeminiChatService.js.map +1 -0
- package/dist/cjs/services/providers/gemini/GeminiChatServiceProvider.d.ts +40 -0
- package/dist/cjs/services/providers/gemini/GeminiChatServiceProvider.d.ts.map +1 -0
- package/dist/cjs/services/providers/gemini/GeminiChatServiceProvider.js +70 -0
- package/dist/cjs/services/providers/gemini/GeminiChatServiceProvider.js.map +1 -0
- package/dist/cjs/services/providers/openai/OpenAIChatService.d.ts +110 -0
- package/dist/cjs/services/providers/openai/OpenAIChatService.d.ts.map +1 -0
- package/dist/cjs/services/providers/openai/OpenAIChatService.js +544 -0
- package/dist/cjs/services/providers/openai/OpenAIChatService.js.map +1 -0
- package/dist/cjs/services/providers/openai/OpenAIChatServiceProvider.d.ts +40 -0
- package/dist/cjs/services/providers/openai/OpenAIChatServiceProvider.d.ts.map +1 -0
- package/dist/cjs/services/providers/openai/OpenAIChatServiceProvider.js +80 -0
- package/dist/cjs/services/providers/openai/OpenAIChatServiceProvider.js.map +1 -0
- package/dist/cjs/types/chat.d.ts +46 -0
- package/dist/cjs/types/chat.d.ts.map +1 -0
- package/dist/cjs/types/chat.js +6 -0
- package/dist/cjs/types/chat.js.map +1 -0
- package/dist/cjs/types/index.d.ts +8 -0
- package/dist/cjs/types/index.d.ts.map +1 -0
- package/dist/cjs/types/index.js +25 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/mcp.d.ts +37 -0
- package/dist/cjs/types/mcp.d.ts.map +1 -0
- package/dist/cjs/types/mcp.js +6 -0
- package/dist/cjs/types/mcp.js.map +1 -0
- package/dist/cjs/types/toolChat.d.ts +42 -0
- package/dist/cjs/types/toolChat.d.ts.map +1 -0
- package/dist/cjs/types/toolChat.js +3 -0
- package/dist/cjs/types/toolChat.js.map +1 -0
- package/dist/cjs/utils/chatServiceHttpClient.d.ts +47 -0
- package/dist/cjs/utils/chatServiceHttpClient.d.ts.map +1 -0
- package/dist/cjs/utils/chatServiceHttpClient.js +131 -0
- package/dist/cjs/utils/chatServiceHttpClient.js.map +1 -0
- package/dist/cjs/utils/emotionParser.d.ts +46 -0
- package/dist/cjs/utils/emotionParser.d.ts.map +1 -0
- package/dist/cjs/utils/emotionParser.js +59 -0
- package/dist/cjs/utils/emotionParser.js.map +1 -0
- package/dist/cjs/utils/index.d.ts +8 -0
- package/dist/cjs/utils/index.d.ts.map +1 -0
- package/dist/cjs/utils/index.js +24 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/mcpSchemaFetcher.d.ts +19 -0
- package/dist/cjs/utils/mcpSchemaFetcher.d.ts.map +1 -0
- package/dist/cjs/utils/mcpSchemaFetcher.js +98 -0
- package/dist/cjs/utils/mcpSchemaFetcher.js.map +1 -0
- package/dist/cjs/utils/screenplay.d.ts +20 -0
- package/dist/cjs/utils/screenplay.d.ts.map +1 -0
- package/dist/cjs/utils/screenplay.js +41 -0
- package/dist/cjs/utils/screenplay.js.map +1 -0
- package/dist/cjs/utils/streamTextAccumulator.d.ts +25 -0
- package/dist/cjs/utils/streamTextAccumulator.d.ts.map +1 -0
- package/dist/cjs/utils/streamTextAccumulator.js +47 -0
- package/dist/cjs/utils/streamTextAccumulator.js.map +1 -0
- package/dist/esm/constants/chat.d.ts +26 -0
- package/dist/esm/constants/chat.d.ts.map +1 -0
- package/dist/esm/constants/chat.js +30 -0
- package/dist/esm/constants/chat.js.map +1 -0
- package/dist/esm/constants/claude.d.ts +9 -0
- package/dist/esm/constants/claude.d.ts.map +1 -0
- package/dist/esm/constants/claude.js +17 -0
- package/dist/esm/constants/claude.js.map +1 -0
- package/dist/esm/constants/gemini.d.ts +11 -0
- package/dist/esm/constants/gemini.d.ts.map +1 -0
- package/dist/esm/constants/gemini.js +23 -0
- package/dist/esm/constants/gemini.js.map +1 -0
- package/dist/esm/constants/index.d.ts +9 -0
- package/dist/esm/constants/index.d.ts.map +1 -0
- package/dist/esm/constants/index.js +9 -0
- package/dist/esm/constants/index.js.map +1 -0
- package/dist/esm/constants/openai.d.ts +13 -0
- package/dist/esm/constants/openai.d.ts.map +1 -0
- package/dist/esm/constants/openai.js +25 -0
- package/dist/esm/constants/openai.js.map +1 -0
- package/dist/esm/constants/prompts.d.ts +3 -0
- package/dist/esm/constants/prompts.d.ts.map +1 -0
- package/dist/esm/constants/prompts.js +13 -0
- package/dist/esm/constants/prompts.js.map +1 -0
- package/dist/esm/index.d.ts +17 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +21 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/services/ChatService.d.ts +51 -0
- package/dist/esm/services/ChatService.d.ts.map +1 -0
- package/dist/esm/services/ChatService.js +2 -0
- package/dist/esm/services/ChatService.js.map +1 -0
- package/dist/esm/services/ChatServiceFactory.d.ts +39 -0
- package/dist/esm/services/ChatServiceFactory.d.ts.map +1 -0
- package/dist/esm/services/ChatServiceFactory.js +61 -0
- package/dist/esm/services/ChatServiceFactory.js.map +1 -0
- package/dist/esm/services/providers/ChatServiceProvider.d.ts +52 -0
- package/dist/esm/services/providers/ChatServiceProvider.d.ts.map +1 -0
- package/dist/esm/services/providers/ChatServiceProvider.js +2 -0
- package/dist/esm/services/providers/ChatServiceProvider.js.map +1 -0
- package/dist/esm/services/providers/claude/ClaudeChatService.d.ts +142 -0
- package/dist/esm/services/providers/claude/ClaudeChatService.d.ts.map +1 -0
- package/dist/esm/services/providers/claude/ClaudeChatService.js +497 -0
- package/dist/esm/services/providers/claude/ClaudeChatService.js.map +1 -0
- package/dist/esm/services/providers/claude/ClaudeChatServiceProvider.d.ts +40 -0
- package/dist/esm/services/providers/claude/ClaudeChatServiceProvider.d.ts.map +1 -0
- package/dist/esm/services/providers/claude/ClaudeChatServiceProvider.js +64 -0
- package/dist/esm/services/providers/claude/ClaudeChatServiceProvider.js.map +1 -0
- package/dist/esm/services/providers/gemini/GeminiChatService.d.ts +104 -0
- package/dist/esm/services/providers/gemini/GeminiChatService.d.ts.map +1 -0
- package/dist/esm/services/providers/gemini/GeminiChatService.js +649 -0
- package/dist/esm/services/providers/gemini/GeminiChatService.js.map +1 -0
- package/dist/esm/services/providers/gemini/GeminiChatServiceProvider.d.ts +40 -0
- package/dist/esm/services/providers/gemini/GeminiChatServiceProvider.d.ts.map +1 -0
- package/dist/esm/services/providers/gemini/GeminiChatServiceProvider.js +66 -0
- package/dist/esm/services/providers/gemini/GeminiChatServiceProvider.js.map +1 -0
- package/dist/esm/services/providers/openai/OpenAIChatService.d.ts +110 -0
- package/dist/esm/services/providers/openai/OpenAIChatService.d.ts.map +1 -0
- package/dist/esm/services/providers/openai/OpenAIChatService.js +540 -0
- package/dist/esm/services/providers/openai/OpenAIChatService.js.map +1 -0
- package/dist/esm/services/providers/openai/OpenAIChatServiceProvider.d.ts +40 -0
- package/dist/esm/services/providers/openai/OpenAIChatServiceProvider.d.ts.map +1 -0
- package/dist/esm/services/providers/openai/OpenAIChatServiceProvider.js +76 -0
- package/dist/esm/services/providers/openai/OpenAIChatServiceProvider.js.map +1 -0
- package/dist/esm/types/chat.d.ts +46 -0
- package/dist/esm/types/chat.d.ts.map +1 -0
- package/dist/esm/types/chat.js +5 -0
- package/dist/esm/types/chat.js.map +1 -0
- package/dist/esm/types/index.d.ts +8 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/index.js +9 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/mcp.d.ts +37 -0
- package/dist/esm/types/mcp.d.ts.map +1 -0
- package/dist/esm/types/mcp.js +5 -0
- package/dist/esm/types/mcp.js.map +1 -0
- package/dist/esm/types/toolChat.d.ts +42 -0
- package/dist/esm/types/toolChat.d.ts.map +1 -0
- package/dist/esm/types/toolChat.js +2 -0
- package/dist/esm/types/toolChat.js.map +1 -0
- package/dist/esm/utils/chatServiceHttpClient.d.ts +47 -0
- package/dist/esm/utils/chatServiceHttpClient.d.ts.map +1 -0
- package/dist/esm/utils/chatServiceHttpClient.js +126 -0
- package/dist/esm/utils/chatServiceHttpClient.js.map +1 -0
- package/dist/esm/utils/emotionParser.d.ts +46 -0
- package/dist/esm/utils/emotionParser.d.ts.map +1 -0
- package/dist/esm/utils/emotionParser.js +55 -0
- package/dist/esm/utils/emotionParser.js.map +1 -0
- package/dist/esm/utils/index.d.ts +8 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +8 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/mcpSchemaFetcher.d.ts +19 -0
- package/dist/esm/utils/mcpSchemaFetcher.d.ts.map +1 -0
- package/dist/esm/utils/mcpSchemaFetcher.js +94 -0
- package/dist/esm/utils/mcpSchemaFetcher.js.map +1 -0
- package/dist/esm/utils/screenplay.d.ts +20 -0
- package/dist/esm/utils/screenplay.d.ts.map +1 -0
- package/dist/esm/utils/screenplay.js +36 -0
- package/dist/esm/utils/screenplay.js.map +1 -0
- package/dist/esm/utils/streamTextAccumulator.d.ts +25 -0
- package/dist/esm/utils/streamTextAccumulator.d.ts.map +1 -0
- package/dist/esm/utils/streamTextAccumulator.js +43 -0
- package/dist/esm/utils/streamTextAccumulator.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ToolDefinition, MCPServerConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* MCP server schema fetcher for SDK-less implementation
|
|
4
|
+
*/
|
|
5
|
+
export declare class MCPSchemaFetcher {
|
|
6
|
+
/**
|
|
7
|
+
* Fetch tool schemas from MCP server
|
|
8
|
+
* @param serverConfig MCP server configuration
|
|
9
|
+
* @returns Array of tool definitions
|
|
10
|
+
*/
|
|
11
|
+
static fetchToolSchemas(serverConfig: MCPServerConfig): Promise<ToolDefinition[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Fetch all tool schemas from multiple MCP servers
|
|
14
|
+
* @param mcpServers Array of MCP server configurations
|
|
15
|
+
* @returns Array of all tool definitions
|
|
16
|
+
*/
|
|
17
|
+
static fetchAllToolSchemas(mcpServers: MCPServerConfig[]): Promise<ToolDefinition[]>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=mcpSchemaFetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpSchemaFetcher.d.ts","sourceRoot":"","sources":["../../../src/utils/mcpSchemaFetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3D;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;;;OAIG;WACU,gBAAgB,CAC3B,YAAY,EAAE,eAAe,GAC5B,OAAO,CAAC,cAAc,EAAE,CAAC;IA8E5B;;;;OAIG;WACU,mBAAmB,CAC9B,UAAU,EAAE,eAAe,EAAE,GAC5B,OAAO,CAAC,cAAc,EAAE,CAAC;CAc7B"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MCPSchemaFetcher = void 0;
|
|
4
|
+
const chatServiceHttpClient_1 = require("./chatServiceHttpClient");
|
|
5
|
+
/**
|
|
6
|
+
* MCP server schema fetcher for SDK-less implementation
|
|
7
|
+
*/
|
|
8
|
+
class MCPSchemaFetcher {
|
|
9
|
+
/**
|
|
10
|
+
* Fetch tool schemas from MCP server
|
|
11
|
+
* @param serverConfig MCP server configuration
|
|
12
|
+
* @returns Array of tool definitions
|
|
13
|
+
*/
|
|
14
|
+
static async fetchToolSchemas(serverConfig) {
|
|
15
|
+
try {
|
|
16
|
+
// Try to fetch tools list from MCP server
|
|
17
|
+
// This follows the MCP protocol for tool discovery
|
|
18
|
+
const headers = {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
};
|
|
21
|
+
if (serverConfig.authorization_token) {
|
|
22
|
+
headers['Authorization'] = `Bearer ${serverConfig.authorization_token}`;
|
|
23
|
+
}
|
|
24
|
+
// MCP protocol: POST to /tools to list available tools
|
|
25
|
+
const response = await chatServiceHttpClient_1.ChatServiceHttpClient.post(`${serverConfig.url}/tools`, {}, headers);
|
|
26
|
+
const toolsData = await response.json();
|
|
27
|
+
// Convert MCP tool schemas to AITuber ToolDefinition format
|
|
28
|
+
if (Array.isArray(toolsData.tools)) {
|
|
29
|
+
return toolsData.tools.map((tool) => ({
|
|
30
|
+
name: `mcp_${serverConfig.name}_${tool.name}`,
|
|
31
|
+
description: tool.description || `Tool from ${serverConfig.name} MCP server`,
|
|
32
|
+
parameters: tool.inputSchema || {
|
|
33
|
+
type: 'object',
|
|
34
|
+
properties: {},
|
|
35
|
+
required: [],
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
// Fallback: create generic search tool if server doesn't provide schema
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
name: `mcp_${serverConfig.name}_search`,
|
|
43
|
+
description: `Search using ${serverConfig.name} MCP server`,
|
|
44
|
+
parameters: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
query: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'Search query',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
required: ['query'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.warn(`Failed to fetch MCP schemas from ${serverConfig.name}:`, error);
|
|
59
|
+
// Fallback: create generic search tool
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
name: `mcp_${serverConfig.name}_search`,
|
|
63
|
+
description: `Search using ${serverConfig.name} MCP server (schema fetch failed)`,
|
|
64
|
+
parameters: {
|
|
65
|
+
type: 'object',
|
|
66
|
+
properties: {
|
|
67
|
+
query: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: 'Search query',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
required: ['query'],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Fetch all tool schemas from multiple MCP servers
|
|
80
|
+
* @param mcpServers Array of MCP server configurations
|
|
81
|
+
* @returns Array of all tool definitions
|
|
82
|
+
*/
|
|
83
|
+
static async fetchAllToolSchemas(mcpServers) {
|
|
84
|
+
const allSchemas = [];
|
|
85
|
+
for (const server of mcpServers) {
|
|
86
|
+
try {
|
|
87
|
+
const schemas = await this.fetchToolSchemas(server);
|
|
88
|
+
allSchemas.push(...schemas);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
console.error(`Failed to fetch schemas from ${server.name}:`, error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return allSchemas;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.MCPSchemaFetcher = MCPSchemaFetcher;
|
|
98
|
+
//# sourceMappingURL=mcpSchemaFetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpSchemaFetcher.js","sourceRoot":"","sources":["../../../src/utils/mcpSchemaFetcher.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Screenplay } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Convert text to screenplay (text with emotion)
|
|
4
|
+
* @param text Original text (may contain emotion expressions like [happy])
|
|
5
|
+
* @returns Screenplay object with emotion and text separated
|
|
6
|
+
*/
|
|
7
|
+
export declare function textToScreenplay(text: string): Screenplay;
|
|
8
|
+
/**
|
|
9
|
+
* Convert multiple texts to screenplay array
|
|
10
|
+
* @param texts Text array
|
|
11
|
+
* @returns Array of screenplay objects
|
|
12
|
+
*/
|
|
13
|
+
export declare function textsToScreenplay(texts: string[]): Screenplay[];
|
|
14
|
+
/**
|
|
15
|
+
* Convert screenplay to text with emotion
|
|
16
|
+
* @param screenplay Screenplay object
|
|
17
|
+
* @returns Text with emotion (e.g. [happy] Hello)
|
|
18
|
+
*/
|
|
19
|
+
export declare function screenplayToText(screenplay: Screenplay): string;
|
|
20
|
+
//# sourceMappingURL=screenplay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenplay.d.ts","sourceRoot":"","sources":["../../../src/utils/screenplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAWzD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAK/D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.textToScreenplay = textToScreenplay;
|
|
4
|
+
exports.textsToScreenplay = textsToScreenplay;
|
|
5
|
+
exports.screenplayToText = screenplayToText;
|
|
6
|
+
const emotionParser_1 = require("./emotionParser");
|
|
7
|
+
/**
|
|
8
|
+
* Convert text to screenplay (text with emotion)
|
|
9
|
+
* @param text Original text (may contain emotion expressions like [happy])
|
|
10
|
+
* @returns Screenplay object with emotion and text separated
|
|
11
|
+
*/
|
|
12
|
+
function textToScreenplay(text) {
|
|
13
|
+
const { emotion, cleanText } = emotionParser_1.EmotionParser.extractEmotion(text);
|
|
14
|
+
if (emotion) {
|
|
15
|
+
return {
|
|
16
|
+
emotion,
|
|
17
|
+
text: cleanText,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return { text: cleanText };
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Convert multiple texts to screenplay array
|
|
24
|
+
* @param texts Text array
|
|
25
|
+
* @returns Array of screenplay objects
|
|
26
|
+
*/
|
|
27
|
+
function textsToScreenplay(texts) {
|
|
28
|
+
return texts.map((text) => textToScreenplay(text));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Convert screenplay to text with emotion
|
|
32
|
+
* @param screenplay Screenplay object
|
|
33
|
+
* @returns Text with emotion (e.g. [happy] Hello)
|
|
34
|
+
*/
|
|
35
|
+
function screenplayToText(screenplay) {
|
|
36
|
+
if (screenplay.emotion) {
|
|
37
|
+
return emotionParser_1.EmotionParser.addEmotionTag(screenplay.emotion, screenplay.text);
|
|
38
|
+
}
|
|
39
|
+
return screenplay.text;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=screenplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenplay.js","sourceRoot":"","sources":["../../../src/utils/screenplay.ts"],"names":[],"mappings":";;AAQA,4CAWC;AAOD,8CAEC;AAOD,4CAKC;AAvCD,mDAAgD;AAEhD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,6BAAa,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAElE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO;YACL,OAAO;YACP,IAAI,EAAE,SAAS;SAChB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,KAAe;IAC/C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,UAAsB;IACrD,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACvB,OAAO,6BAAa,CAAC,aAAa,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,UAAU,CAAC,IAAI,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ToolChatBlock } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Utility class for accumulating text in streaming chat responses
|
|
4
|
+
*/
|
|
5
|
+
export declare class StreamTextAccumulator {
|
|
6
|
+
/**
|
|
7
|
+
* Append text to the blocks array, merging with the last block if it's a text block
|
|
8
|
+
* @param blocks Array of chat blocks
|
|
9
|
+
* @param text Text to append
|
|
10
|
+
*/
|
|
11
|
+
static append(blocks: ToolChatBlock[], text: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Get the full concatenated text from all text blocks
|
|
14
|
+
* @param blocks Array of chat blocks
|
|
15
|
+
* @returns Concatenated text from all text blocks
|
|
16
|
+
*/
|
|
17
|
+
static getFullText(blocks: ToolChatBlock[]): string;
|
|
18
|
+
/**
|
|
19
|
+
* Add a text block without merging
|
|
20
|
+
* @param blocks Array of chat blocks
|
|
21
|
+
* @param text Text to add as a new block
|
|
22
|
+
*/
|
|
23
|
+
static addTextBlock(blocks: ToolChatBlock[], text: string): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=streamTextAccumulator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamTextAccumulator.d.ts","sourceRoot":"","sources":["../../../src/utils/streamTextAccumulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;GAEG;AACH,qBAAa,qBAAqB;IAChC;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAW1D;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM;IAUnD;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;CAIjE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamTextAccumulator = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Utility class for accumulating text in streaming chat responses
|
|
6
|
+
*/
|
|
7
|
+
class StreamTextAccumulator {
|
|
8
|
+
/**
|
|
9
|
+
* Append text to the blocks array, merging with the last block if it's a text block
|
|
10
|
+
* @param blocks Array of chat blocks
|
|
11
|
+
* @param text Text to append
|
|
12
|
+
*/
|
|
13
|
+
static append(blocks, text) {
|
|
14
|
+
if (!text)
|
|
15
|
+
return;
|
|
16
|
+
const lastBlock = blocks[blocks.length - 1];
|
|
17
|
+
if (lastBlock && lastBlock.type === 'text') {
|
|
18
|
+
lastBlock.text += text;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
blocks.push({ type: 'text', text });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get the full concatenated text from all text blocks
|
|
26
|
+
* @param blocks Array of chat blocks
|
|
27
|
+
* @returns Concatenated text from all text blocks
|
|
28
|
+
*/
|
|
29
|
+
static getFullText(blocks) {
|
|
30
|
+
return blocks
|
|
31
|
+
.filter((block) => block.type === 'text')
|
|
32
|
+
.map((block) => block.text)
|
|
33
|
+
.join('');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Add a text block without merging
|
|
37
|
+
* @param blocks Array of chat blocks
|
|
38
|
+
* @param text Text to add as a new block
|
|
39
|
+
*/
|
|
40
|
+
static addTextBlock(blocks, text) {
|
|
41
|
+
if (!text)
|
|
42
|
+
return;
|
|
43
|
+
blocks.push({ type: 'text', text });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.StreamTextAccumulator = StreamTextAccumulator;
|
|
47
|
+
//# sourceMappingURL=streamTextAccumulator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamTextAccumulator.js","sourceRoot":"","sources":["../../../src/utils/streamTextAccumulator.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAa,qBAAqB;IAChC;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,MAAuB,EAAE,IAAY;QACjD,IAAI,CAAC,IAAI;YAAE,OAAO;QAElB,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,SAAS,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC3C,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,MAAuB;QACxC,OAAO,MAAM;aACV,MAAM,CACL,CAAC,KAAK,EAA2C,EAAE,CACjD,KAAK,CAAC,IAAI,KAAK,MAAM,CACxB;aACA,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,MAAuB,EAAE,IAAY;QACvD,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;CACF;AAzCD,sDAyCC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const CHAT_RESPONSE_LENGTH: {
|
|
2
|
+
readonly VERY_SHORT: "veryShort";
|
|
3
|
+
readonly SHORT: "short";
|
|
4
|
+
readonly MEDIUM: "medium";
|
|
5
|
+
readonly LONG: "long";
|
|
6
|
+
readonly VERY_LONG: "veryLong";
|
|
7
|
+
};
|
|
8
|
+
export declare const MAX_TOKENS_BY_LENGTH: {
|
|
9
|
+
readonly veryShort: 40;
|
|
10
|
+
readonly short: 100;
|
|
11
|
+
readonly medium: 200;
|
|
12
|
+
readonly long: 300;
|
|
13
|
+
readonly veryLong: 1000;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Default max tokens for AI providers when not specified
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_MAX_TOKENS = 1000;
|
|
19
|
+
export type ChatResponseLength = (typeof CHAT_RESPONSE_LENGTH)[keyof typeof CHAT_RESPONSE_LENGTH];
|
|
20
|
+
/**
|
|
21
|
+
* Converts a ChatResponseLength to the corresponding max_tokens value
|
|
22
|
+
* @param responseLength - The response length setting
|
|
23
|
+
* @returns The max_tokens value, or DEFAULT_MAX_TOKENS if responseLength is not provided
|
|
24
|
+
*/
|
|
25
|
+
export declare function getMaxTokensForResponseLength(responseLength?: ChatResponseLength): number;
|
|
26
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/constants/chat.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;;;;CAMvB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;CAMvB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEnE;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,cAAc,CAAC,EAAE,kBAAkB,GAClC,MAAM,CAKR"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const CHAT_RESPONSE_LENGTH = {
|
|
2
|
+
VERY_SHORT: 'veryShort',
|
|
3
|
+
SHORT: 'short',
|
|
4
|
+
MEDIUM: 'medium',
|
|
5
|
+
LONG: 'long',
|
|
6
|
+
VERY_LONG: 'veryLong',
|
|
7
|
+
};
|
|
8
|
+
export const MAX_TOKENS_BY_LENGTH = {
|
|
9
|
+
[CHAT_RESPONSE_LENGTH.VERY_SHORT]: 40,
|
|
10
|
+
[CHAT_RESPONSE_LENGTH.SHORT]: 100,
|
|
11
|
+
[CHAT_RESPONSE_LENGTH.MEDIUM]: 200,
|
|
12
|
+
[CHAT_RESPONSE_LENGTH.LONG]: 300,
|
|
13
|
+
[CHAT_RESPONSE_LENGTH.VERY_LONG]: 1000,
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Default max tokens for AI providers when not specified
|
|
17
|
+
*/
|
|
18
|
+
export const DEFAULT_MAX_TOKENS = 1000;
|
|
19
|
+
/**
|
|
20
|
+
* Converts a ChatResponseLength to the corresponding max_tokens value
|
|
21
|
+
* @param responseLength - The response length setting
|
|
22
|
+
* @returns The max_tokens value, or DEFAULT_MAX_TOKENS if responseLength is not provided
|
|
23
|
+
*/
|
|
24
|
+
export function getMaxTokensForResponseLength(responseLength) {
|
|
25
|
+
if (!responseLength) {
|
|
26
|
+
return DEFAULT_MAX_TOKENS;
|
|
27
|
+
}
|
|
28
|
+
return MAX_TOKENS_BY_LENGTH[responseLength] ?? DEFAULT_MAX_TOKENS;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/constants/chat.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,WAAW;IACvB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,UAAU;CACb,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,EAAE;IACrC,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,GAAG;IACjC,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,GAAG;IAClC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG;IAChC,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,IAAI;CAC9B,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAKvC;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAC3C,cAAmC;IAEnC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,OAAO,oBAAoB,CAAC,cAAc,CAAC,IAAI,kBAAkB,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const ENDPOINT_CLAUDE_API = "https://api.anthropic.com/v1/messages";
|
|
2
|
+
export declare const MODEL_CLAUDE_3_HAIKU = "claude-3-haiku-20240307";
|
|
3
|
+
export declare const MODEL_CLAUDE_3_5_HAIKU = "claude-3-5-haiku-20241022";
|
|
4
|
+
export declare const MODEL_CLAUDE_3_5_SONNET = "claude-3-5-sonnet-20241022";
|
|
5
|
+
export declare const MODEL_CLAUDE_3_7_SONNET = "claude-3-7-sonnet-20250219";
|
|
6
|
+
export declare const MODEL_CLAUDE_4_SONNET = "claude-4-sonnet-20250514";
|
|
7
|
+
export declare const MODEL_CLAUDE_4_OPUS = "claude-4-opus-20250514";
|
|
8
|
+
export declare const CLAUDE_VISION_SUPPORTED_MODELS: string[];
|
|
9
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/constants/claude.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,0CAA0C,CAAC;AAG3E,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAC9D,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAClE,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAChE,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D,eAAO,MAAM,8BAA8B,UAO1C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const ENDPOINT_CLAUDE_API = 'https://api.anthropic.com/v1/messages';
|
|
2
|
+
// claude model
|
|
3
|
+
export const MODEL_CLAUDE_3_HAIKU = 'claude-3-haiku-20240307';
|
|
4
|
+
export const MODEL_CLAUDE_3_5_HAIKU = 'claude-3-5-haiku-20241022';
|
|
5
|
+
export const MODEL_CLAUDE_3_5_SONNET = 'claude-3-5-sonnet-20241022';
|
|
6
|
+
export const MODEL_CLAUDE_3_7_SONNET = 'claude-3-7-sonnet-20250219';
|
|
7
|
+
export const MODEL_CLAUDE_4_SONNET = 'claude-4-sonnet-20250514';
|
|
8
|
+
export const MODEL_CLAUDE_4_OPUS = 'claude-4-opus-20250514';
|
|
9
|
+
export const CLAUDE_VISION_SUPPORTED_MODELS = [
|
|
10
|
+
MODEL_CLAUDE_3_HAIKU,
|
|
11
|
+
MODEL_CLAUDE_3_5_HAIKU,
|
|
12
|
+
MODEL_CLAUDE_3_5_SONNET,
|
|
13
|
+
MODEL_CLAUDE_3_7_SONNET,
|
|
14
|
+
MODEL_CLAUDE_4_SONNET,
|
|
15
|
+
MODEL_CLAUDE_4_OPUS,
|
|
16
|
+
];
|
|
17
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/constants/claude.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,uCAAuC,CAAC;AAE3E,eAAe;AACf,MAAM,CAAC,MAAM,oBAAoB,GAAG,yBAAyB,CAAC;AAC9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAClE,MAAM,CAAC,MAAM,uBAAuB,GAAG,4BAA4B,CAAC;AACpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,4BAA4B,CAAC;AACpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AAE5D,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,oBAAoB;IACpB,sBAAsB;IACtB,uBAAuB;IACvB,uBAAuB;IACvB,qBAAqB;IACrB,mBAAmB;CACpB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const ENDPOINT_GEMINI_API = "https://generativelanguage.googleapis.com";
|
|
2
|
+
export declare const MODEL_GEMINI_2_5_PRO = "gemini-2.5-pro";
|
|
3
|
+
export declare const MODEL_GEMINI_2_5_FLASH = "gemini-2.5-flash";
|
|
4
|
+
export declare const MODEL_GEMINI_2_5_FLASH_LITE = "gemini-2.5-flash-lite";
|
|
5
|
+
export declare const MODEL_GEMINI_2_5_FLASH_LITE_PREVIEW_06_17 = "gemini-2.5-flash-lite-preview-06-17";
|
|
6
|
+
export declare const MODEL_GEMINI_2_0_FLASH = "gemini-2.0-flash";
|
|
7
|
+
export declare const MODEL_GEMINI_2_0_FLASH_LITE = "gemini-2.0-flash-lite";
|
|
8
|
+
export declare const MODEL_GEMINI_1_5_FLASH = "gemini-1.5-flash";
|
|
9
|
+
export declare const MODEL_GEMINI_1_5_PRO = "gemini-1.5-pro";
|
|
10
|
+
export declare const GEMINI_VISION_SUPPORTED_MODELS: string[];
|
|
11
|
+
//# sourceMappingURL=gemini.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../src/constants/gemini.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB,8CAA8C,CAAC;AAG/E,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,2BAA2B,0BAA0B,CAAC;AACnE,eAAO,MAAM,yCAAyC,wCACf,CAAC;AACxC,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,2BAA2B,0BAA0B,CAAC;AACnE,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AAGrD,eAAO,MAAM,8BAA8B,UAS1C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// API Endpoints
|
|
2
|
+
export const ENDPOINT_GEMINI_API = 'https://generativelanguage.googleapis.com';
|
|
3
|
+
// gemini model
|
|
4
|
+
export const MODEL_GEMINI_2_5_PRO = 'gemini-2.5-pro';
|
|
5
|
+
export const MODEL_GEMINI_2_5_FLASH = 'gemini-2.5-flash';
|
|
6
|
+
export const MODEL_GEMINI_2_5_FLASH_LITE = 'gemini-2.5-flash-lite';
|
|
7
|
+
export const MODEL_GEMINI_2_5_FLASH_LITE_PREVIEW_06_17 = 'gemini-2.5-flash-lite-preview-06-17';
|
|
8
|
+
export const MODEL_GEMINI_2_0_FLASH = 'gemini-2.0-flash';
|
|
9
|
+
export const MODEL_GEMINI_2_0_FLASH_LITE = 'gemini-2.0-flash-lite';
|
|
10
|
+
export const MODEL_GEMINI_1_5_FLASH = 'gemini-1.5-flash';
|
|
11
|
+
export const MODEL_GEMINI_1_5_PRO = 'gemini-1.5-pro';
|
|
12
|
+
// Vision support for Gemini models
|
|
13
|
+
export const GEMINI_VISION_SUPPORTED_MODELS = [
|
|
14
|
+
MODEL_GEMINI_2_5_PRO,
|
|
15
|
+
MODEL_GEMINI_2_5_FLASH,
|
|
16
|
+
MODEL_GEMINI_2_5_FLASH_LITE,
|
|
17
|
+
MODEL_GEMINI_2_5_FLASH_LITE_PREVIEW_06_17,
|
|
18
|
+
MODEL_GEMINI_2_0_FLASH,
|
|
19
|
+
MODEL_GEMINI_2_0_FLASH_LITE,
|
|
20
|
+
MODEL_GEMINI_1_5_FLASH,
|
|
21
|
+
MODEL_GEMINI_1_5_PRO,
|
|
22
|
+
];
|
|
23
|
+
//# sourceMappingURL=gemini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../src/constants/gemini.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,2CAA2C,CAAC;AAE/E,eAAe;AACf,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AACrD,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AACzD,MAAM,CAAC,MAAM,2BAA2B,GAAG,uBAAuB,CAAC;AACnE,MAAM,CAAC,MAAM,yCAAyC,GACpD,qCAAqC,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AACzD,MAAM,CAAC,MAAM,2BAA2B,GAAG,uBAAuB,CAAC;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAErD,mCAAmC;AACnC,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,oBAAoB;IACpB,sBAAsB;IACtB,2BAA2B;IAC3B,yCAAyC;IACzC,sBAAsB;IACtB,2BAA2B;IAC3B,sBAAsB;IACtB,oBAAoB;CACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const ENDPOINT_OPENAI_CHAT_COMPLETIONS_API = "https://api.openai.com/v1/chat/completions";
|
|
2
|
+
export declare const ENDPOINT_OPENAI_RESPONSES_API = "https://api.openai.com/v1/responses";
|
|
3
|
+
export declare const MODEL_GPT_4_1 = "gpt-4.1";
|
|
4
|
+
export declare const MODEL_GPT_4_1_MINI = "gpt-4.1-mini";
|
|
5
|
+
export declare const MODEL_GPT_4_1_NANO = "gpt-4.1-nano";
|
|
6
|
+
export declare const MODEL_GPT_4O_MINI = "gpt-4o-mini";
|
|
7
|
+
export declare const MODEL_GPT_4O = "gpt-4o";
|
|
8
|
+
export declare const MODEL_O3_MINI = "o3-mini";
|
|
9
|
+
export declare const MODEL_O1_MINI = "o1-mini";
|
|
10
|
+
export declare const MODEL_O1 = "o1";
|
|
11
|
+
export declare const MODEL_GPT_4_5_PREVIEW = "gpt-4.5-preview";
|
|
12
|
+
export declare const VISION_SUPPORTED_MODELS: string[];
|
|
13
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/constants/openai.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oCAAoC,+CACH,CAAC;AAC/C,eAAO,MAAM,6BAA6B,wCACH,CAAC;AAGxC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AACjD,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,YAAY,WAAW,CAAC;AACrC,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,QAAQ,OAAO,CAAC;AAG7B,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAGvD,eAAO,MAAM,uBAAuB,UASnC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const ENDPOINT_OPENAI_CHAT_COMPLETIONS_API = 'https://api.openai.com/v1/chat/completions';
|
|
2
|
+
export const ENDPOINT_OPENAI_RESPONSES_API = 'https://api.openai.com/v1/responses';
|
|
3
|
+
// gpt model
|
|
4
|
+
export const MODEL_GPT_4_1 = 'gpt-4.1';
|
|
5
|
+
export const MODEL_GPT_4_1_MINI = 'gpt-4.1-mini';
|
|
6
|
+
export const MODEL_GPT_4_1_NANO = 'gpt-4.1-nano';
|
|
7
|
+
export const MODEL_GPT_4O_MINI = 'gpt-4o-mini';
|
|
8
|
+
export const MODEL_GPT_4O = 'gpt-4o';
|
|
9
|
+
export const MODEL_O3_MINI = 'o3-mini';
|
|
10
|
+
export const MODEL_O1_MINI = 'o1-mini';
|
|
11
|
+
export const MODEL_O1 = 'o1';
|
|
12
|
+
// deprecated
|
|
13
|
+
export const MODEL_GPT_4_5_PREVIEW = 'gpt-4.5-preview';
|
|
14
|
+
// Vision support for models
|
|
15
|
+
export const VISION_SUPPORTED_MODELS = [
|
|
16
|
+
MODEL_GPT_4_1,
|
|
17
|
+
MODEL_GPT_4_1_MINI,
|
|
18
|
+
MODEL_GPT_4_1_NANO,
|
|
19
|
+
MODEL_GPT_4O_MINI,
|
|
20
|
+
MODEL_GPT_4O,
|
|
21
|
+
MODEL_GPT_4_5_PREVIEW,
|
|
22
|
+
MODEL_O1,
|
|
23
|
+
// MODEL_O3_MINI and MODEL_O1_MINI are not included as they don't support vision
|
|
24
|
+
];
|
|
25
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../../src/constants/openai.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oCAAoC,GAC/C,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,6BAA6B,GACxC,qCAAqC,CAAC;AAExC,YAAY;AACZ,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AACrC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC;AAE7B,aAAa;AACb,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEvD,4BAA4B;AAC5B,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,YAAY;IACZ,qBAAqB;IACrB,QAAQ;IACR,gFAAgF;CACjF,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const DEFAULT_VISION_PROMPT = "You are a friendly AI avatar. Comment on the situation based on the broadcast screen.";
|
|
2
|
+
export declare const DEFAULT_SUMMARY_PROMPT_TEMPLATE = "You are a skilled summarizing assistant. \nAnalyze the following conversation and produce a summary in the **same language** as the majority of the conversation:\n- Summaries should highlight key points\n- Stay concise (around {maxLength} characters if possible)\n- No redundant expressions\n\nIf the conversation is in Japanese, summarize in Japanese.\nIf it's in English, summarize in English.\nIf it's in another language, summarize in that language.\n";
|
|
3
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/constants/prompts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,qBAAqB,0FACuD,CAAC;AAC1F,eAAO,MAAM,+BAA+B,4cAS3C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Default prompts
|
|
2
|
+
export const DEFAULT_VISION_PROMPT = 'You are a friendly AI avatar. Comment on the situation based on the broadcast screen.';
|
|
3
|
+
export const DEFAULT_SUMMARY_PROMPT_TEMPLATE = `You are a skilled summarizing assistant.
|
|
4
|
+
Analyze the following conversation and produce a summary in the **same language** as the majority of the conversation:
|
|
5
|
+
- Summaries should highlight key points
|
|
6
|
+
- Stay concise (around {maxLength} characters if possible)
|
|
7
|
+
- No redundant expressions
|
|
8
|
+
|
|
9
|
+
If the conversation is in Japanese, summarize in Japanese.
|
|
10
|
+
If it's in English, summarize in English.
|
|
11
|
+
If it's in another language, summarize in that language.
|
|
12
|
+
`;
|
|
13
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/constants/prompts.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,MAAM,CAAC,MAAM,qBAAqB,GAChC,uFAAuF,CAAC;AAC1F,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;CAS9C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AITuber OnAir Chat Package
|
|
3
|
+
* LLM API integration and chat processing functionality
|
|
4
|
+
*/
|
|
5
|
+
export * from './types';
|
|
6
|
+
export type { ChatService } from './services/ChatService';
|
|
7
|
+
export { ChatServiceFactory } from './services/ChatServiceFactory';
|
|
8
|
+
export type { ChatServiceOptions, ChatServiceProvider, } from './services/providers/ChatServiceProvider';
|
|
9
|
+
export { OpenAIChatService } from './services/providers/openai/OpenAIChatService';
|
|
10
|
+
export { OpenAIChatServiceProvider } from './services/providers/openai/OpenAIChatServiceProvider';
|
|
11
|
+
export { GeminiChatService } from './services/providers/gemini/GeminiChatService';
|
|
12
|
+
export { GeminiChatServiceProvider } from './services/providers/gemini/GeminiChatServiceProvider';
|
|
13
|
+
export { ClaudeChatService } from './services/providers/claude/ClaudeChatService';
|
|
14
|
+
export { ClaudeChatServiceProvider } from './services/providers/claude/ClaudeChatServiceProvider';
|
|
15
|
+
export * from './constants';
|
|
16
|
+
export * from './utils';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,SAAS,CAAC;AAGxB,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAGlG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAGlG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAGlG,cAAc,aAAa,CAAC;AAG5B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AITuber OnAir Chat Package
|
|
3
|
+
* LLM API integration and chat processing functionality
|
|
4
|
+
*/
|
|
5
|
+
// Type definitions exports
|
|
6
|
+
export * from './types';
|
|
7
|
+
export { ChatServiceFactory } from './services/ChatServiceFactory';
|
|
8
|
+
// OpenAI provider exports
|
|
9
|
+
export { OpenAIChatService } from './services/providers/openai/OpenAIChatService';
|
|
10
|
+
export { OpenAIChatServiceProvider } from './services/providers/openai/OpenAIChatServiceProvider';
|
|
11
|
+
// Gemini provider exports
|
|
12
|
+
export { GeminiChatService } from './services/providers/gemini/GeminiChatService';
|
|
13
|
+
export { GeminiChatServiceProvider } from './services/providers/gemini/GeminiChatServiceProvider';
|
|
14
|
+
// Claude provider exports
|
|
15
|
+
export { ClaudeChatService } from './services/providers/claude/ClaudeChatService';
|
|
16
|
+
export { ClaudeChatServiceProvider } from './services/providers/claude/ClaudeChatServiceProvider';
|
|
17
|
+
// Constants exports
|
|
18
|
+
export * from './constants';
|
|
19
|
+
// Utility exports
|
|
20
|
+
export * from './utils';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,2BAA2B;AAC3B,cAAc,SAAS,CAAC;AAIxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAQnE,0BAA0B;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAElG,0BAA0B;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAElG,0BAA0B;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAElG,oBAAoB;AACpB,cAAc,aAAa,CAAC;AAE5B,kBAAkB;AAClB,cAAc,SAAS,CAAC"}
|