other
- Location
scripts/analyze_style_llm.py:67- Finding
Undisclosed Transmission of User Text to an External LLM Service
- Content
View full analysis
str: """Build the API prompt.""" return f"""Please analyze the writing style of the following text and return the result in JSON format. Text: {text[:8000]} Please analyze the following dimensions: 1. Style labels 2. Pace 3. Tone 4. Sentiment Required response format: {{"voice_profile": {{"labels": ["label1", "label2"], "pace": "apidity", "tone": "tone", "sentiment": 0.0}}}} """ ``` ```python def _call_dashscope_api(self, prompt: str) -> dict[str, Any]: """Call the DashScope API.""" url = "https://coding.dashscope.aliyuncs.com/v1/chat/completions" headers = { "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json", } payload = { "model": self.model, "messages": [{"role": "user", "content": prompt}], "temperature": 0.3, "response_format": {"type": "json_object"}, } with Progress( SpinnerColumn(), TextColumn("[bold cyan]Calling LLM to analyze style...[/bold cyan]"), console=console, transient=True, ) as progress: progress.add_task("analyzing", total=None) response = requests.post(url, headers=headers, json=payload, timeout=60) response.raise_for_status() return response.json() ``` The English comments and prompt text above translate the original Chinese literals without changing the code behavior. The executable source embeds up to 8,000 characters of the supplied document in the API request. ### Technic ...[truncated 2102 chars]- Remediation
View remediation
