I'm a full-stack developer and open source enthusiast, good at front-end development.
- ๐ฑ Iโm currently learning cryptocurrency
- ๐ฌ Follow me on Twitter
- ๐ซ Ping me if you can find a way
A Neovim plugin powered by AI.
I'm a full-stack developer and open source enthusiast, good at front-end development.
When sending multiline prompt to Gemini, the lines are joined without line break.
This is because lines are just joined without appending \n
.
Appending \n
to each lines would help having a prettier loading_tpl
if we include the ${input}
in it, and may be, will make the promt more understandable by Gemini.
Hi @gera2ld, I've been trying out your plugin with great results until recently, when all the commands I try to send using gemini are returning with a bad request response:
Gemini
Error: Gemini API responded with the status 400
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"role\" at 'contents[0].parts': Cannot find field.\nInvalid JSON payload received. Unknown name \"role\" at 'contents[1].parts': Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "contents[0].parts",
"description": "Invalid JSON payload received. Unknown name \"role\" at 'contents[0].parts': Cannot find field."
},
{
"field": "contents[1].parts",
"description": "Invalid JSON payload received. Unknown name \"role\" at 'contents[1].parts': Cannot find field."
}
]
}
]
}
}
If it helps, this is the configuration I'm using: https://github.com/davidmh/dot-files/blob/main/nvim/fnl/plugins/gemini.fnl
Hello @gera2ld,
Gemini Pro 1.5 now supports "system instruction", just like ChatGPT does.
We did not leverage it before, but now we can.
I made it here: natixgroup/code-ai.nvim@ec8f0c1
Unfortunately, my fork has too much divergence with here so that it would be too much hard to merge.
I just put this here if you want to implement it.
Regards.
Error executing Lua callback: .../ai.nvim/lua/ai/init.lua:83: Column index is too high
stack traceback:
[C]: in function 'nvim_buf_get_text'
.../ai.nvim/lua/ai/init.lua:83: in function 'getSelectedText'
If selecting in simple visual
mode, no problem.
This occurs only in visual-line
selecting
@gera2ld,
I propose to add chatGPT API to the extension.
Implementation is very similar to Gemini's one, this wont be a lot more lines of code.
We would display Gemini and chatGPT in the pop up, like this:
Gemini says:
Gemini answer
Gemini answer
Gemini answer
ChatGPT says:
ChatGPT answer
ChatGPT answer
ChatGPT answer
There will be feature flags: in the config, users will be able to enable or disable one or another.
Note that it is not a perfect thing, but you know is software development, improvements are incremental ;-)
Processing API response can be a big chunk of code, because the JSON response can have a different structure depending on Gemini feeling.
Let's not concentrate processing that response in the callback lambda function: let's split it out.
how do we resize the window? I don't think we can resize it?
When AI answer contains %
, that caracter is silently ignored.
Lets take as exemple this Symfony services.yaml
file:
# This is a services.yaml file in a Symfony project.
# In ../.env file, I set MIHAMINA_ID to 1234.
# I want to set the parameter mihamina_id to the value of MIHAMINA_ID.
# Modify the parameters section of this services.yaml file
# to set the mihamina_id parameter to the value of MIHAMINA_ID.
parameters:
services:
_defaults:
autowire: true
autoconfigure: true
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
If I prompt AI with the whole file, the displayed result is :
parameters:
mihamina_id: 'env(MIHAMINA_ID)'
services:
_defaults:
autowire: true
autoconfigure: true
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
We notice the %
are missing.
It should be:
parameters:
mihamina_id: '%env(MIHAMINA_ID)%'
services:
_defaults:
autowire: true
autoconfigure: true
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
We must escape the %
in the AI response with a kind of :
function query.escapePercent(s)
return string.gsub(s, "%%", "%%%%")
end
I made it quickly in https://github.com/natixgroup/ai.nvim/commit/0356e9a7ecb19937720d4cd5b8c6239870821fa6 but it very ugly as it needs to be factorized.
The result popup would be better if
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.