-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Ace-Radom/dev
HTTP Response Code Parse; Input History Record; Slash Commands Update; Tokens Count
- Loading branch information
Showing
28 changed files
with
865 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef _CLI_H_ | ||
#define _CLI_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include<stdio.h> | ||
#include<string.h> | ||
#include<stdlib.h> | ||
#include<unistd.h> | ||
|
||
#include<pthread.h> | ||
#include<readline/readline.h> | ||
#include<readline/history.h> | ||
|
||
#include"openai_api.h" | ||
#include"cli/toolkit.h" | ||
|
||
int start_CLI(); | ||
// this is an api for main.c | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef _SLASHCMD_H_ | ||
#define _SLASHCMD_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<string.h> | ||
|
||
#include<readline/readline.h> | ||
|
||
#include"openai_api.h" | ||
#include"ezylog.h" | ||
#include"utils.h" | ||
|
||
extern const char* slash_commands[]; | ||
|
||
int handle_slash_command( const char* __slashcmd ); | ||
|
||
void print_slash_command_help(); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef _TOOLKIT_H_ | ||
#define _TOOLKIT_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<unistd.h> | ||
#include<string.h> | ||
#include<termios.h> | ||
|
||
#include<readline/readline.h> | ||
|
||
#include"slashcmd.h" | ||
|
||
#define HIDE_CURSOR "\033[?25l" | ||
#define SHOW_CURSOR "\033[?25h" | ||
|
||
extern struct termios ori_attr; | ||
|
||
// =============================================== | ||
// ================== CLI Tools ================== | ||
// =============================================== | ||
|
||
void get_original_terattr(); | ||
void reset_terattr(); | ||
void turn_off_echo(); | ||
|
||
void write_ANSI( const char* __ANSI ); | ||
|
||
void print_wait_msg( const char* __msg ); | ||
|
||
char** rl_attempted_completion_callback( const char* text , int start , int end ); | ||
char* rl_completion_search( const char* text , int state ); | ||
|
||
// =============================================== | ||
// ================== str Tools ================== | ||
// =============================================== | ||
|
||
char* trim( char* __str ); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef _TIKTOKENS_H_ | ||
#define _TIKTOKENS_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<string.h> | ||
|
||
#include<jansson.h> | ||
|
||
extern long count_tokens_cl100k_base( const char* ptr ); | ||
// this is a rust FFI used to count tokens of a message with cl100k_base | ||
|
||
long count_tokens_message( const json_t* __msg ); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.