Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) No edit summary |
||
Line 443:
document.getElementById('verifier-claim-text').textContent = claim;
// Fetch source content (URL extraction)
this.updateStatus('
const
if (!
this.updateStatus('Could not
return;
}
// Update UI with source info
this.activeSource =
const sourceElement = document.getElementById('verifier-source-text');
// Show the URL and indicate content will be fetched by AI
const urlMatch = sourceInfo.match(/Source URL: (https?:\/\/[^\s\n]+)/);
if (urlMatch) {
sourceElement.innerHTML = `<strong>Source URL:</strong><br><a href="${urlMatch[1]}" target="_blank" style="word-break: break-all;">${urlMatch[1]}</a><br><br><em>Content will be fetched and analyzed by AI during verification.</em>`;
} else {
sourceElement.textContent = sourceInfo;
}
// Enable verify button now that we have both claim and source
Line 547 ⟶ 554:
async fetchSourceContent(url) {
// Instead of trying to fetch the content directly (which fails due to CORS),
// we'll use the AI API to fetch and analyze the content
try {
//
return `Source URL: ${url}\n\n[Content will be fetched by AI during verification]`;
} catch (error) {
console.error('Error
throw new Error(`
}
}
Line 828 ⟶ 796:
}
async callClaudeAPI(claim,
// Extract URL from sourceInfo
const urlMatch = sourceInfo.match(/Source URL: (https?:\/\/[^\s\n]+)/);
const sourceUrl = urlMatch ? urlMatch[1] : null;
const requestBody = {
model: this.providers.claude.model,
max_tokens:
system: `You are a fact-checking assistant. Your task is to verify whether a claim from a Wikipedia article is supported by the
Instructions:
1. First, fetch and read the content from the provided URL
2. Analyze the claim and determine what specific facts it asserts
3. Search through the source content for information that supports or contradicts the claim
4. Provide a clear verdict: SUPPORTED, PARTIALLY SUPPORTED, NOT SUPPORTED, or UNCLEAR
5. Quote the specific sentences from the source that support your verdict
6. Explain any discrepancies or missing information
Be precise and objective in your analysis.`,
messages: [{
role: "user",
content:
`Please fetch the content from this URL and verify the claim against it.
Source URL: ${sourceUrl}` :
`Claim to verify: "${claim}"
Source content: "${sourceInfo}"`
}]
};
Line 870 ⟶ 849:
}
async callGeminiAPI(claim,
const API_URL = `https://generativelanguage.googleapis.com/v1beta/models/${this.providers.gemini.model}:generateContent?key=${this.getCurrentApiKey()}`;
// Extract URL from sourceInfo
const urlMatch = sourceInfo.match(/Source URL: (https?:\/\/[^\s\n]+)/);
const sourceUrl = urlMatch ? urlMatch[1] : null;
const systemPrompt = `You are a fact-checking assistant. Verify whether a Wikipedia claim is supported by the source content at the provided URL.
Instructions:
1. Fetch and read the content from the provided URL
2. Analyze the claim and determine what specific facts it asserts
3. Search through the source content for information that supports or contradicts the claim
4. Provide a clear verdict: SUPPORTED, PARTIALLY SUPPORTED, NOT SUPPORTED, or UNCLEAR
5. Quote the specific sentences from the source that support your verdict
6. Explain any discrepancies or missing information
Be precise and objective in your analysis.`;
Line 884 ⟶ 870:
const requestBody = {
contents: [{
parts: [{ "text":
`Please fetch the content from this URL and verify the claim against it.
Claim to verify: "${claim}"
Source URL: ${sourceUrl}` :
`Claim to verify: "${claim}"
Source content: "${sourceInfo}"` }],
}],
systemInstruction: {
Line 893 ⟶ 887:
temperature: 0.0,
},
tools: [
{urlContext: {}},
{googleSearch: {}},
],
};
Line 919 ⟶ 917:
}
async callOpenAIAPI(claim,
// Extract URL from sourceInfo
const urlMatch = sourceInfo.match(/Source URL: (https?:\/\/[^\s\n]+)/);
const sourceUrl = urlMatch ? urlMatch[1] : null;
const requestBody = {
model: this.providers.openai.model,
Line 926 ⟶ 928:
{
role: "system",
content: `You are a fact-checking assistant. Your task is to verify whether a claim from a Wikipedia article is supported by the
Instructions:
1. Analyze the claim and determine what specific facts it asserts
2.
3. Provide a clear verdict: SUPPORTED, PARTIALLY SUPPORTED, NOT SUPPORTED, or UNCLEAR
4. Explain your reasoning based on the available information
5. Note any limitations due to inability to access the full source content
Be precise and objective in your analysis.`
Line 939 ⟶ 941:
{
role: "user",
content:
`I need to verify this claim against a source, but I can only provide the URL since direct content fetching isn't available.
Claim to verify: "${claim}"
Source URL: ${sourceUrl}
Please provide analysis based on what you can determine from the URL and any known information about the source. Note that full verification would require accessing the complete source content.` :
`Claim to verify: "${claim}"
Source information: "${sourceInfo}"`
}
],
|