thatgfsj-code 0.3.0 → 0.4.1
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/dist/cmd/index.js +56 -8
- package/dist/cmd/index.js.map +1 -1
- package/dist/config/index.d.ts +5 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +22 -4
- package/dist/config/index.js.map +1 -1
- package/dist/config/providers.d.ts +5 -10
- package/dist/config/providers.d.ts.map +1 -1
- package/dist/config/providers.js +152 -78
- package/dist/config/providers.js.map +1 -1
- package/dist/config/types.d.ts +1 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/llm/anthropic.d.ts +24 -6
- package/dist/llm/anthropic.d.ts.map +1 -1
- package/dist/llm/anthropic.js +136 -46
- package/dist/llm/anthropic.js.map +1 -1
- package/dist/llm/gemini.d.ts +4 -4
- package/dist/llm/gemini.d.ts.map +1 -1
- package/dist/llm/gemini.js +67 -30
- package/dist/llm/gemini.js.map +1 -1
- package/dist/llm/index.d.ts +10 -23
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +73 -78
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/openai.d.ts +19 -6
- package/dist/llm/openai.d.ts.map +1 -1
- package/dist/llm/openai.js +86 -35
- package/dist/llm/openai.js.map +1 -1
- package/dist/llm/provider.d.ts +11 -16
- package/dist/llm/provider.d.ts.map +1 -1
- package/dist/tui/input.d.ts +0 -1
- package/dist/tui/input.d.ts.map +1 -1
- package/dist/tui/input.js +2 -5
- package/dist/tui/input.js.map +1 -1
- package/dist/tui/output.d.ts +27 -12
- package/dist/tui/output.d.ts.map +1 -1
- package/dist/tui/output.js +176 -40
- package/dist/tui/output.js.map +1 -1
- package/dist/tui/repl.d.ts +0 -10
- package/dist/tui/repl.d.ts.map +1 -1
- package/dist/tui/repl.js +76 -42
- package/dist/tui/repl.js.map +1 -1
- package/dist/tui/welcome.d.ts +2 -8
- package/dist/tui/welcome.d.ts.map +1 -1
- package/dist/tui/welcome.js +101 -51
- package/dist/tui/welcome.js.map +1 -1
- package/package.json +1 -1
- package/src/cmd/index.ts +49 -8
- package/src/config/index.ts +21 -4
- package/src/config/providers.ts +153 -79
- package/src/config/types.ts +11 -5
- package/src/llm/anthropic.ts +148 -51
- package/src/llm/gemini.ts +81 -39
- package/src/llm/index.ts +75 -83
- package/src/llm/openai.ts +96 -41
- package/src/llm/provider.ts +12 -16
- package/src/tui/input.ts +2 -5
- package/src/tui/output.ts +193 -40
- package/src/tui/repl.ts +82 -43
- package/src/tui/welcome.ts +110 -53
package/dist/cmd/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import chalk from 'chalk';
|
|
|
20
20
|
import { App } from '../app/index.js';
|
|
21
21
|
import { REPL } from '../tui/repl.js';
|
|
22
22
|
import { WelcomeScreen } from '../tui/welcome.js';
|
|
23
|
-
import { ProjectContext } from '../utils/project.js';
|
|
24
23
|
// ==================== Error Handling ====================
|
|
25
24
|
process.on('uncaughtException', (error) => {
|
|
26
25
|
console.error(chalk.red('\n❌ Error:'), error.message);
|
|
@@ -34,7 +33,7 @@ process.on('unhandledRejection', (reason) => {
|
|
|
34
33
|
program
|
|
35
34
|
.name('gfcode')
|
|
36
35
|
.description('🤖 Thatgfsj Code - AI Coding Assistant')
|
|
37
|
-
.version('0.
|
|
36
|
+
.version('0.4.1')
|
|
38
37
|
.argument('[prompt]', 'Task to execute (omit to start interactive mode)')
|
|
39
38
|
.option('-m, --model <model>', 'Specify model')
|
|
40
39
|
.option('-i, --interactive', 'Force interactive mode')
|
|
@@ -60,12 +59,61 @@ program
|
|
|
60
59
|
await repl.start();
|
|
61
60
|
}
|
|
62
61
|
else {
|
|
63
|
-
// Single prompt mode
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
// Single prompt mode - use same UI as REPL
|
|
63
|
+
const { REPLOutput } = await import('../tui/output.js');
|
|
64
|
+
const out = new REPLOutput();
|
|
65
|
+
out.printBanner();
|
|
66
|
+
out.printUserInput(prompt);
|
|
67
|
+
out.startThinking();
|
|
68
|
+
app.session.addMessage('user', prompt);
|
|
69
|
+
let fullResponse = '';
|
|
70
|
+
let hasStarted = false;
|
|
71
|
+
try {
|
|
72
|
+
const stream = app.getAgent().run(app.session.getMessages());
|
|
73
|
+
for await (const chunk of stream) {
|
|
74
|
+
out.stopThinking();
|
|
75
|
+
const parts = chunk.split('\n');
|
|
76
|
+
for (const part of parts) {
|
|
77
|
+
if (part.startsWith('@@TOOL@@')) {
|
|
78
|
+
try {
|
|
79
|
+
const data = JSON.parse(part.slice(8));
|
|
80
|
+
if (data.action === 'call') {
|
|
81
|
+
if (hasStarted) {
|
|
82
|
+
out.endAssistant();
|
|
83
|
+
hasStarted = false;
|
|
84
|
+
}
|
|
85
|
+
out.printToolCall(data.name, data.args || '');
|
|
86
|
+
out.startExecuting(data.name);
|
|
87
|
+
}
|
|
88
|
+
else if (data.action === 'result') {
|
|
89
|
+
out.stopThinking();
|
|
90
|
+
out.printToolResult(data.output || data.error || '', !!data.error);
|
|
91
|
+
out.printToolEnd();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch { }
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (part) {
|
|
98
|
+
if (!hasStarted) {
|
|
99
|
+
out.beginAssistant();
|
|
100
|
+
hasStarted = true;
|
|
101
|
+
}
|
|
102
|
+
out.writeChunk(part + '\n');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
fullResponse += chunk;
|
|
106
|
+
}
|
|
107
|
+
if (hasStarted)
|
|
108
|
+
out.endAssistant();
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (hasStarted)
|
|
112
|
+
out.endAssistant();
|
|
113
|
+
out.stopThinkingFail(error.message);
|
|
114
|
+
out.error(error.message);
|
|
115
|
+
}
|
|
116
|
+
app.session.addMessage('assistant', fullResponse);
|
|
69
117
|
}
|
|
70
118
|
}
|
|
71
119
|
catch (error) {
|
package/dist/cmd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cmd/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,yBAAyB;AACzB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;IACjC,IAAI,CAAC;QACH,OAAO,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1F,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;AACZ,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cmd/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,yBAAyB;AACzB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;IACjC,IAAI,CAAC;QACH,OAAO,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1F,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;AACZ,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACt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AI,UAAU;oBAAE,GAAG,CAAC,YAAY,EAAE,CAAC;gBACnC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACpC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;YAED,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,8BAA8B;AAC9B,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,gBAAgB,CAAC;KAC7B,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,aAAa,CAAC,gBAAgB,EAAE,CAAC;AACzC,CAAC,CAAC,CAAC;AAEL,gBAAgB;AAChB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Config Manager - Handles configuration loading and saving
|
|
3
|
-
*
|
|
3
|
+
* Supports custom providers (relay stations / 中转站)
|
|
4
4
|
*/
|
|
5
5
|
import type { Config, AIConfig } from './types.js';
|
|
6
6
|
export declare class ConfigManager {
|
|
@@ -35,5 +35,9 @@ export declare class ConfigManager {
|
|
|
35
35
|
* Check if an API key is configured
|
|
36
36
|
*/
|
|
37
37
|
hasApiKey(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Check if using a custom provider
|
|
40
|
+
*/
|
|
41
|
+
isCustomProvider(): boolean;
|
|
38
42
|
}
|
|
39
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAgB,MAAM,YAAY,CAAC;AAWjE,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO;IAKP;;OAEG;WACU,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC;IAsB3C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAgB,MAAM,YAAY,CAAC;AAWjE,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO;IAKP;;OAEG;WACU,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC;IAsB3C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAmC9B;;OAEG;IACH,GAAG,IAAI,MAAM;IAIb;;OAEG;IACH,WAAW,IAAI,QAAQ;IAWvB;;OAEG;IACH,iBAAiB,IAAI,QAAQ,GAAG,WAAW,GAAG,QAAQ;IAItD;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnD;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,gBAAgB,IAAI,OAAO;CAG5B"}
|
package/dist/config/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Config Manager - Handles configuration loading and saving
|
|
3
|
-
*
|
|
3
|
+
* Supports custom providers (relay stations / 中转站)
|
|
4
4
|
*/
|
|
5
5
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
6
6
|
import { join, dirname } from 'path';
|
|
7
7
|
import { homedir } from 'os';
|
|
8
|
-
import { PROVIDERS, getApiKeyFromEnv } from './providers.js';
|
|
8
|
+
import { PROVIDERS, getApiKeyFromEnv, isCustomProvider } from './providers.js';
|
|
9
9
|
const DEFAULT_CONFIG = {
|
|
10
10
|
model: 'Qwen/Qwen2.5-7B-Instruct',
|
|
11
11
|
apiKey: '',
|
|
@@ -60,8 +60,20 @@ export class ConfigManager {
|
|
|
60
60
|
else if (!apiKey) {
|
|
61
61
|
apiKey = getApiKeyFromEnv(provider);
|
|
62
62
|
}
|
|
63
|
-
// Base URL: config > provider default
|
|
64
|
-
|
|
63
|
+
// Base URL: config > env > provider default
|
|
64
|
+
let baseUrl = config.baseUrl;
|
|
65
|
+
if (!baseUrl) {
|
|
66
|
+
// Check env for custom base URL
|
|
67
|
+
if (provider === 'custom_openai') {
|
|
68
|
+
baseUrl = process.env.CUSTOM_BASE_URL || '';
|
|
69
|
+
}
|
|
70
|
+
else if (provider === 'custom_anthropic') {
|
|
71
|
+
baseUrl = process.env.CUSTOM_BASE_URL || '';
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
baseUrl = providerConfig.baseUrl;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
65
77
|
return { ...config, provider, baseUrl, model, apiKey: apiKey || '' };
|
|
66
78
|
}
|
|
67
79
|
/**
|
|
@@ -106,5 +118,11 @@ export class ConfigManager {
|
|
|
106
118
|
hasApiKey() {
|
|
107
119
|
return !!this.config.apiKey;
|
|
108
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Check if using a custom provider
|
|
123
|
+
*/
|
|
124
|
+
isCustomProvider() {
|
|
125
|
+
return isCustomProvider(this.config.provider);
|
|
126
|
+
}
|
|
109
127
|
}
|
|
110
128
|
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE/E,MAAM,cAAc,GAAW;IAC7B,KAAK,EAAE,0BAA0B;IACjC,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,GAAG;IAChB,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,aAAa;CACxB,CAAC;AAEF,MAAM,OAAO,aAAa;IAChB,UAAU,CAAS;IACnB,MAAM,CAAS;IAEvB,YAAoB,UAAkB,EAAE,MAAc;QACpD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI;QACf,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EA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AAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC;QAE7C,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC;QAED,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provider definitions and model catalogs
|
|
3
|
-
*
|
|
3
|
+
* Updated with correct API formats and more providers
|
|
4
4
|
*/
|
|
5
5
|
import type { ProviderConfig, ProviderName, ModelInfo } from './types.js';
|
|
6
6
|
export declare const PROVIDERS: Record<ProviderName, ProviderConfig>;
|
|
7
7
|
export declare const MODEL_CATALOGS: Record<ProviderName, ModelInfo[]>;
|
|
8
|
-
/**
|
|
9
|
-
* Get models for a specific provider
|
|
10
|
-
*/
|
|
11
8
|
export declare function getModelsForProvider(provider: ProviderName): ModelInfo[];
|
|
12
|
-
/**
|
|
13
|
-
* Get API key for a provider from environment variables
|
|
14
|
-
*/
|
|
15
9
|
export declare function getApiKeyFromEnv(provider: ProviderName): string;
|
|
16
|
-
/**
|
|
17
|
-
* List all provider names
|
|
18
|
-
*/
|
|
19
10
|
export declare function listProviders(): Array<{
|
|
20
11
|
key: ProviderName;
|
|
21
12
|
name: string;
|
|
22
13
|
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Check if a provider name is a custom/relay provider
|
|
16
|
+
*/
|
|
17
|
+
export declare function isCustomProvider(provider: ProviderName): boolean;
|
|
23
18
|
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/config/providers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI1E,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/config/providers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI1E,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,cAAc,CA0G1D,CAAC;AAIF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE,SAAS,EAAE,CAqF5D,CAAC;AAIF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,EAAE,CAExE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAO/D;AAED,wBAAgB,aAAa,IAAI,KAAK,CAAC;IAAE,GAAG,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAK1E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAEhE"}
|
package/dist/config/providers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provider definitions and model catalogs
|
|
3
|
-
*
|
|
3
|
+
* Updated with correct API formats and more providers
|
|
4
4
|
*/
|
|
5
5
|
// ==================== Provider Definitions ====================
|
|
6
6
|
export const PROVIDERS = {
|
|
@@ -8,16 +8,9 @@ export const PROVIDERS = {
|
|
|
8
8
|
name: 'SiliconFlow (硅基流动)',
|
|
9
9
|
baseUrl: 'https://api.siliconflow.cn/v1',
|
|
10
10
|
defaultModel: 'Qwen/Qwen2.5-7B-Instruct',
|
|
11
|
-
envKeys: ['SILICONFLOW_API_KEY'
|
|
11
|
+
envKeys: ['SILICONFLOW_API_KEY'],
|
|
12
12
|
format: 'openai',
|
|
13
13
|
},
|
|
14
|
-
minimax: {
|
|
15
|
-
name: 'MiniMax',
|
|
16
|
-
baseUrl: 'https://api.minimax.io/anthropic/v1',
|
|
17
|
-
defaultModel: 'MiniMax-M2.5',
|
|
18
|
-
envKeys: ['MINIMAX_API_KEY', 'OPENAI_API_KEY'],
|
|
19
|
-
format: 'anthropic',
|
|
20
|
-
},
|
|
21
14
|
openai: {
|
|
22
15
|
name: 'OpenAI',
|
|
23
16
|
baseUrl: 'https://api.openai.com/v1',
|
|
@@ -25,111 +18,189 @@ export const PROVIDERS = {
|
|
|
25
18
|
envKeys: ['OPENAI_API_KEY'],
|
|
26
19
|
format: 'openai',
|
|
27
20
|
},
|
|
21
|
+
deepseek: {
|
|
22
|
+
name: 'DeepSeek (深度求索)',
|
|
23
|
+
baseUrl: 'https://api.deepseek.com',
|
|
24
|
+
defaultModel: 'deepseek-chat',
|
|
25
|
+
envKeys: ['DEEPSEEK_API_KEY'],
|
|
26
|
+
format: 'openai',
|
|
27
|
+
},
|
|
28
|
+
kimi: {
|
|
29
|
+
name: 'Kimi (月之暗面)',
|
|
30
|
+
baseUrl: 'https://api.moonshot.cn/v1',
|
|
31
|
+
defaultModel: 'kimi-k2.6',
|
|
32
|
+
envKeys: ['KIMI_API_KEY', 'MOONSHOT_API_KEY'],
|
|
33
|
+
format: 'openai',
|
|
34
|
+
},
|
|
35
|
+
zhipu: {
|
|
36
|
+
name: 'Zhipu GLM (智谱)',
|
|
37
|
+
baseUrl: 'https://open.bigmodel.cn/api/paas/v4',
|
|
38
|
+
defaultModel: 'glm-4-flash',
|
|
39
|
+
envKeys: ['ZHIPU_API_KEY', 'GLM_API_KEY'],
|
|
40
|
+
format: 'openai',
|
|
41
|
+
},
|
|
42
|
+
minimax: {
|
|
43
|
+
name: 'MiniMax',
|
|
44
|
+
baseUrl: 'https://api.minimax.chat/v1',
|
|
45
|
+
defaultModel: 'MiniMax-Text-01',
|
|
46
|
+
envKeys: ['MINIMAX_API_KEY'],
|
|
47
|
+
format: 'openai',
|
|
48
|
+
},
|
|
49
|
+
baichuan: {
|
|
50
|
+
name: 'Baichuan (百川)',
|
|
51
|
+
baseUrl: 'https://api.baichuan-ai.com/v1',
|
|
52
|
+
defaultModel: 'Baichuan4',
|
|
53
|
+
envKeys: ['BAICHUAN_API_KEY'],
|
|
54
|
+
format: 'openai',
|
|
55
|
+
},
|
|
56
|
+
stepfun: {
|
|
57
|
+
name: 'Stepfun (阶跃星辰)',
|
|
58
|
+
baseUrl: 'https://api.stepfun.com/v1',
|
|
59
|
+
defaultModel: 'step-1-flash',
|
|
60
|
+
envKeys: ['STEPFUN_API_KEY'],
|
|
61
|
+
format: 'openai',
|
|
62
|
+
},
|
|
63
|
+
doubao: {
|
|
64
|
+
name: 'Doubao (火山引擎豆包)',
|
|
65
|
+
baseUrl: 'https://ark.cn-beijing.volces.com/api/v3',
|
|
66
|
+
defaultModel: 'doubao-1.5-pro-32k',
|
|
67
|
+
envKeys: ['DOUBAO_API_KEY', 'ARK_API_KEY'],
|
|
68
|
+
format: 'openai',
|
|
69
|
+
},
|
|
28
70
|
anthropic: {
|
|
29
|
-
name: 'Anthropic',
|
|
71
|
+
name: 'Anthropic (Claude)',
|
|
30
72
|
baseUrl: 'https://api.anthropic.com/v1',
|
|
31
|
-
defaultModel: 'claude-
|
|
73
|
+
defaultModel: 'claude-sonnet-4-20250514',
|
|
32
74
|
envKeys: ['ANTHROPIC_API_KEY'],
|
|
33
75
|
format: 'anthropic',
|
|
34
76
|
},
|
|
35
|
-
ollama: {
|
|
36
|
-
name: 'Ollama (Local)',
|
|
37
|
-
baseUrl: process.env.OLLAMA_BASE_URL || 'http://localhost:11434',
|
|
38
|
-
defaultModel: 'llama2',
|
|
39
|
-
envKeys: [],
|
|
40
|
-
format: 'openai',
|
|
41
|
-
},
|
|
42
77
|
gemini: {
|
|
43
78
|
name: 'Google Gemini',
|
|
44
79
|
baseUrl: 'https://generativelanguage.googleapis.com/v1beta',
|
|
45
|
-
defaultModel: 'gemini-
|
|
80
|
+
defaultModel: 'gemini-2.0-flash',
|
|
46
81
|
envKeys: ['GEMINI_API_KEY'],
|
|
47
82
|
format: 'gemini',
|
|
48
83
|
},
|
|
49
|
-
|
|
50
|
-
name: '
|
|
51
|
-
baseUrl: '
|
|
52
|
-
defaultModel: '
|
|
53
|
-
envKeys: [
|
|
84
|
+
ollama: {
|
|
85
|
+
name: 'Ollama (本地)',
|
|
86
|
+
baseUrl: 'http://localhost:11434/v1',
|
|
87
|
+
defaultModel: 'llama3.1',
|
|
88
|
+
envKeys: [],
|
|
54
89
|
format: 'openai',
|
|
55
90
|
},
|
|
56
|
-
|
|
57
|
-
name: '
|
|
58
|
-
baseUrl: 'https://
|
|
59
|
-
defaultModel: '
|
|
60
|
-
envKeys: ['
|
|
91
|
+
ernie: {
|
|
92
|
+
name: 'ERNIE (百度文心)',
|
|
93
|
+
baseUrl: 'https://qianfan.baidubce.com/v2',
|
|
94
|
+
defaultModel: 'ernie-4.5-8k',
|
|
95
|
+
envKeys: ['ERNIE_API_KEY', 'QIANFAN_API_KEY'],
|
|
61
96
|
format: 'openai',
|
|
62
97
|
},
|
|
63
|
-
|
|
64
|
-
name: '
|
|
65
|
-
baseUrl: '
|
|
66
|
-
defaultModel: '
|
|
67
|
-
envKeys: ['
|
|
98
|
+
custom_openai: {
|
|
99
|
+
name: '自定义 OpenAI 兼容 (中转站)',
|
|
100
|
+
baseUrl: '',
|
|
101
|
+
defaultModel: 'gpt-4o-mini',
|
|
102
|
+
envKeys: ['CUSTOM_API_KEY'],
|
|
68
103
|
format: 'openai',
|
|
69
104
|
},
|
|
105
|
+
custom_anthropic: {
|
|
106
|
+
name: '自定义 Anthropic 兼容 (中转站)',
|
|
107
|
+
baseUrl: '',
|
|
108
|
+
defaultModel: 'claude-sonnet-4-20250514',
|
|
109
|
+
envKeys: ['CUSTOM_API_KEY'],
|
|
110
|
+
format: 'anthropic',
|
|
111
|
+
},
|
|
70
112
|
};
|
|
71
113
|
// ==================== Model Catalogs ====================
|
|
72
114
|
export const MODEL_CATALOGS = {
|
|
73
115
|
siliconflow: [
|
|
74
|
-
{ id: 'Qwen/Qwen2.5-7B-Instruct', name: 'Qwen2.5-7B
|
|
75
|
-
{ id: 'Qwen/Qwen2.5-32B-Instruct', name: 'Qwen2.5-32B', desc: '
|
|
116
|
+
{ id: 'Qwen/Qwen2.5-7B-Instruct', name: 'Qwen2.5-7B', desc: '免费,日常编程' },
|
|
117
|
+
{ id: 'Qwen/Qwen2.5-32B-Instruct', name: 'Qwen2.5-32B', desc: '更强性能' },
|
|
76
118
|
{ id: 'Qwen/Qwen2.5-72B-Instruct', name: 'Qwen2.5-72B', desc: '旗舰模型' },
|
|
77
|
-
{ id: '
|
|
78
|
-
{ id: 'Pro/deepseek-ai/DeepSeek-V3', name: 'DeepSeek-V3', desc: '
|
|
79
|
-
{ id: 'Pro/deepseek-ai/DeepSeek-R1', name: 'DeepSeek-R1', desc: '
|
|
119
|
+
{ id: 'Qwen/Qwen3-8B', name: 'Qwen3-8B', desc: '最新 Qwen3' },
|
|
120
|
+
{ id: 'Pro/deepseek-ai/DeepSeek-V3', name: 'DeepSeek-V3', desc: '深度求索' },
|
|
121
|
+
{ id: 'Pro/deepseek-ai/DeepSeek-R1', name: 'DeepSeek-R1', desc: '推理模型' },
|
|
122
|
+
{ id: 'deepseek-ai/DeepSeek-V3', name: 'DeepSeek-V3 (免费)', desc: '免费版' },
|
|
80
123
|
{ id: 'THUDM/glm-4-9b-chat', name: 'GLM-4-9B', desc: '智谱模型' },
|
|
81
|
-
{ id: '
|
|
82
|
-
{ id: '01-ai/Yi-1.5-34B-Chat', name: 'Yi-1.5-34B', desc: '零一万物' },
|
|
83
|
-
{ id: 'microsoft/WizardLM-2-8x22B', name: 'WizardLM-2', desc: '微软开源' },
|
|
84
|
-
],
|
|
85
|
-
minimax: [
|
|
86
|
-
{ id: 'MiniMax-M2.5', name: 'MiniMax-M2.5 (推荐)', desc: 'Agent 能力最强' },
|
|
87
|
-
{ id: 'MiniMax-M2.1', name: 'MiniMax-M2.1', desc: '稳定版本' },
|
|
124
|
+
{ id: 'internlm/internlm2_5-7b-chat', name: 'InternLM2.5-7B', desc: '书生模型' },
|
|
88
125
|
],
|
|
89
126
|
openai: [
|
|
90
|
-
{ id: 'gpt-4o-mini', name: 'GPT-4o-mini
|
|
91
|
-
{ id: 'gpt-4o', name: 'GPT-4o', desc: '
|
|
127
|
+
{ id: 'gpt-4o-mini', name: 'GPT-4o-mini', desc: '性价比高' },
|
|
128
|
+
{ id: 'gpt-4o', name: 'GPT-4o', desc: '旗舰多模态' },
|
|
92
129
|
{ id: 'gpt-4-turbo', name: 'GPT-4-Turbo', desc: '强性能' },
|
|
130
|
+
{ id: 'o3-mini', name: 'o3-mini', desc: '推理模型' },
|
|
93
131
|
],
|
|
94
|
-
|
|
95
|
-
{ id: '
|
|
96
|
-
{ id: '
|
|
97
|
-
{ id: 'claude-3-opus-20240229', name: 'Claude-3-Opus', desc: '最强性能' },
|
|
132
|
+
deepseek: [
|
|
133
|
+
{ id: 'deepseek-chat', name: 'DeepSeek-Chat', desc: '通用对话' },
|
|
134
|
+
{ id: 'deepseek-reasoner', name: 'DeepSeek-Reasoner', desc: '推理增强' },
|
|
98
135
|
],
|
|
99
|
-
|
|
100
|
-
{ id: '
|
|
101
|
-
{ id: '
|
|
102
|
-
{ id: '
|
|
136
|
+
kimi: [
|
|
137
|
+
{ id: 'kimi-k2.6', name: 'Kimi K2.6', desc: '最新旗舰,支持思考' },
|
|
138
|
+
{ id: 'kimi-k2.5', name: 'Kimi K2.5', desc: '稳定版' },
|
|
139
|
+
{ id: 'moonshot-v1-128k', name: 'Moonshot-128K', desc: '超长上下文' },
|
|
140
|
+
{ id: 'moonshot-v1-32k', name: 'Moonshot-32K', desc: '长上下文' },
|
|
141
|
+
{ id: 'moonshot-v1-8k', name: 'Moonshot-8K', desc: '基础版' },
|
|
103
142
|
],
|
|
104
|
-
|
|
105
|
-
{ id: '
|
|
106
|
-
{ id: '
|
|
107
|
-
{ id: '
|
|
143
|
+
zhipu: [
|
|
144
|
+
{ id: 'glm-4-plus', name: 'GLM-4-Plus', desc: '旗舰模型' },
|
|
145
|
+
{ id: 'glm-4-flash', name: 'GLM-4-Flash', desc: '快速免费' },
|
|
146
|
+
{ id: 'glm-4-long', name: 'GLM-4-Long', desc: '超长上下文 1M' },
|
|
147
|
+
{ id: 'glm-4-flashx', name: 'GLM-4-FlashX', desc: '加速版' },
|
|
148
|
+
{ id: 'glm-4-air', name: 'GLM-4-Air', desc: '轻量版' },
|
|
108
149
|
],
|
|
109
|
-
|
|
110
|
-
{ id: '
|
|
111
|
-
{ id: '
|
|
112
|
-
{ id: 'moonshot-v1-128k', name: 'Moonshot-V1-128K', desc: '超长上下文' },
|
|
150
|
+
minimax: [
|
|
151
|
+
{ id: 'MiniMax-Text-01', name: 'MiniMax-Text-01', desc: '旗舰模型' },
|
|
152
|
+
{ id: 'abab6.5s-chat', name: 'abab6.5s', desc: '轻量版' },
|
|
113
153
|
],
|
|
114
|
-
|
|
115
|
-
{ id: '
|
|
116
|
-
{ id: '
|
|
154
|
+
baichuan: [
|
|
155
|
+
{ id: 'Baichuan4', name: 'Baichuan4', desc: '最新旗舰' },
|
|
156
|
+
{ id: 'Baichuan3-Turbo', name: 'Baichuan3-Turbo', desc: '快速版' },
|
|
157
|
+
],
|
|
158
|
+
stepfun: [
|
|
159
|
+
{ id: 'step-1-flash', name: 'Step-1-Flash', desc: '快速免费' },
|
|
160
|
+
{ id: 'step-1-8k', name: 'Step-1-8K', desc: '基础版' },
|
|
161
|
+
{ id: 'step-2-16k', name: 'Step-2-16K', desc: '增强版' },
|
|
162
|
+
],
|
|
163
|
+
doubao: [
|
|
164
|
+
{ id: 'doubao-1.5-pro-32k', name: 'Doubao-1.5-Pro-32K', desc: '旗舰版' },
|
|
165
|
+
{ id: 'doubao-1.5-lite-32k', name: 'Doubao-1.5-Lite-32K', desc: '轻量版' },
|
|
166
|
+
{ id: 'doubao-pro-256k', name: 'Doubao-Pro-256K', desc: '超长上下文' },
|
|
167
|
+
],
|
|
168
|
+
anthropic: [
|
|
169
|
+
{ id: 'claude-sonnet-4-20250514', name: 'Claude Sonnet 4', desc: '最新旗舰' },
|
|
170
|
+
{ id: 'claude-3-5-haiku-20241022', name: 'Claude 3.5 Haiku', desc: '快速便宜' },
|
|
171
|
+
{ id: 'claude-3-opus-20240229', name: 'Claude 3 Opus', desc: '最强性能' },
|
|
172
|
+
],
|
|
173
|
+
gemini: [
|
|
174
|
+
{ id: 'gemini-2.0-flash', name: 'Gemini 2.0 Flash', desc: '最新快速' },
|
|
175
|
+
{ id: 'gemini-2.5-pro-preview-05-06', name: 'Gemini 2.5 Pro', desc: '最强推理' },
|
|
176
|
+
{ id: 'gemini-1.5-flash', name: 'Gemini 1.5 Flash', desc: '经典版' },
|
|
177
|
+
],
|
|
178
|
+
ollama: [
|
|
179
|
+
{ id: 'llama3.1', name: 'Llama 3.1', desc: 'Meta 开源' },
|
|
180
|
+
{ id: 'qwen2.5', name: 'Qwen 2.5', desc: '通义千问' },
|
|
181
|
+
{ id: 'deepseek-coder-v2', name: 'DeepSeek Coder V2', desc: '编程专用' },
|
|
182
|
+
{ id: 'codellama', name: 'Code Llama', desc: 'Meta 编程' },
|
|
183
|
+
{ id: 'mistral', name: 'Mistral', desc: '高性能' },
|
|
117
184
|
],
|
|
118
185
|
ernie: [
|
|
119
|
-
{ id: 'ernie-4.
|
|
186
|
+
{ id: 'ernie-4.5-8k', name: 'ERNIE-4.5-8K', desc: '最新旗舰' },
|
|
187
|
+
{ id: 'ernie-4.0-8k', name: 'ERNIE-4.0-8K', desc: '强性能' },
|
|
120
188
|
{ id: 'ernie-3.5-8k', name: 'ERNIE-3.5-8K', desc: '性价比高' },
|
|
121
189
|
],
|
|
190
|
+
custom_openai: [
|
|
191
|
+
{ id: 'gpt-4o-mini', name: 'GPT-4o-mini', desc: '默认模型,可自定义' },
|
|
192
|
+
{ id: 'gpt-4o', name: 'GPT-4o', desc: '可自定义' },
|
|
193
|
+
{ id: 'claude-sonnet-4-20250514', name: 'Claude Sonnet 4', desc: '可自定义' },
|
|
194
|
+
],
|
|
195
|
+
custom_anthropic: [
|
|
196
|
+
{ id: 'claude-sonnet-4-20250514', name: 'Claude Sonnet 4', desc: '默认模型,可自定义' },
|
|
197
|
+
{ id: 'claude-3-5-haiku-20241022', name: 'Claude 3.5 Haiku', desc: '可自定义' },
|
|
198
|
+
],
|
|
122
199
|
};
|
|
123
200
|
// ==================== Helpers ====================
|
|
124
|
-
/**
|
|
125
|
-
* Get models for a specific provider
|
|
126
|
-
*/
|
|
127
201
|
export function getModelsForProvider(provider) {
|
|
128
|
-
return MODEL_CATALOGS[provider] ||
|
|
202
|
+
return MODEL_CATALOGS[provider] || [];
|
|
129
203
|
}
|
|
130
|
-
/**
|
|
131
|
-
* Get API key for a provider from environment variables
|
|
132
|
-
*/
|
|
133
204
|
export function getApiKeyFromEnv(provider) {
|
|
134
205
|
const providerConfig = PROVIDERS[provider];
|
|
135
206
|
if (!providerConfig)
|
|
@@ -140,13 +211,16 @@ export function getApiKeyFromEnv(provider) {
|
|
|
140
211
|
}
|
|
141
212
|
return '';
|
|
142
213
|
}
|
|
143
|
-
/**
|
|
144
|
-
* List all provider names
|
|
145
|
-
*/
|
|
146
214
|
export function listProviders() {
|
|
147
215
|
return Object.entries(PROVIDERS).map(([key, val]) => ({
|
|
148
216
|
key: key,
|
|
149
217
|
name: val.name,
|
|
150
218
|
}));
|
|
151
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Check if a provider name is a custom/relay provider
|
|
222
|
+
*/
|
|
223
|
+
export function isCustomProvider(provider) {
|
|
224
|
+
return provider === 'custom_openai' || provider === 'custom_anthropic';
|
|
225
|
+
}
|
|
152
226
|
//# sourceMappingURL=providers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/config/providers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,iEAAiE;AAEjE,MAAM,CAAC,MAAM,SAAS,GAAyC;IAC7D,WAAW,EAAE;QACX,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,+BAA+B;QACxC,YAAY,EAAE,0BAA0B;QACxC,OAAO,EAAE,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/config/providers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,iEAAiE;AAEjE,MAAM,CAAC,MAAM,SAAS,GAAyC;IAC7D,WAAW,EAAE;QACX,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,+BAA+B;QACxC,YAAY,EAAE,0BAA0B;QACxC,OAAO,EAAE,CAAC,qBAAqB,CAAC;QAChC,MAAM,EAAE,QAAQ;KACjB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,2BAA2B;QACpC,YAAY,EAAE,aAAa;QAC3B,OAAO,EAAE,CAAC,gBAAgB,CAAC;QAC3B,MAAM,EAAE,QAAQ;KACjB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,0BAA0B;QACnC,YAAY,EAAE,eAAe;QAC7B,OAAO,EAAE,CAAC,kBAAkB,CAAC;QAC7B,MAAM,EAAE,QAAQ;KACjB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,aAAa;QACnB,OAAO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,CAAC,MAAM,CAAC;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QACpD,GAAG,EAAE,GAAmB;QACxB,IAAI,EAAE,GAAG,CAAC,IAAI;KACf,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAsB;IACrD,OAAO,QAAQ,KAAK,eAAe,IAAI,QAAQ,KAAK,kBAAkB,CAAC;AACzE,CAAC"}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configuration types for Thatgfsj Code
|
|
3
3
|
*/
|
|
4
|
-
export type ProviderName = 'siliconflow' | 'minimax' | '
|
|
4
|
+
export type ProviderName = 'siliconflow' | 'openai' | 'deepseek' | 'kimi' | 'zhipu' | 'minimax' | 'baichuan' | 'stepfun' | 'doubao' | 'anthropic' | 'gemini' | 'ollama' | 'ernie' | 'custom_openai' | 'custom_anthropic';
|
|
5
5
|
export interface ProviderConfig {
|
|
6
6
|
name: string;
|
|
7
7
|
baseUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,SAAS,GACT,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,QAAQ,GACR,UAAU,GACV,MAAM,GACN,OAAO,GACP,SAAS,GACT,UAAU,GACV,SAAS,GACT,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,eAAe,GACf,kBAAkB,CAAC;AAEvB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;CAC3C;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/dist/llm/anthropic.d.ts
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anthropic Provider
|
|
3
|
-
* Works with: Anthropic Claude
|
|
3
|
+
* Works with: Anthropic Claude API
|
|
4
|
+
* Also works with any Anthropic-compatible relay station (中转站)
|
|
5
|
+
*
|
|
6
|
+
* API: POST {baseUrl}/messages
|
|
7
|
+
* Auth: x-api-key: {apiKey}, anthropic-version: 2023-06-01
|
|
8
|
+
* Streaming: SSE with "event: ..." and "data: {...}" lines
|
|
9
|
+
*
|
|
10
|
+
* Key differences from OpenAI:
|
|
11
|
+
* - System message is separate (top-level "system" field)
|
|
12
|
+
* - No "system" role in messages array
|
|
13
|
+
* - Tool use blocks have type "tool_use" with "input" (not "arguments")
|
|
14
|
+
* - Tool results use role "tool_result" (not "tool")
|
|
4
15
|
*/
|
|
5
16
|
import type { ChatMessage, ChatResponse, ChatOptions } from '../types.js';
|
|
6
17
|
import type { Tool } from '../tools/types.js';
|
|
7
|
-
import type { LLMProvider, ProviderConfig } from './provider.js';
|
|
18
|
+
import type { LLMProvider, StreamChunk, ProviderConfig } from './provider.js';
|
|
8
19
|
export declare class AnthropicProvider implements LLMProvider {
|
|
9
20
|
readonly name = "anthropic";
|
|
10
|
-
|
|
21
|
+
protected config: ProviderConfig;
|
|
11
22
|
constructor(config: ProviderConfig);
|
|
12
23
|
buildTools(tools: Tool[]): any[];
|
|
13
|
-
chat(messages: ChatMessage[], options?: ChatOptions): Promise<ChatResponse>;
|
|
14
|
-
chatStream(messages: ChatMessage[], options?: ChatOptions): AsyncGenerator<
|
|
15
|
-
|
|
24
|
+
chat(messages: ChatMessage[], options?: ChatOptions, tools?: Tool[]): Promise<ChatResponse>;
|
|
25
|
+
chatStream(messages: ChatMessage[], options?: ChatOptions, tools?: Tool[]): AsyncGenerator<StreamChunk, ChatResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Build request body for Anthropic API
|
|
28
|
+
*/
|
|
29
|
+
protected buildRequest(messages: ChatMessage[], stream: boolean, options?: ChatOptions, tools?: Tool[]): any;
|
|
30
|
+
/**
|
|
31
|
+
* Execute the HTTP request
|
|
32
|
+
*/
|
|
33
|
+
protected doRequest(body: any): Promise<Response>;
|
|
16
34
|
}
|
|
17
35
|
//# sourceMappingURL=anthropic.d.ts.map
|