Skip to content

Commit

Permalink
CompletionStatistics
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Dec 18, 2024
1 parent 27d188b commit dd94d4a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lua/fittencode/chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -535,16 +535,16 @@ end
---@param e fittencode.chat.ChatModel
---@param selected_state boolean
function State.get_state_from_model(e, selected_state)
selected_state = selected_state or true
selected_state = selected_state == nil and true or selected_state
local n = {}

for _, a in pairs(e.conversations) do
local A = a:to_state_conversation()
if selected_state then
if a.id == e.selected_conversation_id then
A.reference = {
selectText = a:get_select_text(),
selectRange = a:get_select_range()
selectText = editor.get_selected_text(),
selectRange = editor.get_selected_range()
}
else
if A.content.type == 'messageExchange' then
Expand All @@ -565,9 +565,9 @@ function State.get_state_from_model(e, selected_state)
hasFittenAIApiKey = Client.has_fitten_ai_api_key(),
surfacePromptForFittenAIPlus = Config.fittencode.fittenAI.surfacePromptForPlus,
serverURL = Client.server_url(),
showHistory = e.show_history,
showHistory = false, -- TODO: Save state of history
fittenAIApiKey = Client.get_ft_token(),
openUserCenter = e.open_user_center,
openUserCenter = false, -- TODO: Save state of user center
tracker = e.tracker,
trackerOptions = e.tracker_options
}
Expand Down
30 changes: 29 additions & 1 deletion lua/fittencode/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
---@field content string

---@class fittencode.chat.Reference
---@

---@class fittencode.chat.Conversation
---@field abort_before_answer boolean
Expand Down Expand Up @@ -105,6 +104,35 @@
---@field change_favorited function
---@field conversations table<fittencode.chat.Conversation>
---@field selected_conversation_id string
---@field tracker fittencode.chat.Tracker
---@field tracker_options fittencode.chat.TrackerOptions

---@class fittencode.chat.Tracker
---@field ft_token string
---@field has_lsp boolean
---@field enabled boolean
---@field chosen string
---@field use_project_completion boolean
---@field uri string
---@field accept_cnt number
---@field insert_without_paste_cnt number
---@field insert_cnt number
---@field delete_cnt number
---@field completion_times number
---@field completion_total_time number
---@field insert_with_completion_without_paste_cnt number
---@field insert_with_completion_cnt number

---@class fittencode.chat.TrackerOptions
---@field requestUrl string
---@field extra fittencode.chat.TrackerOptionsExtra

---@class fittencode.chat.TrackerOptionsExtra
---@field ft_token string
---@field tracker_type string
---@field tracker_event_type string

---@class fittencode.chat.CompletionStatistics

---@class fittencode.chat.ChatController
---@field chat_view fittencode.view.ChatView
Expand Down

0 comments on commit dd94d4a

Please sign in to comment.