-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typo corrections #1782
Typo corrections #1782
Conversation
"This section tutorial will guide you" — the correct phrasing would be "This tutorial section will guide you». The mistake is in the word order. "Section tutorial" should be rephrased as "tutorial section" or "section of the tutorial."
"When getting started Celestia" — should be "When getting started with Celestia". The word "with" is missing. The correct phrase is "getting started with Celestia."
"order to sign up for an account and generate an OpenAI API key." This sentence has an extra "order" at the beginning. It should be: "In order to sign up for an account and generate an OpenAI API key."
"This section tutorial will guide you through using the most common RPC endpoints with..." The word "section" is incorrect here. It should be: "This tutorial section will guide you through using the most common RPC endpoints with..." This change ensures the sentence flows correctly and makes more sense grammatically.
WalkthroughThis pull request introduces several textual modifications across multiple tutorial documents. The changes include grammatical corrections and improvements for clarity in the Golang client library tutorial, the integration tutorial for Celestia, and the Rust client library tutorial. Additionally, a new tutorial for a game called "Prompt Scavenger" is added, detailing the use of Celestia’s Node API and OpenAI’s GPT-3.5 in Golang, along with new functions to facilitate interaction with the blockchain and AI. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
tutorials/prompt-scavenger.md (3)
Line range hint
297-324
: Consider parameterizing network-specific valuesThe function works well but has hardcoded values that could limit its reusability:
- Gas price is fixed to default
- Explorer URL is specific to Arabica network
Consider making these configurable:
func createAndSubmitBlob( ctx context.Context, client *nodeclient.Client, ns share.Namespace, payload string, + gasPrice uint64, + explorerURL string, ) (*blob.Blob, uint64, error) { createdBlob, err := blob.NewBlobV0(ns, []byte(payload)) if err != nil { return nil, 0, fmt.Errorf("Failed to create blob: %w", err) } - height, err := client.Blob.Submit(ctx, []*blob.Blob{createdBlob}, blob.DefaultGasPrice()) + height, err := client.Blob.Submit(ctx, []*blob.Blob{createdBlob}, gasPrice) if err != nil { return nil, 0, fmt.Errorf("Failed to submit blob: %v", err) } log.Printf("Blob submitted successfully at height: %d! \n", height) - log.Printf("Explorer link: https://arabica.celenium.io/block/%d \n", height) + log.Printf("Explorer link: %s/block/%d \n", explorerURL, height) return createdBlob, height, nil }🧰 Tools
🪛 LanguageTool
[style] ~82-~82: Consider a shorter alternative to avoid wordiness.
Context: ...for an account and generate an API key. In order to sign up for an account and generate an ...(IN_ORDER_TO_PREMIUM)
Line range hint
442-471
: Enhance security and reliability of OpenAI API interactionConsider the following security and reliability improvements:
- Add context timeout for API calls
- Consider providing a more secure way to handle API keys
Apply these improvements:
func gpt3(ctx context.Context, msg string) (string, error) { + // Add timeout to prevent hanging + ctx, cancel := context.WithTimeout(ctx, 30*time.Second) + defer cancel() + openAIKey := os.Getenv("OPENAI_KEY") if openAIKey == "" { return "", fmt.Errorf("OPENAI_KEY environment variable not set") } + + // Consider using a secrets manager in production client := openai.NewClient(openAIKey) resp, err := client.CreateChatCompletion( ctx, openai.ChatCompletionRequest{ Model: openai.GPT3Dot5Turbo, Messages: []openai.ChatCompletionMessage{ { Role: openai.ChatMessageRoleUser, Content: msg, }, }, }, )Don't forget to add the time package to imports:
+import "time"
🧰 Tools
🪛 LanguageTool
[style] ~82-~82: Consider a shorter alternative to avoid wordiness.
Context: ...for an account and generate an API key. In order to sign up for an account and generate an ...(IN_ORDER_TO_PREMIUM)
Line range hint
475-527
: Enhance error handling and add graceful shutdownThe main function works well but could benefit from these improvements:
- Add signal handling for graceful shutdown
- Improve error messages for better user experience
Consider these improvements:
+import ( + "os/signal" + "syscall" +) func main() { ctx, cancel := context.WithCancel(context.Background()) + + // Setup signal handling + sigChan := make(chan os.Signal, 1) + signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) + go func() { + <-sigChan + log.Println("Shutting down gracefully...") + cancel() + }() + defer cancel() if len(os.Args) != 4 { - log.Fatal("Usage: go run main.go <nodeIP> <namespace> <prompt>") + log.Fatal("Error: Incorrect number of arguments\n\n" + + "Usage: go run main.go <nodeIP> <namespace> <prompt>\n" + + "Example: go run main.go ws://localhost:26658 ce1e5714 'What is a modular blockchain?'") } // ... rest of the code ... client, err := nodeclient.NewClient(ctx, nodeIP, "") if err != nil { - log.Fatalf("Failed to create client: %v", err) + log.Fatalf("Error connecting to node at %s: %v\n"+ + "Please ensure your Celestia node is running and accessible.", nodeIP, err) } defer client.Close()🧰 Tools
🪛 LanguageTool
[style] ~82-~82: Consider a shorter alternative to avoid wordiness.
Context: ...for an account and generate an API key. In order to sign up for an account and generate an ...(IN_ORDER_TO_PREMIUM)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
tutorials/golang-client-tutorial.md
(1 hunks)tutorials/integrate-celestia.md
(1 hunks)tutorials/prompt-scavenger.md
(1 hunks)tutorials/rust-client-tutorial.md
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- tutorials/golang-client-tutorial.md
- tutorials/integrate-celestia.md
- tutorials/rust-client-tutorial.md
🔇 Additional comments (2)
tutorials/prompt-scavenger.md (2)
83-83
: LGTM: Text correction improves readability
The removal of the redundant "order" word makes the sentence clearer and more concise.
Line range hint 279-290
: LGTM: Well-structured namespace conversion function
The function properly handles hex string conversion with appropriate error handling and clear documentation.
🧰 Tools
🪛 LanguageTool
[style] ~82-~82: Consider a shorter alternative to avoid wordiness.
Context: ...for an account and generate an API key. In order to sign up for an account and generate an ...
(IN_ORDER_TO_PREMIUM)
Congrats, your important contribution to this open-source project has earned you a GitPOAP! GitPOAP: 2024 Celestia Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
Overview
Added typo corrections to documentation for the following files:
tutorials/golang-client-tutorial.md
"This section tutorial will guide you" — the correct phrasing would be "This tutorial section will guide you".
The mistake is in the word order. "Section tutorial" should be rephrased as "tutorial section" or "section of the tutorial."
tutorials/integrate-celestia.md
"When getting started Celestia" — should be "When getting started with Celestia".
The word "with" is missing.
The correct phrase is "getting started with Celestia."
tutorials/prompt-scavenger.md
"order to sign up for an account and generate an OpenAI API key."
This sentence has an extra "order" at the beginning. It should be: "In order to sign up for an account and generate an OpenAI API key."
tutorials/rust-client-tutorial.md
"This section tutorial will guide you through using the most common RPC endpoints with..."
The word "section" is incorrect here. It should be:
"This tutorial section will guide you through using the most common RPC endpoints with..."
This change ensures the sentence flows correctly and makes more sense grammatically.
The purpose of corrections
Correct grammatical errors and improve readability of the documentation.
Summary by CodeRabbit
New Features
Improvements
Bug Fixes