Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/adapter-azure-openai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"resolutions": {
"@langchain/core": "^0.3.80",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-claude/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"resolutions": {
"@langchain/core": "^0.3.80",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-deepseek/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"category": "ai",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-dify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-doubao/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-gemini/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18",
"koishi-plugin-chatluna": "^1.4.0-alpha.19",
"koishi-plugin-chatluna-storage-service": "^1.0.6"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-hunyuan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-ollama/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"resolutions": {
"@langchain/core": "^0.3.80",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-openai-like/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-openai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-qwen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-rwkv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-spark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-wenxin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-zhipu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "koishi-plugin-chatluna",
"description": "chatluna for koishi",
"version": "1.4.0-alpha.18",
"version": "1.4.0-alpha.19",
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"typings": "lib/index.d.ts",
Expand Down
14 changes: 12 additions & 2 deletions packages/core/src/services/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import { Embeddings } from '@langchain/core/embeddings'
import { RunnableConfig } from '@langchain/core/runnables'
import type { Notifier } from '@koishijs/plugin-notifier'
import { ChatLunaContextManagerService } from 'koishi-plugin-chatluna/llm-core/prompt'
import { createChatPrompt } from 'koishi-plugin-chatluna/utils/chatluna'
import { ChatLunaChatPrompt } from 'koishi-plugin-chatluna/llm-core/chain/prompt'

export class ChatLunaService extends Service<Config> {
private _plugins: Record<string, ChatLunaPlugin> = {}
Expand Down Expand Up @@ -449,8 +449,18 @@ export class ChatLunaService extends Service<Config> {
const { preset, instructions } = resolveAgentPreset(options, (name) =>
computed(() => this._preset.getPreset(name).value)
)
const model = llm.value
const prompt =
options.prompt ?? createChatPrompt(this.ctx, llm.value, preset)
options.prompt ??
new ChatLunaChatPrompt({
preset,
tokenCounter: (text) => model.getNumTokens(text),
sendTokenLimit:
model.invocationParams().maxTokenLimit ??
model.getModelMaxContextSize(),
contextManager: this._contextManager,
promptRenderService: this._promptRenderer
})
Comment thread
dingyi222666 marked this conversation as resolved.

return createAgent({
id: options.id,
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"peerDependencies": {
"@koishijs/plugin-console": "^5.30.11",
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18",
"koishi-plugin-chatluna": "^1.4.0-alpha.19",
"koishi-plugin-chatluna-storage-service": "^1.0.6"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-long-memory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"resolutions": {
"@langchain/core": "^0.3.80",
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18",
"koishi-plugin-chatluna": "^1.4.0-alpha.19",
"koishi-plugin-chatluna-agent": "^1.0.30",
"koishi-plugin-chatluna-storage-service": "^1.0.6"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/extension-usage/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "koishi-plugin-chatluna-usage",
"description": "Usage records for ChatLuna model calls",
"version": "1.0.0",
"version": "1.0.1",
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -59,7 +59,7 @@
"peerDependencies": {
"@koishijs/plugin-console": "^5.30.11",
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-variable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"resolutions": {
"@langchain/core": "^0.3.80",
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/service-embeddings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"koishi": {
"description": {
Expand Down
2 changes: 1 addition & 1 deletion packages/service-multimodal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18",
"koishi-plugin-chatluna": "^1.4.0-alpha.19",
"koishi-plugin-ffmpeg-path": "^2.0.0"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion packages/service-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18",
"koishi-plugin-chatluna": "^1.4.0-alpha.19",
"koishi-plugin-chatluna-agent": "^1.0.30"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion packages/service-vector-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@zilliz/milvus2-sdk-node": "^2.6.2",
"faiss-node": "^0.5.1",
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
},
"peerDependenciesMeta": {
"@zilliz/milvus2-sdk-node": {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@
},
"peerDependencies": {
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.18"
"koishi-plugin-chatluna": "^1.4.0-alpha.19"
}
}
Loading