|
29 | 29 | (medley/deep-merge
|
30 | 30 | {:platform platform
|
31 | 31 | :username user
|
32 |
| - :project {:files (-> project-facts :project/files) |
33 |
| - :dockerfiles (-> project-facts :project/dockerfiles) |
34 |
| - :composefiles (-> project-facts :project/composefiles) |
35 |
| - :languages (-> project-facts :github/lingust)} |
| 32 | + :project-facts {:files (-> project-facts :project-facts :project/files) |
| 33 | + :dockerfiles (-> project-facts :project-facts :project/dockerfiles) |
| 34 | + :composefiles (-> project-facts :project-facts :project/composefiles) |
| 35 | + :languages (-> project-facts :project-facts :github/lingust)} |
36 | 36 | :languages (->> project-facts
|
37 | 37 | :github/linguist
|
38 | 38 | keys
|
|
68 | 68 | (-> container-definition
|
69 | 69 | (assoc :host-dir dir)))]
|
70 | 70 | (when (= 0 exit-code)
|
71 |
| - (case (:output-handler container-definition) |
72 |
| - "linguist" (->> (json/parse-string pty-output keyword) vals (into []) (assoc {} :linguist)) |
73 |
| - (json/parse-string pty-output keyword))))) |
| 71 | + (let [context |
| 72 | + (case (:output-handler container-definition) |
| 73 | + ;; we have one output-handler registered right now - it extracts the vals from a map |
| 74 | + "linguist" (->> (json/parse-string pty-output keyword) vals (into [])) |
| 75 | + (json/parse-string pty-output keyword))] |
| 76 | + (if-let [extractor-name (:name container-definition)] |
| 77 | + {(keyword extractor-name) context} |
| 78 | + context))))) |
74 | 79 | (catch Throwable ex
|
75 | 80 | (warn
|
76 | 81 | "unable to run extractors \n```\n{{ container-definition }}\n```\n - {{ exception }}"
|
|
85 | 90 | (map (fn [m] (merge (registry/get-extractor m) m))))]
|
86 | 91 | (if (seq extractors)
|
87 | 92 | extractors
|
88 |
| - [{:image "docker/lsp:latest" |
| 93 | + [{:name "project-facts" |
| 94 | + :image "docker/lsp:latest" |
89 | 95 | :entrypoint "/app/result/bin/docker-lsp"
|
90 | 96 | :command ["project-facts"
|
91 | 97 | "--vs-machine-id" "none"
|
|
172 | 178 | (jsonrpc/notify :message {:content (format "## (%s) sub-prompt" (:ref definition))})
|
173 | 179 | (let [{:keys [messages _finish-reason] :as m}
|
174 | 180 | (async/<!! (conversation-loop
|
175 |
| - (assoc opts :prompts-dir (git/prompt-dir (:ref definition)))))] |
| 181 | + (assoc opts :prompts-dir (git/prompt-dir (:ref definition)))))] |
176 | 182 | (jsonrpc/notify :message {:content (format "## (%s) end sub-prompt" (:ref definition))})
|
177 | 183 | (resolve (->> messages
|
178 | 184 | (filter #(= "assistant" (:role %)))
|
|
201 | 207 | (try
|
202 | 208 | (openai/openai
|
203 | 209 | (merge
|
204 |
| - m |
205 |
| - {:messages prompts :stream stream} |
| 210 | + m |
| 211 | + {:messages prompts} |
206 | 212 | (when (seq functions) {:tools functions})
|
207 | 213 | (when url {:url url})
|
208 |
| - (when model {:model model})) h) |
| 214 | + (when model {:model model}) |
| 215 | + (when (and stream (nil? (:stream m))) {:stream stream})) h) |
209 | 216 | (catch ConnectException _
|
210 | 217 | ;; when the conversation-loop can not connect to an openai compatible endpoint
|
211 | 218 | (async/>!! c {:messages [{:role "assistant" :content "I cannot connect to an openai compatible endpoint."}]
|
|
276 | 283 | [nil "--thread-id THREAD_ID" "use this thread-id for the next conversation"
|
277 | 284 | :assoc-fn (fn [m k v] (assoc m k v :save-thread-volume true))]
|
278 | 285 | [nil "--model MODEL" "use this model on the openai compatible endpoint"]
|
279 |
| - [nil "--stream" "stream responses" |
| 286 | + [nil "--stream" "stream responses" |
280 | 287 | :id :stream
|
281 | 288 | :default true
|
282 | 289 | :assoc-fn (fn [m k _] (assoc m k true))]
|
283 |
| - [nil "--nostream" "disable streaming responses" |
| 290 | + [nil "--nostream" "disable streaming responses" |
284 | 291 | :id :stream
|
285 | 292 | :assoc-fn (fn [m k _] (assoc m k false))]
|
286 | 293 | [nil "--debug" "add debug logging"]
|
|
377 | 384 | (System/exit 0))
|
378 | 385 | (let [cmd (apply command options arguments)]
|
379 | 386 | (alter-var-root
|
380 |
| - #'jsonrpc/notify |
381 |
| - (fn [_] (partial (if (:jsonrpc options) jsonrpc/-notify jsonrpc/-println) options))) |
| 387 | + #'jsonrpc/notify |
| 388 | + (fn [_] (partial (if (:jsonrpc options) jsonrpc/-notify jsonrpc/-println) options))) |
382 | 389 | ((if (:pretty-print-prompts options) output-prompts output-handler)
|
383 | 390 | (cmd))))))
|
384 | 391 | (catch Throwable t
|
|
0 commit comments