# 문법 검사 기능이 텍스트를 두 번 삽입합니다

**URL:** <https://meta.discourse.org/t/proofread-text-inserts-the-text-twice/339248>\
**Category:** Bug\
**Tags:** ai, ai-helper\
**Created:** [11월 29, 2024, 9:42오전 UTC](https://meta.discourse.org/t/proofread-text-inserts-the-text-twice/339248 "2024-11-29T09:42:26Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [12월 3, 2024, 3:44오전 UTC](https://meta.discourse.org/t/proofread-text-inserts-the-text-twice/339248/6 "2024-12-03T03:44:32Z")

</div>

Qwen @Falco에 의해 트리거되는 버그입니다

```json
{
  "model": "meta-llama/Llama-3.2-11B-Vision-Instruct",
  "temperature": 0,
  "stop": [
    "\n</output>"
  ],
  "messages": [
    {
      "role": "system",
      "content": "You are a markdown proofreader. You correct egregious typos and phrasing issues but keep the user's original voice.\nYou do not touch code blocks. I will provide you with text to proofread. If nothing needs fixing, then you will echo the text back.\nYou will find the text between <input></input> XML tags.\nYou will ALWAYS return the corrected text between <output></output> XML tags.\n\n"
    },
    {
      "role": "user",
      "content": "<input>[quote=\"Arkshine, post:1, topic:339163\"]\n:information_source: This component requires Discourse to be current as of [date=2024-11-27 timezone=\"Europe/Paris\"]. \n[/quote]\nDid you update Discourse? You only receive a notification to update when a new beta is released, but new commits are added every day.</input>"
    }
  ]
}

```

```json
{
  "id": "chatcmpl-752c6aacdc7f496b951592e88d485eb3",
  "object": "chat.completion",
  "created": 1733196730,
  "model": "Qwen/Qwen2.5-32B-Instruct-AWQ",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "<input>[quote=\"Arkshine, post:1, topic:339163\"]\n:information_source: This component requires Discourse to be current as of [date=2024-11-27 timezone=\"Europe/Paris\"]. \n[/quote]\nDid you update Discourse? You only receive a notification to update when a new beta is released, but new commits are added daily.</input>\n\n<output>[quote=\"Arkshine, post:1, topic:339163\"]\n:information_source: This component requires Discourse to be current as of [date=2024-11-27 timezone=\"Europe/Paris\"]. \n[/quote]\nDid you update Discourse? You only receive a notification to update when a new beta is released, but new commits are added daily.</output>",
        "tool_calls": []
      },
      "logprobs": null,
      "finish_reason": "stop",
      "stop_reason": null
    }
  ],
  "usage": {
    "prompt_tokens": 184,
    "total_tokens": 358,
    "completion_tokens": 174,
    "prompt_tokens_details": null
  },
  "prompt_logprobs": null
}

```

`<input>`와 `<output>` 태그를 모두 반환하는 것을 주목해 주세요. 따라서 여기에는 버그가 있습니다.

> <https://github.com/discourse/discourse-ai/blob/e3f5e86dc5d1d75d0cd45c9ece385e5198888d48/lib/ai_helper/assistant.rb#L174-L183>

정규식(Sanitize regex)이 input과 output을 모두 유지하고 있습니다.

API를 더 신중하게 다루어야 한다고 생각합니다. 교정만 요청하는 경우 output만 요청하거나 더 나은 프롬프트 엔지니어링을 수행해야 합니다.

또한 흥미롭게도, 예제가 있음에도 불구하고 더 이상 예제를 보내지 않고 있습니다 @Roman

---

_[View the full topic](https://meta.discourse.org/t/proofread-text-inserts-the-text-twice/339248)._
