-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: 提供兼容vercel/ai的message封装,能够不引入ai包编译
- Loading branch information
Showing
8 changed files
with
89 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "chatgpt-telegram-workers", | ||
"type": "module", | ||
"version": "1.10.0", | ||
"version": "1.10.2", | ||
"description": "The easiest and quickest way to deploy your own ChatGPT Telegram bot is to use a single file and simply copy and paste it. There is no need for any dependencies, local development environment configuration, domain names, or servers.", | ||
"author": "tbxark <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -20,14 +20,14 @@ | |
"dist" | ||
], | ||
"scripts": { | ||
"lint": "eslint --fix *.js *.ts src plugins scripts", | ||
"lint": "eslint --fix *.js *.ts src plugins", | ||
"version": "tsx src/vite/version/main.ts", | ||
"build": "vite build", | ||
"build:local": "ENTRY=src/entry/local/index.ts vite build", | ||
"build:docker": "docker build -t chatgpt-telegram-workers:latest .", | ||
"build:dockerx": "docker build --platform linux/amd64,linux/arm64 -t tbxark/chatgpt-telegram-workers:latest --push .", | ||
"build:vercel": "ENTRY=src/entry/vercel/index.ts vite build", | ||
"build:pack": "TYPES=true FORMATS=es,cjs vite build", | ||
"build:pack": "TYPES=true FORMATS=es,cjs ENTRY=src/entry/pack/index.ts vite build", | ||
"deploy:dist": "wrangler deploy", | ||
"deploy:build": "npm run build && wrangler deploy", | ||
"deploy:vercel": "vercel deploy --prod", | ||
|
@@ -40,14 +40,16 @@ | |
"test": "tsx ./src/agent/index.test.ts" | ||
}, | ||
"dependencies": { | ||
"cloudflare-worker-adapter": "^1.3.3" | ||
}, | ||
"optionalDependencies": { | ||
"@ai-sdk/anthropic": "^0.0.56", | ||
"@ai-sdk/azure": "^0.0.52", | ||
"@ai-sdk/cohere": "^0.0.28", | ||
"@ai-sdk/google": "^0.0.55", | ||
"@ai-sdk/mistral": "^0.0.46", | ||
"@ai-sdk/openai": "^0.0.72", | ||
"ai": "^3.4.33", | ||
"cloudflare-worker-adapter": "^1.3.3" | ||
"ai": "^3.4.33" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^3.8.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
export type DataContent = string | Uint8Array | ArrayBuffer | Buffer; | ||
|
||
interface TextPart { | ||
type: 'text'; | ||
text: string; | ||
} | ||
|
||
interface ImagePart { | ||
type: 'image'; | ||
image: DataContent | URL; | ||
mimeType?: string; | ||
} | ||
|
||
interface ToolCallPart { | ||
type: 'tool-call'; | ||
toolCallId: string; | ||
toolName: string; | ||
args: unknown; | ||
} | ||
|
||
interface FilePart { | ||
type: 'file'; | ||
data: DataContent | URL; | ||
} | ||
|
||
interface ToolResultPart { | ||
type: 'tool-result'; | ||
toolCallId: string; | ||
toolName: string; | ||
result: unknown; | ||
} | ||
|
||
type AssistantContent = string | Array<TextPart | ToolCallPart>; | ||
type UserContent = string | Array<TextPart | ImagePart | FilePart>; | ||
type ToolContent = Array<ToolResultPart>; | ||
|
||
export interface CoreSystemMessage { | ||
role: 'system'; | ||
content: string; | ||
} | ||
|
||
export interface CoreAssistantMessage { | ||
role: 'assistant'; | ||
content: AssistantContent; | ||
} | ||
|
||
export interface CoreUserMessage { | ||
role: 'user'; | ||
content: UserContent; | ||
} | ||
|
||
export interface CoreToolMessage { | ||
role: 'tool'; | ||
content: ToolContent; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const BUILD_TIMESTAMP = 1731468421; | ||
export const BUILD_VERSION = '9e1cda2'; | ||
export const BUILD_TIMESTAMP = 1731482441; | ||
export const BUILD_VERSION = 'f8ade3c'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from '../../agent'; | ||
export * from '../../config/env'; | ||
export * from '../../route/index'; | ||
export * from '../../telegram/handler'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters