Skip to content

Commit f856521

Browse files
committed
Add model
1 parent f4b33cc commit f856521

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

docs/protocol.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,10 @@ interface RewriteStartedContent {
14761476
type: 'started';
14771477
}
14781478

1479+
interface RewriteReasoningContent {
1480+
type: 'reasoning';
1481+
}
1482+
14791483
interface RewriteTextContent {
14801484
type: 'text';
14811485

@@ -1488,6 +1492,7 @@ interface RewriteFinishedContent {
14881492

14891493
type RewriteContent =
14901494
RewriteStartedContent
1495+
| RewriteReasoningContent
14911496
| RewriteTextContent
14921497
| RewriteFinishedContent;
14931498

src/eca/features/rewrite.clj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
[provider model] (string/split full-model #"/" 2)
2626
model-capabilities (get-in db [:models full-model])
2727
full-text (when path (llm-api/refine-file-context path nil))
28+
start-time (System/currentTimeMillis)
2829
instructions (f.prompt/build-rewrite-instructions text path full-text range config)
2930
ctx {:db* db*
3031
:config config
@@ -48,11 +49,15 @@
4849
:provider-auth (get-in db [:auth provider])
4950
:on-first-response-received (fn [& _]
5051
(send-content! ctx {:type :started}))
52+
:on-reason (fn [{:keys [status]}]
53+
(when (= :started status)
54+
(send-content! ctx {:type :reasoning})))
5155
:on-message-received (fn [{:keys [type] :as msg}]
5256
(case type
5357
:text (send-content! ctx {:type :text
5458
:text (:text msg)})
55-
:finish (send-content! ctx {:type :finished})
59+
:finish (send-content! ctx {:type :finished
60+
:total-time-ms (- (System/currentTimeMillis) start-time)})
5661
nil))}))
5762
{:status "prompting"
58-
:model model}))
63+
:model full-model}))

0 commit comments

Comments
 (0)