This repository was archived by the owner on Jul 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Sample PR - C++ #2
Draft
heikeOnScale
wants to merge
25
commits into
main
Choose a base branch
from
feature/c_plus_context
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0aa7a60
first push
heikeOnScale 0c87f5b
add global context
heikeOnScale 9a60a88
add
heikeOnScale cc29afc
add partent and child
heikeOnScale 241ec7b
use secret token with env variable
heikeOnScale ac44c7e
updates
heikeOnScale 228c571
modified
heikeOnScale c21e951
check token exist
heikeOnScale a52710b
modification to the query
heikeOnScale 92967a0
add to queries
heikeOnScale df8f13e
upadte token
heikeOnScale 12c505e
just exit when toke doen't exist
heikeOnScale df4fdac
add sample_code
heikeOnScale 8e7e285
working diff test
heikeOnScale 936259a
change back to clean code
heikeOnScale 113a68a
add functionality to extract git_diff into files
heikeOnScale 019f1a0
add openai call per file
heikeOnScale 23e6e44
exclude header files
heikeOnScale 3a546fa
change slightly the query
heikeOnScale 180faaa
add large file chatGPT handling
heikeOnScale 9fc96e8
some more additions
heikeOnScale 64842cd
break file only when reaching a function ending
heikeOnScale 1fd5410
some changes
heikeOnScale e280a6f
add some test gitdiff files
heikeOnScale 0358c0f
remove all empty files
heikeOnScale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,14 @@ | ||
| #include "ParentClass.h" | ||
|
|
||
| using namespace GlobalContextNameSpace; | ||
|
|
||
| ParentClass::ParentClass() | ||
| { | ||
| // Constructor implementation (if needed) | ||
| } | ||
|
|
||
| ParentClass::~ParentClass() | ||
| { | ||
| // Destructor implementation (if needed) | ||
| } | ||
|
|
This file contains hidden or 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,34 @@ | ||
| #ifndef GLOBAL_CONTEXT_CLASS_MODEL_H | ||
| #define GLOBAL_CONTEXT_CLASS_MODEL_H | ||
|
|
||
| #include <string> | ||
|
|
||
| namespace GlobalContextNameSpace | ||
| { | ||
| class ParentClass | ||
| { | ||
| public: | ||
| ParentClass(); | ||
| ~ParentClass(); | ||
|
|
||
| virtual int getValue(); | ||
|
|
||
| protected: | ||
| int m_A = 0; | ||
| double m_B = 0.0; | ||
|
|
||
| private: | ||
| std::string name = ""; | ||
| }; | ||
|
|
||
| class | ||
| } // GlobalContextNameSpace | ||
|
|
||
| inline int ParentClass::getValue() | ||
| { | ||
| return m_A; | ||
| } | ||
|
|
||
|
|
||
|
|
||
| #endif |
This file contains hidden or 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,42 @@ | ||
| """ | ||
| This example script demonstrates how to use the OpenAI chat API. | ||
|
|
||
| GPT-4 model: | ||
| https://platform.openai.com/docs/models/gpt-4 | ||
|
|
||
| Chat completion API: | ||
| https://platform.openai.com/docs/guides/chat | ||
|
|
||
| """ | ||
| import openai | ||
|
|
||
| # CSEBU token | ||
| openai.api_key = "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" | ||
|
|
||
|
|
||
| prompt = """ | ||
|
|
||
| Create a c++ class using this democode | ||
|
|
||
| """ | ||
|
|
||
| with open('GlobalContextClass.h', 'r') as file: | ||
| data = file.read().replace('\n', '') | ||
| prompt += data | ||
|
|
||
| with open('GlobalContextClass.cpp', 'r') as file: | ||
| data = file.read().replace('\n', '') | ||
| prompt += data | ||
|
|
||
| response = openai.ChatCompletion.create( | ||
| model="gpt-4", | ||
| messages=[ | ||
| {"role": "system", "content": "You are a very kind programmer."}, | ||
| {"role": "user", "content": prompt}, | ||
| # {"role": "assistant", "content": init_response}, | ||
| # {"role": "user", "content": elab} | ||
| ] | ||
| ) | ||
|
|
||
| text = response['choices'][0].message.content | ||
| print(text) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.