|
|
@@ -8,7 +8,7 @@ const replaceCode = (text, index) => {
|
|
|
export default function formatDialogItem(item, index) {
|
|
|
const client_id = generateClientUniqueId(JSON.stringify(item));
|
|
|
|
|
|
- return {
|
|
|
+ const result = {
|
|
|
/**
|
|
|
* 客户端生成的ID
|
|
|
* 此数据作为列表唯一的key
|
|
|
@@ -47,5 +47,32 @@ export default function formatDialogItem(item, index) {
|
|
|
file_url: `http://${window.location.hostname}${port}${item.file_url}`,
|
|
|
}
|
|
|
})[0] : null,
|
|
|
+ };
|
|
|
+
|
|
|
+ if (item.code) {
|
|
|
+ result.code = `
|
|
|
+ <pre>
|
|
|
+ <code class="hljs language-python">
|
|
|
+${item.code}
|
|
|
+ </code>
|
|
|
+ </pre>
|
|
|
+ `
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item.sql) {
|
|
|
+ result.sql = `
|
|
|
+ <pre>
|
|
|
+ <code class="hljs language-sql">
|
|
|
+${item.sql}
|
|
|
+ </code>
|
|
|
+ </pre>
|
|
|
+ `
|
|
|
}
|
|
|
+
|
|
|
+ if (item.image_url) {
|
|
|
+ const port = window.location.port ? `:${window.location.port}` : '';
|
|
|
+ result.image_url = `http://${window.location.hostname}${port}${item.image_url}`
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
}
|