Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskExpert ¶
AskExpert calls the AI expert model for consultation and returns the reply.
This function executes the dscli chat command via internal/shell, writes the input content to a temporary file, and passes it to dscli via the --input flag, avoiding command-line length limits and stdin issues.
Parameters:
ctx: context object for passing execution environment configuration
input: input text to send to the AI model, can be any length
(limited by system memory)
Returns:
reply: the AI model's response text. Returns empty string if execution
fails without obtaining a reply.
err: error during execution. Returns nil on success. Common errors include:
- dscli command execution failure
- temporary file creation/write failure
Details:
The function invokes the AI model by executing the following command:
dscli chat --no-color --no-timestamp --histsize 0 --model <model_name> --input <temp_file>
where the model name is specified by ModelDeepseekReasoner.
Notes:
- Ensure the dscli CLI tool is properly installed and configured.
- Input content is passed via a temporary file that is automatically cleaned up after execution.
Example:
ctx := context.Background()
reply, err := AskExpert(ctx, "Please analyze the quality of this code")
if err != nil {
log.Printf("Consultation failed: %v", err)
} else {
fmt.Println(reply)
}
See also:
- shell.SimpleExecute: function for executing shell commands
- handleAskExpert: tool handler function that uses this function
func AskExpertWithRole ¶ added in v0.7.8
AskExpertWithRole calls the AI model for consultation with a specified role (dev/expert/review).
This function executes the dscli chat command via internal/shell, writes the input content to a temporary file, and passes it to dscli via the --input and --role flags.
Parameters:
ctx: context object input: input text to send to the AI model role: role (dev/expert/review)
Returns:
reply: the AI model's response text err: error during execution
Types ¶
This section is empty.
Source Files
¶
- ask_expert.go
- ask_user.go
- code_review.go