Skip to content

Commit 3169566

Browse files
committed
Homogenize initialization logging
1 parent 9547b0c commit 3169566

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/ai_cli.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ setup(void)
143143
if (dlerror())
144144
return; // Program not linked with readline(3)
145145

146-
147146
// Obtain remaining variable symbols
148147
rl_end_ptr = dlsym(RTLD_DEFAULT, "rl_end");
149148
rl_point_ptr = dlsym(RTLD_DEFAULT, "rl_point");

src/fetch_anthropic.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ anthropic_get_response_content(const char *json_response)
6666
}
6767

6868
/*
69-
* Initialize anthropic connection
69+
* Initialize curl and anthropic connection
70+
* Sets curl variable
7071
* Return 0 on success -1 on error
7172
*/
7273
static int
@@ -93,7 +94,7 @@ acl_fetch_anthropic(config_t *config, const char *prompt, int history_length)
9394
return NULL;
9495

9596
if (config->general_verbose)
96-
fprintf(stderr, "\nContacting Llamacpp API...\n");
97+
fprintf(stderr, "\nContacting Anthropic API...\n");
9798

9899
struct curl_slist *headers = NULL;
99100
headers = curl_slist_append(headers, "content-type: application/json");

src/fetch_hal.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
* limitations under the License.
1919
*/
2020

21+
#include <stdbool.h>
22+
#include <unistd.h>
23+
2124
#include "config.h"
2225
#include "fetch_hal.h"
2326
#include "support.h"
@@ -32,5 +35,16 @@
3235
char *
3336
acl_fetch_hal(config_t *config, const char *prompt, int history_length)
3437
{
38+
static bool initialized;
39+
40+
if (!initialized) {
41+
if (config->general_verbose)
42+
fprintf(stderr, "\nInitializing HAL, program name [%s] system prompt to use [%s]\n",
43+
acl_short_program_name(), config->prompt_system);
44+
initialized = true;
45+
}
46+
if (config->general_verbose)
47+
fprintf(stderr, "\nHAL is processing...\n");
48+
sleep(1); // Simulate processing latency
3549
return acl_safe_strdup("# I'm sorry, Dave. I'm afraid I can't do that.");
3650
}

0 commit comments

Comments
 (0)