-
hey, I'm using some local models served by lmstudio. But the visual selection isn't being sent to the model. I'm using this config:
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Are you on latest commit? I moved some stuff around, now you need both prepare_input and prepare_output functions, but for openai compatible apis you can just copy them (see updated ollama example) |
Beta Was this translation helpful? Give feedback.
-
So i tried with this config: lmstudio = {
embed = 'copilot_embeddings',
prepare_input = providers.copilot.prepare_input,
prepare_output = providers.copilot.prepare_output,
get_headers = function()
return {
['Content-Type'] = 'application/json',
}
end,
get_models = function(headers)
local response = cutils.curl_get('http://localhost:1234/v1/models', { headers = headers })
if not response or response.status ~= 200 then
error('Failed to fetch models: ' .. tostring(response and response.status))
end
local models = {}
for _, model in ipairs(vim.json.decode(response.body).data) do
table.insert(models, {
id = model.id,
name = model.id
})
end
return models
end,
get_url = function()
return 'http://localhost:1234/v1/chat/completions'
end,
}, and it looked fine: {
"messages": [
{
"role": "system",
"content": "You are a code-focused AI programming assistant that specializes in practical software engineering solutions.\nWhen asked for your name, you must respond with \"GitHub Copilot\".\nFollow the user's requirements carefully & to the letter.\nFollow Microsoft content policies.\nAvoid content that violates copyrights.\nIf you are asked to generate content that is harmful, hateful, racist, sexist, lewd, violent, or completely irrelevant to software engineering, only respond with \"Sorry, I can't assist with that.\"\nKeep your answers short and impersonal.\nThe user works in an IDE called Neovim which has a concept for editors with open files, integrated unit test support, an output pane that shows the output of running the code as well as an integrated terminal.\nThe user is working on a Linux machine. Please respond with system specific commands if applicable.\nYour task is to modify the provided code according to the user's request. Follow these instructions precisely:\n\n1. Split your response into minimal, focused code changes to produce the shortest possible diffs.\n\n2. IMPORTANT: Every code block MUST have a header with this exact format:\n [file:<file_name>](<file_path>) line:<start_line>-<end_line>\n The line numbers are REQUIRED - never omit them.\n\n3. Return ONLY the modified code blocks - no explanations or comments.\n\n4. Each code block should contain:\n - Only the specific lines that need to change\n - Exact indentation matching the source\n - Complete code that can directly replace the original\n\n5. When fixing code, check and address any diagnostics issues.\n\n6. If multiple separate changes are needed, split them into individual blocks with appropriate headers.\n\n7. If response would be too long:\n - Never cut off in the middle of a code block\n - Complete the current code block\n - End with \"**`[Response truncated] Please ask for the remaining changes.`**\"\n - Next response should continue with the next code block\n\nRemember: Your response should ONLY contain file headers with line numbers and code blocks for direct replacement."
},
{
"role": "user",
"content": "# FILE:NVIM/.CONFIG/NVIM/INIT.LUA CONTEXT\n```lua\n 1: -- Load existing vimrc\n 2: vim.cmd([[\n 3: set runtimepath^=~/.vim runtimepath+=~/.vim/after\n 4: let &packpath = &runtimepath\n 5: source ~/.vimrc\n 6: ]])\n 7: \n 8: require('config.mason')\n 9: require('config.rooter')\n10: require('config.ui')\n11: require('config.wiki')\n12: require('config.statuscolumn')\n13: require('config.finder')\n14: require('config.treesitter')\n15: require('config.completion')\n16: require('config.lsp')\n17: require('config.dap')\n18: require('config.git')\n19: require('config.copilot')\n```"
},
{
"role": "user",
"content": "> /COPILOT_GENERATE\n> #buffers\n\nwhat is my current selection"
},
{
"role": "assistant",
"content": ""
},
{
"role": "user",
"content": "[#file:nvim/.config/nvim/init.lua](#file:nvim/.config/nvim/init.lua-context)\nwhat is my current selection"
}
],
"temperature": 0.1,
"top_p": 1,
"stream": true,
"n": 1,
"model": "deepseek-r1-distill-qwen-7b"
} |
Beta Was this translation helpful? Give feedback.
-
Converted this to discussion for now |
Beta Was this translation helpful? Give feedback.
-
Oh actually this was indeed a bug, found it now |
Beta Was this translation helpful? Give feedback.
-
Its fixed now |
Beta Was this translation helpful? Give feedback.
-
that's right, it's fixed now, the model can see the code. Cheers! |
Beta Was this translation helpful? Give feedback.
Its fixed now