Skip to content

Commit a97fff0

Browse files
author
PHAN Xuan Quang
committed
fix display output
1 parent 2a55bbe commit a97fff0

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

XCan.Api/Controllers/MainController.cs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,13 @@ public async Task<ActionResult<string>> ExtractTextFromImage([FromBody] string i
104104
- **Fallback for Missing Emojis**: Provide text descriptions for emojis to maintain context.
105105
106106
**Output Requirements**:
107-
- Default to Markdown for core formatting, using HTML and CSS for complex elements.
108-
- Ensure all extracted text and elements closely match the original layout, maintaining details and structures.
109-
- Provide clear notes for any elements not replicable in Markdown, using HTML and CSS to enhance visibility and formatting.
110-
- Response with the 'Text Not Found' if you can't find any text in the image that I provide.";
107+
- **Default** to Markdown for core formatting, using HTML and CSS for complex elements.
108+
- Ensure all extracted text and elements **closely match** the original layout, maintaining details and structures.
109+
- The output content **must not** be wrapped as a fenced code block (""```html"", ""```markdown"", etc).
110+
- Provide **clear notes** for any elements not replicable in Markdown, using HTML and CSS to enhance visibility and formatting.
111+
- Response with the **Text Not Found** if you can't find any text in the provided image.";
111112
var prompt = "This is the image for you to extract text.";
112113
var result = await Generator.ContentFromImage(apiKey, instruction, prompt, image, false, 20);
113-
if (result.StartsWith("```") && result.EndsWith("```"))
114-
{
115-
var lines = result.Split(Environment.NewLine);
116-
result = string.Join(Environment.NewLine, lines.Skip(1).Take(lines.Length - 2));
117-
}
118114
return Ok(result.Trim());
119115
}
120116
catch (Exception ex)
@@ -154,11 +150,6 @@ public async Task<ActionResult<string>> TranslateTextToVietnamese([FromBody] Req
154150
.Trim();
155151

156152
var result = await Generator.ContentFromImage(apiKey, instruction.Trim(), content.ExtractedContent.Trim(), image, false, 50);
157-
if (result.StartsWith("```") && result.EndsWith("```"))
158-
{
159-
var lines = result.Split(Environment.NewLine);
160-
result = string.Join(Environment.NewLine, lines.Skip(1).Take(lines.Length - 2));
161-
}
162153

163154
return Ok(result.Trim());
164155
}

xcan.web/src/components/ResultDisplay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const ResultDisplay = ({
7676
marginBottom: "1rem",
7777
lineHeight: 1.6,
7878
whiteSpace: "pre-line",
79-
margin: "0.5em 0",
79+
marginBottom: 5,
8080
}}
8181
{...props}
8282
/>

0 commit comments

Comments
 (0)