Some checks are pending
Build AeThex Engine / build-windows (push) Waiting to run
Build AeThex Engine / build-linux (push) Waiting to run
Build AeThex Engine / build-macos (push) Waiting to run
Build AeThex Engine / create-release (push) Blocked by required conditions
Deploy Docsify Documentation / build (push) Waiting to run
Deploy Docsify Documentation / deploy (push) Blocked by required conditions
72 lines
2.1 KiB
C++
72 lines
2.1 KiB
C++
/**************************************************************************/
|
|
/* ai_assistant.h */
|
|
/**************************************************************************/
|
|
/* This file is part of: */
|
|
/* AETHEX ENGINE */
|
|
/* https://aethex.dev */
|
|
/**************************************************************************/
|
|
|
|
#ifndef AI_ASSISTANT_H
|
|
#define AI_ASSISTANT_H
|
|
|
|
#include "api/ai_api_client.h"
|
|
#include "core/object/object.h"
|
|
#include "core/templates/hash_map.h"
|
|
#include "core/variant/variant.h"
|
|
|
|
class AIAssistant : public Object {
|
|
GDCLASS(AIAssistant, Object);
|
|
|
|
private:
|
|
static AIAssistant *singleton;
|
|
Ref<AIAPIClient> api_client;
|
|
HashMap<String, String> response_cache;
|
|
bool initialized = false;
|
|
String api_key;
|
|
|
|
// Internal methods
|
|
String _get_cached_response(const String &p_prompt);
|
|
void _cache_response(const String &p_prompt, const String &p_response);
|
|
|
|
protected:
|
|
static void _bind_methods();
|
|
|
|
public:
|
|
enum CompletionType {
|
|
COMPLETION_TYPE_CODE,
|
|
COMPLETION_TYPE_DOCUMENTATION,
|
|
COMPLETION_TYPE_EXPLANATION,
|
|
COMPLETION_TYPE_FIX
|
|
};
|
|
|
|
// Initialization
|
|
Error initialize(const String &p_api_key = "");
|
|
bool is_initialized() const { return initialized; }
|
|
|
|
// Code assistance
|
|
String get_code_completion(const String &p_context, const PackedStringArray &p_recent_code);
|
|
String explain_code(const String &p_code_block);
|
|
String fix_error(const String &p_error_message, const String &p_code_context);
|
|
|
|
// Documentation
|
|
String generate_function_docs(const String &p_function_signature);
|
|
String generate_class_docs(const String &p_class_code);
|
|
|
|
// Natural language
|
|
String natural_language_to_code(const String &p_description, const String &p_context);
|
|
|
|
// Settings
|
|
void set_api_key(const String &p_key);
|
|
String get_api_key() const;
|
|
void clear_cache();
|
|
|
|
// Singleton access
|
|
static AIAssistant *get_singleton();
|
|
|
|
AIAssistant();
|
|
~AIAssistant();
|
|
};
|
|
|
|
VARIANT_ENUM_CAST(AIAssistant::CompletionType);
|
|
|
|
#endif // AI_ASSISTANT_H
|