Update.
This commit is contained in:
parent
ee30308081
commit
cc04745542
38
README.md
38
README.md
@ -1,26 +1,24 @@
|
|||||||
# R
|
# R Vibe Tool
|
||||||
|
|
||||||
This is a CLI vibe coding tool written in C and is available for Linux x86 only.
|
R is a CLI vibe tool for Linux with nice markdown output. It has agent support. Put your instructions into `~/.rcontext.txt`to describe how it should behave. Tip: include the saving of files as instruction step. Use the `index` tool to initialize only source files and no environment / node_modules files to continue on an existing project! Good to instruct that first of your `.rcontext.txt` file.
|
||||||
It works on OpenAI but is easy to convert to Ollama since Ollama supports OpenAI api on /v1/api.
|
|
||||||
The tool is made for my private use, but since it works so well, I decided to publish it. It contains some experimental stuff like Claude. Claude works.
|
|
||||||
|
|
||||||
If you need some help to get Ollama / Claude working, contact me on [Snek](https://snek.molodetz.nl).
|
By default it uses OpenAI GPT-3.5-turbo as the model. It will use my limited OpenAI key as example.
|
||||||
|
That will thus only work temporary! Good news, Ollama and Claude are also supported
|
||||||
|
|
||||||
What I vibed with it:
|
An example what I have vibed with is [this](https://molodetz.nl/projects/streamii/README.md.html).
|
||||||
- A part of the tool itself. It had many example code so it was easy to add modifications.
|
|
||||||
- A web socket notification system in C#.
|
|
||||||
|
|
||||||
The application has a built-in OPENAI_API_KEY with limited resources, so people can try.
|
## How to get it working under OLLAMA
|
||||||
|
### Ollama molodetz server is slow.
|
||||||
## Download
|
```bash
|
||||||
```
|
export R_MODEL="qwen2.5:3b"
|
||||||
wget https://retoor.molodetz.nl/api/packages/retoor/generic/r/1.0.0/r
|
export R_BASE_URL="https://ollama.molodetz.nl"
|
||||||
|
./r
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configure OpenAI API key
|
## How to get it working under ANTHROPIC CLAUDE
|
||||||
Update your bashrc with `export OPENAI_API_KEY=sk-...`.
|
```
|
||||||
|
export R_MODEL="claude-3-5-haiku-20241022"
|
||||||
## Working on an existing project.
|
export R_BASE_URL="https://api.anthropic.com"
|
||||||
When starting on existing project, use `init`. Now you can ask it to make modifications to your files / system.
|
export R_KEY="sk-ant-"
|
||||||
|
./r
|
||||||
|
```
|
||||||
|
@ -76,6 +76,8 @@ char *curl_post(const char *url, const char *data) {
|
|||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&response);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&response);
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
if (res != CURLE_OK) {
|
if (res != CURLE_OK) {
|
||||||
|
fprintf(stderr, "Url: %s\n",data);
|
||||||
|
fprintf(stderr, "Data: %s\n",data);
|
||||||
fprintf(stderr, "An error occurred: %s\n", curl_easy_strerror(res));
|
fprintf(stderr, "An error occurred: %s\n", curl_easy_strerror(res));
|
||||||
}
|
}
|
||||||
curl_slist_free_all(headers);
|
curl_slist_free_all(headers);
|
||||||
@ -114,4 +116,4 @@ char *curl_get(const char *url) {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
3
openai.h
3
openai.h
@ -46,7 +46,7 @@ bool openai_system(char *message_content) {
|
|||||||
|
|
||||||
struct json_object *openai_process_chat_message(const char *api_url,
|
struct json_object *openai_process_chat_message(const char *api_url,
|
||||||
const char *json_data) {
|
const char *json_data) {
|
||||||
char *response = curl_post(api_url, json_data);
|
char *response = curl_post(api_url, json_data);
|
||||||
if (!response) {
|
if (!response) {
|
||||||
fprintf(stderr, "Failed to get response.\n");
|
fprintf(stderr, "Failed to get response.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -80,6 +80,7 @@ struct json_object *openai_process_chat_message(const char *api_url,
|
|||||||
struct json_object *choices_array;
|
struct json_object *choices_array;
|
||||||
if (!json_object_object_get_ex(parsed_json, "choices", &choices_array)) {
|
if (!json_object_object_get_ex(parsed_json, "choices", &choices_array)) {
|
||||||
fprintf(stderr, "Failed to get 'choices' array.\n%s\n", response);
|
fprintf(stderr, "Failed to get 'choices' array.\n%s\n", response);
|
||||||
|
fprintf(stderr, "%s\n", json_object_to_json_string(parsed_json));
|
||||||
json_object_put(parsed_json);
|
json_object_put(parsed_json);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user