File tree Expand file tree Collapse file tree 4 files changed +14
-6
lines changed
Expand file tree Collapse file tree 4 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -419,6 +419,7 @@ ECA allows to totally customize the prompt sent to LLM via the `behavior` config
419419 }};
420420 defaultBehavior?: string;
421421 welcomeMessage?: string;
422+ compactPromptFile?: string;
422423 index?: {
423424 ignoreFiles: [{
424425 type: string;
@@ -480,8 +481,9 @@ ECA allows to totally customize the prompt sent to LLM via the `behavior` config
480481 ".*-c\\s+[\"'].*open.*[\"']w[\"'].*",
481482 ".*bash.*-c.*>.*"]}}}}}}
482483 }
483- "defaultBehavior": "agent"
484- "welcomeMessage" : "Welcome to ECA!\n\nType '/' for commands\n\n"
484+ "defaultBehavior": "agent",
485+ "welcomeMessage" : "Welcome to ECA!\n\nType '/' for commands\n\n",
486+ "compactPromptFile": "prompts/compact.md",
485487 "index" : {
486488 "ignoreFiles" : [ {
487489 "type" : "gitignore"
Original file line number Diff line number Diff line change 9090 :lspTimeoutSeconds 30
9191 :mcpServers {}
9292 :welcomeMessage " Welcome to ECA!\n\n Type '/' for commands\n\n "
93+ :compactPromptFile " prompts/compact.md"
9394 :index {:ignoreFiles [{:type :gitignore }]
9495 :repoMap {:maxTotalEntries 800
9596 :maxEntriesPerDir 50 }}})
Original file line number Diff line number Diff line change 190190 :role :system
191191 :content (merge {:type :usage }
192192 usage)})))
193- :prompt (f.prompt/compact-prompt (string/join " " args))})
193+ :prompt (f.prompt/compact-prompt (string/join " " args) config )})
194194 " login" (do (f.login/handle-step {:message (or (first args) " " )
195195 :chat-id chat-id}
196196 db*
Original file line number Diff line number Diff line change 11(ns eca.features.prompt
22 (:require
3+ [babashka.fs :as fs]
34 [clojure.java.io :as io]
45 [clojure.string :as string]
56 [eca.features.tools.mcp :as f.mcp]
2122(defn ^:private init-prompt-template* [] (slurp (io/resource " prompts/init.md" )))
2223(def ^:private init-prompt-template (memoize init-prompt-template*))
2324
24- (defn ^:private compact-prompt-template* [] (slurp (io/resource " prompts/compact.md" )))
25+ (defn ^:private compact-prompt-template* [file-path]
26+ (if (fs/relative? file-path)
27+ (slurp (io/resource file-path))
28+ (slurp (io/file file-path))))
29+
2530(def ^:private compact-prompt-template (memoize compact-prompt-template*))
2631
2732(defn ^:private replace-vars [s vars]
8792 (init-prompt-template )
8893 {:workspaceFolders (string/join " , " (map (comp shared/uri->filename :uri ) (:workspace-folders db)))}))
8994
90- (defn compact-prompt [additional-input]
95+ (defn compact-prompt [additional-input config ]
9196 (replace-vars
92- (compact-prompt-template )
97+ (compact-prompt-template ( :compactPromptFile config) )
9398 {:addionalUserInput (if additional-input
9499 (format " You MUST respect this user input in the summarization: %s." additional-input)
95100 " " )}))
You can’t perform that action at this time.
0 commit comments